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]
Date:   Tue, 15 Nov 2022 17:28:45 +0800
From:   kernel test robot <lkp@...el.com>
To:     Shyam Prasad N <sprasad@...rosoft.com>
Cc:     llvm@...ts.linux.dev, oe-kbuild-all@...ts.linux.dev,
        linux-kernel@...r.kernel.org, Steve French <stfrench@...rosoft.com>
Subject: fs/cifs/sess.c:150:5: warning: stack frame size (1048) exceeds limit
 (1024) in 'cifs_try_adding_channels'

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   e01d50cbd6eece456843717a566a34e8b926cf0c
commit: aa45dadd34e44fcd6a9df4b395bee5b5633b4cec cifs: change iface_list from array to sorted linked list
date:   5 months ago
config: mips-randconfig-c004-20221114
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 463da45892e2d2a262277b91b96f5f8c05dc25d0)
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-mipsel-linux-gnu
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=aa45dadd34e44fcd6a9df4b395bee5b5633b4cec
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout aa45dadd34e44fcd6a9df4b395bee5b5633b4cec
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash fs/cifs/

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

All warnings (new ones prefixed by >>):

>> fs/cifs/sess.c:150:5: warning: stack frame size (1048) exceeds limit (1024) in 'cifs_try_adding_channels' [-Wframe-larger-than]
   int cifs_try_adding_channels(struct cifs_sb_info *cifs_sb, struct cifs_ses *ses)
       ^
   376/1048 (35.88%) spills, 672/1048 (64.12%) variables
   1 warning generated.


vim +/cifs_try_adding_channels +150 fs/cifs/sess.c

d1a931ce2e3b77 Shyam Prasad N  2021-07-19  148  
d70e9fa5588476 Aurelien Aptel  2019-09-20  149  /* returns number of channels added */
387ec58f339b0c Ronnie Sahlberg 2020-12-14 @150  int cifs_try_adding_channels(struct cifs_sb_info *cifs_sb, struct cifs_ses *ses)
d70e9fa5588476 Aurelien Aptel  2019-09-20  151  {
724244cdb38285 Shyam Prasad N  2021-07-19  152  	int old_chan_count, new_chan_count;
724244cdb38285 Shyam Prasad N  2021-07-19  153  	int left;
d70e9fa5588476 Aurelien Aptel  2019-09-20  154  	int rc = 0;
65a37a34145ca6 Aurelien Aptel  2019-11-20  155  	int tries = 0;
aa45dadd34e44f Shyam Prasad N  2022-01-01  156  	struct cifs_server_iface *iface = NULL, *niface = NULL;
d70e9fa5588476 Aurelien Aptel  2019-09-20  157  
724244cdb38285 Shyam Prasad N  2021-07-19  158  	spin_lock(&ses->chan_lock);
724244cdb38285 Shyam Prasad N  2021-07-19  159  
724244cdb38285 Shyam Prasad N  2021-07-19  160  	new_chan_count = old_chan_count = ses->chan_count;
724244cdb38285 Shyam Prasad N  2021-07-19  161  	left = ses->chan_max - ses->chan_count;
724244cdb38285 Shyam Prasad N  2021-07-19  162  
d70e9fa5588476 Aurelien Aptel  2019-09-20  163  	if (left <= 0) {
88b024f556fcd5 Shyam Prasad N  2021-11-19  164  		spin_unlock(&ses->chan_lock);
d70e9fa5588476 Aurelien Aptel  2019-09-20  165  		cifs_dbg(FYI,
d70e9fa5588476 Aurelien Aptel  2019-09-20  166  			 "ses already at max_channels (%zu), nothing to open\n",
d70e9fa5588476 Aurelien Aptel  2019-09-20  167  			 ses->chan_max);
d70e9fa5588476 Aurelien Aptel  2019-09-20  168  		return 0;
d70e9fa5588476 Aurelien Aptel  2019-09-20  169  	}
d70e9fa5588476 Aurelien Aptel  2019-09-20  170  
53923e0fe2098f Steve French    2022-02-16  171  	if (ses->server->dialect < SMB30_PROT_ID) {
53923e0fe2098f Steve French    2022-02-16  172  		spin_unlock(&ses->chan_lock);
53923e0fe2098f Steve French    2022-02-16  173  		cifs_dbg(VFS, "multichannel is not supported on this protocol version, use 3.0 or above\n");
53923e0fe2098f Steve French    2022-02-16  174  		return 0;
53923e0fe2098f Steve French    2022-02-16  175  	}
53923e0fe2098f Steve French    2022-02-16  176  
9c2dc11df50d1c Steve French    2021-05-07  177  	if (!(ses->server->capabilities & SMB2_GLOBAL_CAP_MULTI_CHANNEL)) {
9c2dc11df50d1c Steve French    2021-05-07  178  		ses->chan_max = 1;
724244cdb38285 Shyam Prasad N  2021-07-19  179  		spin_unlock(&ses->chan_lock);
0226487ad81464 Steve French    2021-11-15  180  		cifs_dbg(VFS, "server %s does not support multichannel\n", ses->server->hostname);
9c2dc11df50d1c Steve French    2021-05-07  181  		return 0;
9c2dc11df50d1c Steve French    2021-05-07  182  	}
724244cdb38285 Shyam Prasad N  2021-07-19  183  	spin_unlock(&ses->chan_lock);
9c2dc11df50d1c Steve French    2021-05-07  184  
65a37a34145ca6 Aurelien Aptel  2019-11-20  185  	/*
65a37a34145ca6 Aurelien Aptel  2019-11-20  186  	 * Keep connecting to same, fastest, iface for all channels as
65a37a34145ca6 Aurelien Aptel  2019-11-20  187  	 * long as its RSS. Try next fastest one if not RSS or channel
65a37a34145ca6 Aurelien Aptel  2019-11-20  188  	 * creation fails.
65a37a34145ca6 Aurelien Aptel  2019-11-20  189  	 */
aa45dadd34e44f Shyam Prasad N  2022-01-01  190  	spin_lock(&ses->iface_lock);
aa45dadd34e44f Shyam Prasad N  2022-01-01  191  	iface = list_first_entry(&ses->iface_list, struct cifs_server_iface,
aa45dadd34e44f Shyam Prasad N  2022-01-01  192  				 iface_head);
aa45dadd34e44f Shyam Prasad N  2022-01-01  193  	spin_unlock(&ses->iface_lock);
aa45dadd34e44f Shyam Prasad N  2022-01-01  194  
65a37a34145ca6 Aurelien Aptel  2019-11-20  195  	while (left > 0) {
d70e9fa5588476 Aurelien Aptel  2019-09-20  196  
65a37a34145ca6 Aurelien Aptel  2019-11-20  197  		tries++;
65a37a34145ca6 Aurelien Aptel  2019-11-20  198  		if (tries > 3*ses->chan_max) {
bbbf9eafbfdaa2 Steve French    2020-05-30  199  			cifs_dbg(FYI, "too many channel open attempts (%d channels left to open)\n",
65a37a34145ca6 Aurelien Aptel  2019-11-20  200  				 left);
65a37a34145ca6 Aurelien Aptel  2019-11-20  201  			break;
65a37a34145ca6 Aurelien Aptel  2019-11-20  202  		}
65a37a34145ca6 Aurelien Aptel  2019-11-20  203  
aa45dadd34e44f Shyam Prasad N  2022-01-01  204  		spin_lock(&ses->iface_lock);
aa45dadd34e44f Shyam Prasad N  2022-01-01  205  		if (!ses->iface_count) {
aa45dadd34e44f Shyam Prasad N  2022-01-01  206  			spin_unlock(&ses->iface_lock);
aa45dadd34e44f Shyam Prasad N  2022-01-01  207  			break;
aa45dadd34e44f Shyam Prasad N  2022-01-01  208  		}
aa45dadd34e44f Shyam Prasad N  2022-01-01  209  
aa45dadd34e44f Shyam Prasad N  2022-01-01  210  		list_for_each_entry_safe_from(iface, niface, &ses->iface_list,
aa45dadd34e44f Shyam Prasad N  2022-01-01  211  				    iface_head) {
aa45dadd34e44f Shyam Prasad N  2022-01-01  212  			/* skip ifaces that are unusable */
aa45dadd34e44f Shyam Prasad N  2022-01-01  213  			if (!iface->is_active ||
aa45dadd34e44f Shyam Prasad N  2022-01-01  214  			    (is_ses_using_iface(ses, iface) &&
aa45dadd34e44f Shyam Prasad N  2022-01-01  215  			     !iface->rss_capable)) {
d70e9fa5588476 Aurelien Aptel  2019-09-20  216  				continue;
65a37a34145ca6 Aurelien Aptel  2019-11-20  217  			}
d70e9fa5588476 Aurelien Aptel  2019-09-20  218  
aa45dadd34e44f Shyam Prasad N  2022-01-01  219  			/* take ref before unlock */
aa45dadd34e44f Shyam Prasad N  2022-01-01  220  			kref_get(&iface->refcount);
aa45dadd34e44f Shyam Prasad N  2022-01-01  221  
aa45dadd34e44f Shyam Prasad N  2022-01-01  222  			spin_unlock(&ses->iface_lock);
387ec58f339b0c Ronnie Sahlberg 2020-12-14  223  			rc = cifs_ses_add_channel(cifs_sb, ses, iface);
aa45dadd34e44f Shyam Prasad N  2022-01-01  224  			spin_lock(&ses->iface_lock);
aa45dadd34e44f Shyam Prasad N  2022-01-01  225  
d70e9fa5588476 Aurelien Aptel  2019-09-20  226  			if (rc) {
aa45dadd34e44f Shyam Prasad N  2022-01-01  227  				cifs_dbg(VFS, "failed to open extra channel on iface:%pIS rc=%d\n",
aa45dadd34e44f Shyam Prasad N  2022-01-01  228  					 &iface->sockaddr,
aa45dadd34e44f Shyam Prasad N  2022-01-01  229  					 rc);
aa45dadd34e44f Shyam Prasad N  2022-01-01  230  				kref_put(&iface->refcount, release_iface);
d70e9fa5588476 Aurelien Aptel  2019-09-20  231  				continue;
d70e9fa5588476 Aurelien Aptel  2019-09-20  232  			}
d70e9fa5588476 Aurelien Aptel  2019-09-20  233  
aa45dadd34e44f Shyam Prasad N  2022-01-01  234  			cifs_dbg(FYI, "successfully opened new channel on iface:%pIS\n",
aa45dadd34e44f Shyam Prasad N  2022-01-01  235  				 &iface->sockaddr);
aa45dadd34e44f Shyam Prasad N  2022-01-01  236  			break;
aa45dadd34e44f Shyam Prasad N  2022-01-01  237  		}
aa45dadd34e44f Shyam Prasad N  2022-01-01  238  		spin_unlock(&ses->iface_lock);
aa45dadd34e44f Shyam Prasad N  2022-01-01  239  
d70e9fa5588476 Aurelien Aptel  2019-09-20  240  		left--;
724244cdb38285 Shyam Prasad N  2021-07-19  241  		new_chan_count++;
d70e9fa5588476 Aurelien Aptel  2019-09-20  242  	}
d70e9fa5588476 Aurelien Aptel  2019-09-20  243  
724244cdb38285 Shyam Prasad N  2021-07-19  244  	return new_chan_count - old_chan_count;
d70e9fa5588476 Aurelien Aptel  2019-09-20  245  }
d70e9fa5588476 Aurelien Aptel  2019-09-20  246  

:::::: The code at line 150 was first introduced by commit
:::::: 387ec58f339b0c45e3767395f11fa8dd3772131e cifs: simplify handling of cifs_sb/ctx->local_nls

:::::: TO: Ronnie Sahlberg <lsahlber@...hat.com>
:::::: CC: Steve French <stfrench@...rosoft.com>

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

View attachment "config" of type "text/plain" (155192 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ