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:   Wed, 19 Oct 2022 13:55:26 +0800
From:   kernel test robot <lkp@...el.com>
To:     Zhang Xiaoxu <zhangxiaoxu5@...wei.com>
Cc:     llvm@...ts.linux.dev, kbuild-all@...ts.01.org,
        linux-kernel@...r.kernel.org,
        Steve French <stfrench@...rosoft.com>,
        "Paulo Alcantara (SUSE)" <pc@....nz>
Subject: [samba-ksmbd:for-next 5/8] fs/cifs/sess.c:160:5: warning: stack
 frame size (1040) exceeds limit (1024) in 'cifs_try_adding_channels'

tree:   git://git.samba.org/ksmbd.git for-next
head:   1b028682528ca86559cad5311eb52b57333cecf0
commit: 028ef0e246faa6432a713e4c67e89266555277e7 [5/8] cifs: Fix xid leak in cifs_ses_add_channel()
config: mips-randconfig-r025-20221018
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 791a7ae1ba3efd6bca96338e10ffde557ba83920)
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
        git remote add samba-ksmbd git://git.samba.org/ksmbd.git
        git fetch --no-tags samba-ksmbd for-next
        git checkout 028ef0e246faa6432a713e4c67e89266555277e7
        # 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 drivers/pinctrl/ 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:160:5: warning: stack frame size (1040) 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)
       ^
   1 warning generated.


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

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

:::::: The code at line 160 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" (150685 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ