[staging:staging-next 201/268] drivers/staging/rtl8723bs/core/rtw_security.c:89:6: warning: stack frame size of 1120 bytes in function 'rtw_wep_encrypt'

Fabio Aiuto fabioaiuto83 at gmail.com
Sat May 22 07:48:31 UTC 2021


Hello Nathan,

On Fri, May 21, 2021 at 12:19:39PM -0700, Nathan Chancellor wrote:
> Hi Fabio,
> 
> On Fri, May 21, 2021 at 04:26:57PM +0200, Fabio Aiuto wrote:
> > Hi robot,
> > 
> > On Thu, May 20, 2021 at 05:03:14PM +0800, kernel test robot wrote:
> > > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git staging-next
> > > head:   b9f38e913a926b455e5048a95f53a993b515509f
> > > commit: 1b11e893eda0907fc9b28696271e2d9c4337e42d [201/268] staging: rtl8723bs: replace private arc4 encryption with in-kernel one
> > > config: powerpc64-randconfig-r011-20210520 (attached as .config)
> > > compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project bf9ef3efaa99c02e7bfc4c57207301b8de39a278)
> > > 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 powerpc64 cross compiling tool for clang build
> > >         # apt-get install binutils-powerpc64-linux-gnu
> > >         # https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git/commit/?id=1b11e893eda0907fc9b28696271e2d9c4337e42d
> > >         git remote add staging https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
> > >         git fetch --no-tags staging staging-next
> > >         git checkout 1b11e893eda0907fc9b28696271e2d9c4337e42d
> > >         # save the attached .config to linux build tree
> > >         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc64 
> > 
> > can't compile this, I get the following error:
> > 
> > make CONFIG_OF_ALL_DTBS=y CONFIG_DTC=y HOSTCC=/home/fabio/0day/clang/bin/clang CC=/home/fabio/0day/clang/bin/clang LD=/home/fabio/0day/clang/bin/ld.lld HOSTLD=/home/fabio/0day/clang/bin/ld.lld AR=/home/fabio/0day/clang/bin/llvm-ar NM=/home/fabio/0day/clang/bin/llvm-nm STRIP=/home/fabio/0day/clang/bin/llvm-strip OBJDUMP=/home/fabio/0day/clang/bin/llvm-objdump OBJSIZE=/home/fabio/0day/clang/bin/llvm-size READELF=/home/fabio/0day/clang/bin/llvm-readelf HOSTCXX=/home/fabio/0day/clang/bin/clang++ HOSTAR=/home/fabio/0day/clang/bin/llvm-ar CROSS_COMPILE=powerpc-linux-gnu- --jobs=8 LLVM_IAS=1 ARCH=powerpc drivers/staging/rtl8723bs/
> >   CC      scripts/mod/empty.o
> > clang: error: unsupported argument '-me500' to option 'Wa,'
> > make[1]: *** [scripts/Makefile.build:272: scripts/mod/empty.o] Error 1
> > make[1]: *** Attesa per i processi non terminati....
> > make: *** [Makefile:1226: prepare0] Error 2
> > 
> > moreover I had to add LLVM_IAS=1, and ARCH=powerpc64 is not a valid architecture (used powerpc instead).
> > 
> > Could you help me?
> > 
> 
> This is not a clang specific issue, I would not bother with trying to
> use the bot's reproducer steps.
> 
> I can reproduce it with GCC 11.1.0 using the following commands:
> 
> $ make -skj"$(nproc)" ARCH=i386 defconfig
> 
> $ scripts/config -e MMC -e STAGING -m RTL8723BS
> 
> $ make -skj"$(nproc)" ARCH=i386 olddefconfig drivers/staging/rtl8723bs/
> drivers/staging/rtl8723bs/core/rtw_security.c: In function ‘rtw_wep_encrypt’:
> drivers/staging/rtl8723bs/core/rtw_security.c:91:1: warning: the frame size of 1084 bytes is larger than 1024 bytes [-Wframe-larger-than=]
>    91 | }
>       | ^
> drivers/staging/rtl8723bs/core/rtw_security.c: In function ‘rtw_wep_decrypt’:
> drivers/staging/rtl8723bs/core/rtw_security.c:128:1: warning: the frame size of 1060 bytes is larger than 1024 bytes [-Wframe-larger-than=]
>   128 | }
>       | ^
> drivers/staging/rtl8723bs/core/rtw_security.c: In function ‘rtw_tkip_encrypt’:
> drivers/staging/rtl8723bs/core/rtw_security.c:531:1: warning: the frame size of 1112 bytes is larger than 1024 bytes [-Wframe-larger-than=]
>   531 | }
>       | ^
> drivers/staging/rtl8723bs/core/rtw_security.c: In function ‘rtw_tkip_decrypt’:
> drivers/staging/rtl8723bs/core/rtw_security.c:633:1: warning: the frame size of 1084 bytes is larger than 1024 bytes [-Wframe-larger-than=]
>   633 | }
>       | ^

I could not get these warnings in a x86_64 build, so I tried
to reproduce exactly what the robot says. I should have tried
simply an i386 build :)

> 
> Your commit introduced this because the size of the arc4_ctx structure
> is 1032 bytes so allocating it on the stack will cause it to go over the
> 32-bit limit of 1024 bytes. The previous arc4context was only 264 bytes.
> For that large of structure, I would recommend allocating it on the heap
> with kzalloc() and freeing with kfree_sensitive().

I have already I fixed it by putting two arc4_ctx field in security_priv struct without
locally allocating each time encryption-decryption functions are called.
Hope this is good...

> 
> Cheers,
> Nathan

thank you for help,

fabio


More information about the devel mailing list