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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202103202248.IxFPn3Nq-lkp@intel.com>
Date:   Sat, 20 Mar 2021 22:59:02 +0800
From:   kernel test robot <lkp@...el.com>
To:     Xingxing Su <suxingxing@...ngson.cn>
Cc:     kbuild-all@...ts.01.org, clang-built-linux@...glegroups.com,
        linux-kernel@...r.kernel.org,
        Thomas Bogendoerfer <tsbogend@...ha.franken.de>,
        Youling Tang <tangyouling@...ngson.cn>
Subject: fs/select.c:970:12: warning: stack frame size of 1032 bytes in
 function 'do_sys_poll'

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   1c273e10bc0cc7efb933e0ca10e260cdfc9f0b8c
commit: 8b3165e54566e8bb8f4b7d4e5f12ced78ce462bb MIPS: Enable GCOV
date:   4 months ago
config: mips-randconfig-r022-20210320 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 436c6c9c20cc522c92a923440a5fc509c342a7db)
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=8b3165e54566e8bb8f4b7d4e5f12ced78ce462bb
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 8b3165e54566e8bb8f4b7d4e5f12ced78ce462bb
        # 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 >>):

   fs/select.c:621:5: warning: stack frame size of 1032 bytes in function 'core_sys_select' [-Wframe-larger-than=]
   int core_sys_select(int n, fd_set __user *inp, fd_set __user *outp,
       ^
>> fs/select.c:970:12: warning: stack frame size of 1032 bytes in function 'do_sys_poll' [-Wframe-larger-than=]
   static int do_sys_poll(struct pollfd __user *ufds, unsigned int nfds,
              ^
   2 warnings generated.


vim +/do_sys_poll +970 fs/select.c

^1da177e4c3f41 Linus Torvalds      2005-04-16   966  
70674f95c0a2ea Andi Kleen          2006-03-28   967  #define N_STACK_PPS ((sizeof(stack_pps) - sizeof(struct poll_list))  / \
70674f95c0a2ea Andi Kleen          2006-03-28   968  			sizeof(struct pollfd))
70674f95c0a2ea Andi Kleen          2006-03-28   969  
e99ca56ce03dd9 Al Viro             2017-04-08  @970  static int do_sys_poll(struct pollfd __user *ufds, unsigned int nfds,
766b9f928bd5b9 Deepa Dinamani      2016-05-19   971  		struct timespec64 *end_time)
^1da177e4c3f41 Linus Torvalds      2005-04-16   972  {
^1da177e4c3f41 Linus Torvalds      2005-04-16   973  	struct poll_wqueues table;
43e11fa2d1d3b6 Gustavo A. R. Silva 2019-07-16   974  	int err = -EFAULT, fdcount, len;
30c14e40ed8546 Jes Sorensen        2006-03-31   975  	/* Allocate small arguments on the stack to save memory and be
30c14e40ed8546 Jes Sorensen        2006-03-31   976  	   faster - use long to make sure the buffer is aligned properly
30c14e40ed8546 Jes Sorensen        2006-03-31   977  	   on 64 bit archs to avoid unaligned access */
30c14e40ed8546 Jes Sorensen        2006-03-31   978  	long stack_pps[POLL_STACK_ALLOC/sizeof(long)];
252e5725cfb55a Oleg Nesterov       2007-10-16   979  	struct poll_list *const head = (struct poll_list *)stack_pps;
252e5725cfb55a Oleg Nesterov       2007-10-16   980   	struct poll_list *walk = head;
252e5725cfb55a Oleg Nesterov       2007-10-16   981   	unsigned long todo = nfds;
^1da177e4c3f41 Linus Torvalds      2005-04-16   982  
d554ed895dc8f2 Jiri Slaby          2010-03-05   983  	if (nfds > rlimit(RLIMIT_NOFILE))
^1da177e4c3f41 Linus Torvalds      2005-04-16   984  		return -EINVAL;
^1da177e4c3f41 Linus Torvalds      2005-04-16   985  
252e5725cfb55a Oleg Nesterov       2007-10-16   986  	len = min_t(unsigned int, nfds, N_STACK_PPS);
252e5725cfb55a Oleg Nesterov       2007-10-16   987  	for (;;) {
252e5725cfb55a Oleg Nesterov       2007-10-16   988  		walk->next = NULL;
252e5725cfb55a Oleg Nesterov       2007-10-16   989  		walk->len = len;
252e5725cfb55a Oleg Nesterov       2007-10-16   990  		if (!len)
252e5725cfb55a Oleg Nesterov       2007-10-16   991  			break;
^1da177e4c3f41 Linus Torvalds      2005-04-16   992  
252e5725cfb55a Oleg Nesterov       2007-10-16   993  		if (copy_from_user(walk->entries, ufds + nfds-todo,
252e5725cfb55a Oleg Nesterov       2007-10-16   994  					sizeof(struct pollfd) * walk->len))
^1da177e4c3f41 Linus Torvalds      2005-04-16   995  			goto out_fds;
^1da177e4c3f41 Linus Torvalds      2005-04-16   996  
252e5725cfb55a Oleg Nesterov       2007-10-16   997  		todo -= walk->len;
252e5725cfb55a Oleg Nesterov       2007-10-16   998  		if (!todo)
252e5725cfb55a Oleg Nesterov       2007-10-16   999  			break;
252e5725cfb55a Oleg Nesterov       2007-10-16  1000  
252e5725cfb55a Oleg Nesterov       2007-10-16  1001  		len = min(todo, POLLFD_PER_PAGE);
43e11fa2d1d3b6 Gustavo A. R. Silva 2019-07-16  1002  		walk = walk->next = kmalloc(struct_size(walk, entries, len),
43e11fa2d1d3b6 Gustavo A. R. Silva 2019-07-16  1003  					    GFP_KERNEL);
252e5725cfb55a Oleg Nesterov       2007-10-16  1004  		if (!walk) {
252e5725cfb55a Oleg Nesterov       2007-10-16  1005  			err = -ENOMEM;
^1da177e4c3f41 Linus Torvalds      2005-04-16  1006  			goto out_fds;
^1da177e4c3f41 Linus Torvalds      2005-04-16  1007  		}
^1da177e4c3f41 Linus Torvalds      2005-04-16  1008  	}
9f72949f679df0 David Woodhouse     2006-01-18  1009  
252e5725cfb55a Oleg Nesterov       2007-10-16  1010  	poll_initwait(&table);
ccec5ee302d5cb Mateusz Guzik       2016-01-06  1011  	fdcount = do_poll(head, &table, end_time);
252e5725cfb55a Oleg Nesterov       2007-10-16  1012  	poll_freewait(&table);
^1da177e4c3f41 Linus Torvalds      2005-04-16  1013  
252e5725cfb55a Oleg Nesterov       2007-10-16  1014  	for (walk = head; walk; walk = walk->next) {
^1da177e4c3f41 Linus Torvalds      2005-04-16  1015  		struct pollfd *fds = walk->entries;
^1da177e4c3f41 Linus Torvalds      2005-04-16  1016  		int j;
^1da177e4c3f41 Linus Torvalds      2005-04-16  1017  
252e5725cfb55a Oleg Nesterov       2007-10-16  1018  		for (j = 0; j < walk->len; j++, ufds++)
^1da177e4c3f41 Linus Torvalds      2005-04-16  1019  			if (__put_user(fds[j].revents, &ufds->revents))
^1da177e4c3f41 Linus Torvalds      2005-04-16  1020  				goto out_fds;
^1da177e4c3f41 Linus Torvalds      2005-04-16  1021    	}
252e5725cfb55a Oleg Nesterov       2007-10-16  1022  
^1da177e4c3f41 Linus Torvalds      2005-04-16  1023  	err = fdcount;
^1da177e4c3f41 Linus Torvalds      2005-04-16  1024  out_fds:
252e5725cfb55a Oleg Nesterov       2007-10-16  1025  	walk = head->next;
252e5725cfb55a Oleg Nesterov       2007-10-16  1026  	while (walk) {
252e5725cfb55a Oleg Nesterov       2007-10-16  1027  		struct poll_list *pos = walk;
252e5725cfb55a Oleg Nesterov       2007-10-16  1028  		walk = walk->next;
252e5725cfb55a Oleg Nesterov       2007-10-16  1029  		kfree(pos);
^1da177e4c3f41 Linus Torvalds      2005-04-16  1030  	}
252e5725cfb55a Oleg Nesterov       2007-10-16  1031  
^1da177e4c3f41 Linus Torvalds      2005-04-16  1032  	return err;
^1da177e4c3f41 Linus Torvalds      2005-04-16  1033  }
9f72949f679df0 David Woodhouse     2006-01-18  1034  

:::::: The code at line 970 was first introduced by commit
:::::: e99ca56ce03dd90991025878152bae8b53484147 move compat select-related syscalls to fs/select.c

:::::: TO: Al Viro <viro@...iv.linux.org.uk>
:::::: CC: Al Viro <viro@...iv.linux.org.uk>

---
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" (26153 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ