lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202103140338.qNTTxtn6-lkp@intel.com>
Date:   Sun, 14 Mar 2021 03:35:45 +0800
From:   kernel test robot <lkp@...el.com>
To:     Paolo Abeni <pabeni@...hat.com>
Cc:     kbuild-all@...ts.01.org, clang-built-linux@...glegroups.com,
        linux-kernel@...r.kernel.org, Jakub Kicinski <kuba@...nel.org>,
        Mat Martineau <mathew.j.martineau@...ux.intel.com>
Subject: net/mptcp/protocol.c:1568:12: warning: stack frame size of 1032
 bytes in function 'mptcp_sendmsg'

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   f296bfd5cd04cbb49b8fc9585adc280ab2b58624
commit: 6e628cd3a8f78cb0dfe85353e5e488bda296bedf mptcp: use mptcp release_cb for delayed tasks
date:   3 months ago
config: mips-randconfig-r034-20210313 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project dfd27ebbd0eb137c9a439b7c537bb87ba903efd3)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install mips cross compiling tool for clang build
        # apt-get install binutils-mips-linux-gnu
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=6e628cd3a8f78cb0dfe85353e5e488bda296bedf
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 6e628cd3a8f78cb0dfe85353e5e488bda296bedf
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=mips 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>

All warnings (new ones prefixed by >>):

>> net/mptcp/protocol.c:1568:12: warning: stack frame size of 1032 bytes in function 'mptcp_sendmsg' [-Wframe-larger-than=]
   static int mptcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
              ^
   1 warning generated.


vim +/mptcp_sendmsg +1568 net/mptcp/protocol.c

6e628cd3a8f78c Paolo Abeni      2020-11-27  1567  
d9ca1de8c0cd7a Paolo Abeni      2020-11-16 @1568  static int mptcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
d9ca1de8c0cd7a Paolo Abeni      2020-11-16  1569  {
d9ca1de8c0cd7a Paolo Abeni      2020-11-16  1570  	struct mptcp_sock *msk = mptcp_sk(sk);
17091708d1e503 Florian Westphal 2020-05-16  1571  	struct page_frag *pfrag;
6d0060f600adfd Mat Martineau    2020-01-21  1572  	size_t copied = 0;
caf971df01b86f Paolo Abeni      2020-11-16  1573  	int ret = 0;
6d0060f600adfd Mat Martineau    2020-01-21  1574  	long timeo;
f870fa0b576884 Mat Martineau    2020-01-21  1575  
f870fa0b576884 Mat Martineau    2020-01-21  1576  	if (msg->msg_flags & ~(MSG_MORE | MSG_DONTWAIT | MSG_NOSIGNAL))
f870fa0b576884 Mat Martineau    2020-01-21  1577  		return -EOPNOTSUPP;
f870fa0b576884 Mat Martineau    2020-01-21  1578  
e93da92896bc0d Paolo Abeni      2020-11-27  1579  	mptcp_lock_sock(sk, __mptcp_wmem_reserve(sk, len));
1954b86016cf85 Mat Martineau    2020-02-28  1580  
1954b86016cf85 Mat Martineau    2020-02-28  1581  	timeo = sock_sndtimeo(sk, msg->msg_flags & MSG_DONTWAIT);
1954b86016cf85 Mat Martineau    2020-02-28  1582  
1954b86016cf85 Mat Martineau    2020-02-28  1583  	if ((1 << sk->sk_state) & ~(TCPF_ESTABLISHED | TCPF_CLOSE_WAIT)) {
1954b86016cf85 Mat Martineau    2020-02-28  1584  		ret = sk_stream_wait_connect(sk, &timeo);
1954b86016cf85 Mat Martineau    2020-02-28  1585  		if (ret)
1954b86016cf85 Mat Martineau    2020-02-28  1586  			goto out;
1954b86016cf85 Mat Martineau    2020-02-28  1587  	}
1954b86016cf85 Mat Martineau    2020-02-28  1588  
17091708d1e503 Florian Westphal 2020-05-16  1589  	pfrag = sk_page_frag(sk);
18b683bff89d46 Paolo Abeni      2020-03-27  1590  
d9ca1de8c0cd7a Paolo Abeni      2020-11-16  1591  	while (msg_data_left(msg)) {
724cfd2ee8aa12 Paolo Abeni      2020-11-27  1592  		int total_ts, frag_truesize = 0;
d9ca1de8c0cd7a Paolo Abeni      2020-11-16  1593  		struct mptcp_data_frag *dfrag;
724cfd2ee8aa12 Paolo Abeni      2020-11-27  1594  		struct sk_buff_head skbs;
d9ca1de8c0cd7a Paolo Abeni      2020-11-16  1595  		bool dfrag_collapsed;
d9ca1de8c0cd7a Paolo Abeni      2020-11-16  1596  		size_t psize, offset;
d9ca1de8c0cd7a Paolo Abeni      2020-11-16  1597  
57baaf2875404b Mat Martineau    2020-07-28  1598  		if (sk->sk_err || (sk->sk_shutdown & SEND_SHUTDOWN)) {
57baaf2875404b Mat Martineau    2020-07-28  1599  			ret = -EPIPE;
57baaf2875404b Mat Martineau    2020-07-28  1600  			goto out;
57baaf2875404b Mat Martineau    2020-07-28  1601  		}
57baaf2875404b Mat Martineau    2020-07-28  1602  
d9ca1de8c0cd7a Paolo Abeni      2020-11-16  1603  		/* reuse tail pfrag, if possible, or carve a new one from the
d9ca1de8c0cd7a Paolo Abeni      2020-11-16  1604  		 * page allocator
fb529e62d3f3e8 Florian Westphal 2020-05-16  1605  		 */
d9ca1de8c0cd7a Paolo Abeni      2020-11-16  1606  		dfrag = mptcp_pending_tail(sk);
d9ca1de8c0cd7a Paolo Abeni      2020-11-16  1607  		dfrag_collapsed = mptcp_frag_can_collapse_to(msk, pfrag, dfrag);
d9ca1de8c0cd7a Paolo Abeni      2020-11-16  1608  		if (!dfrag_collapsed) {
d9ca1de8c0cd7a Paolo Abeni      2020-11-16  1609  			if (!sk_stream_memory_free(sk))
d9ca1de8c0cd7a Paolo Abeni      2020-11-16  1610  				goto wait_for_memory;
6e628cd3a8f78c Paolo Abeni      2020-11-27  1611  
d9ca1de8c0cd7a Paolo Abeni      2020-11-16  1612  			if (!mptcp_page_frag_refill(sk, pfrag))
d9ca1de8c0cd7a Paolo Abeni      2020-11-16  1613  				goto wait_for_memory;
cec37a6e41aae7 Peter Krystad    2020-01-21  1614  
d9ca1de8c0cd7a Paolo Abeni      2020-11-16  1615  			dfrag = mptcp_carve_data_frag(msk, pfrag, pfrag->offset);
d9ca1de8c0cd7a Paolo Abeni      2020-11-16  1616  			frag_truesize = dfrag->overhead;
72511aab95c94d Florian Westphal 2020-05-16  1617  		}
6d0060f600adfd Mat Martineau    2020-01-21  1618  
d9ca1de8c0cd7a Paolo Abeni      2020-11-16  1619  		/* we do not bound vs wspace, to allow a single packet.
d9ca1de8c0cd7a Paolo Abeni      2020-11-16  1620  		 * memory accounting will prevent execessive memory usage
d9ca1de8c0cd7a Paolo Abeni      2020-11-16  1621  		 * anyway
d5f49190def61c Paolo Abeni      2020-09-14  1622  		 */
d9ca1de8c0cd7a Paolo Abeni      2020-11-16  1623  		offset = dfrag->offset + dfrag->data_len;
d9ca1de8c0cd7a Paolo Abeni      2020-11-16  1624  		psize = pfrag->size - offset;
d9ca1de8c0cd7a Paolo Abeni      2020-11-16  1625  		psize = min_t(size_t, psize, msg_data_left(msg));
724cfd2ee8aa12 Paolo Abeni      2020-11-27  1626  		total_ts = psize + frag_truesize;
724cfd2ee8aa12 Paolo Abeni      2020-11-27  1627  		__skb_queue_head_init(&skbs);
724cfd2ee8aa12 Paolo Abeni      2020-11-27  1628  		if (!mptcp_tx_cache_refill(sk, psize, &skbs, &total_ts))
d9ca1de8c0cd7a Paolo Abeni      2020-11-16  1629  			goto wait_for_memory;
d9ca1de8c0cd7a Paolo Abeni      2020-11-16  1630  
724cfd2ee8aa12 Paolo Abeni      2020-11-27  1631  		if (!mptcp_wmem_alloc(sk, total_ts)) {
724cfd2ee8aa12 Paolo Abeni      2020-11-27  1632  			__skb_queue_purge(&skbs);
724cfd2ee8aa12 Paolo Abeni      2020-11-27  1633  			goto wait_for_memory;
724cfd2ee8aa12 Paolo Abeni      2020-11-27  1634  		}
724cfd2ee8aa12 Paolo Abeni      2020-11-27  1635  
724cfd2ee8aa12 Paolo Abeni      2020-11-27  1636  		skb_queue_splice_tail(&skbs, &msk->skb_tx_cache);
d9ca1de8c0cd7a Paolo Abeni      2020-11-16  1637  		if (copy_page_from_iter(dfrag->page, offset, psize,
d9ca1de8c0cd7a Paolo Abeni      2020-11-16  1638  					&msg->msg_iter) != psize) {
879526030c8b5e Paolo Abeni      2020-11-27  1639  			mptcp_wmem_uncharge(sk, psize + frag_truesize);
d9ca1de8c0cd7a Paolo Abeni      2020-11-16  1640  			ret = -EFAULT;
d9ca1de8c0cd7a Paolo Abeni      2020-11-16  1641  			goto out;
72511aab95c94d Florian Westphal 2020-05-16  1642  		}
72511aab95c94d Florian Westphal 2020-05-16  1643  
d9ca1de8c0cd7a Paolo Abeni      2020-11-16  1644  		/* data successfully copied into the write queue */
d9ca1de8c0cd7a Paolo Abeni      2020-11-16  1645  		copied += psize;
d9ca1de8c0cd7a Paolo Abeni      2020-11-16  1646  		dfrag->data_len += psize;
d9ca1de8c0cd7a Paolo Abeni      2020-11-16  1647  		frag_truesize += psize;
d9ca1de8c0cd7a Paolo Abeni      2020-11-16  1648  		pfrag->offset += frag_truesize;
d9ca1de8c0cd7a Paolo Abeni      2020-11-16  1649  		WRITE_ONCE(msk->write_seq, msk->write_seq + psize);
d9ca1de8c0cd7a Paolo Abeni      2020-11-16  1650  
d9ca1de8c0cd7a Paolo Abeni      2020-11-16  1651  		/* charge data on mptcp pending queue to the msk socket
d9ca1de8c0cd7a Paolo Abeni      2020-11-16  1652  		 * Note: we charge such data both to sk and ssk
fb529e62d3f3e8 Florian Westphal 2020-05-16  1653  		 */
d9ca1de8c0cd7a Paolo Abeni      2020-11-16  1654  		sk_wmem_queued_add(sk, frag_truesize);
d9ca1de8c0cd7a Paolo Abeni      2020-11-16  1655  		if (!dfrag_collapsed) {
d9ca1de8c0cd7a Paolo Abeni      2020-11-16  1656  			get_page(dfrag->page);
d9ca1de8c0cd7a Paolo Abeni      2020-11-16  1657  			list_add_tail(&dfrag->list, &msk->rtx_queue);
d9ca1de8c0cd7a Paolo Abeni      2020-11-16  1658  			if (!msk->first_pending)
d9ca1de8c0cd7a Paolo Abeni      2020-11-16  1659  				WRITE_ONCE(msk->first_pending, dfrag);
6d0060f600adfd Mat Martineau    2020-01-21  1660  		}
d9ca1de8c0cd7a Paolo Abeni      2020-11-16  1661  		pr_debug("msk=%p dfrag at seq=%lld len=%d sent=%d new=%d", msk,
d9ca1de8c0cd7a Paolo Abeni      2020-11-16  1662  			 dfrag->data_seq, dfrag->data_len, dfrag->already_sent,
d9ca1de8c0cd7a Paolo Abeni      2020-11-16  1663  			 !dfrag_collapsed);
6d0060f600adfd Mat Martineau    2020-01-21  1664  
d9ca1de8c0cd7a Paolo Abeni      2020-11-16  1665  		continue;
b51f9b80c032e1 Paolo Abeni      2020-03-27  1666  
d9ca1de8c0cd7a Paolo Abeni      2020-11-16  1667  wait_for_memory:
6e628cd3a8f78c Paolo Abeni      2020-11-27  1668  		set_bit(MPTCP_NOSPACE, &msk->flags);
6e628cd3a8f78c Paolo Abeni      2020-11-27  1669  		mptcp_push_pending(sk, msg->msg_flags);
d9ca1de8c0cd7a Paolo Abeni      2020-11-16  1670  		ret = sk_stream_wait_memory(sk, &timeo);
d9ca1de8c0cd7a Paolo Abeni      2020-11-16  1671  		if (ret)
d9ca1de8c0cd7a Paolo Abeni      2020-11-16  1672  			goto out;
57040755a3e43a Paolo Abeni      2020-01-21  1673  	}
6d0060f600adfd Mat Martineau    2020-01-21  1674  
724cfd2ee8aa12 Paolo Abeni      2020-11-27  1675  	if (copied) {
724cfd2ee8aa12 Paolo Abeni      2020-11-27  1676  		msk->tx_pending_data += copied;
d9ca1de8c0cd7a Paolo Abeni      2020-11-16  1677  		mptcp_push_pending(sk, msg->msg_flags);
724cfd2ee8aa12 Paolo Abeni      2020-11-27  1678  	}
d9ca1de8c0cd7a Paolo Abeni      2020-11-16  1679  
1954b86016cf85 Mat Martineau    2020-02-28  1680  out:
cec37a6e41aae7 Peter Krystad    2020-01-21  1681  	release_sock(sk);
8555c6bfd5fddb Paolo Abeni      2020-08-03  1682  	return copied ? : ret;
f870fa0b576884 Mat Martineau    2020-01-21  1683  }
f870fa0b576884 Mat Martineau    2020-01-21  1684  

:::::: The code at line 1568 was first introduced by commit
:::::: d9ca1de8c0cd7a8ca2a0506e1741418741848e53 mptcp: move page frag allocation in mptcp_sendmsg()

:::::: TO: Paolo Abeni <pabeni@...hat.com>
:::::: CC: Jakub Kicinski <kuba@...nel.org>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

Download attachment ".config.gz" of type "application/gzip" (29505 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ