Re: [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'

2021-05-22 Thread Fabio Aiuto
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
___
devel mailing list
de...@linuxdriverproject.org

Re: [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'

2021-05-21 Thread Nathan Chancellor
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 | }
  | ^

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().

Cheers,
Nathan
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [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'

2021-05-21 Thread Fabio Aiuto
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?

thank you,

fabio
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[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'

2021-05-20 Thread kernel test robot
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 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 

All warnings (new ones prefixed by >>):

   arch/powerpc/include/asm/io-defs.h:45:1: warning: performing pointer 
arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
   DEF_PCI_AC_NORET(insw, (unsigned long p, void *b, unsigned long c),
   ^~~
   arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 
'DEF_PCI_AC_NORET'
   __do_##name al; \
   ^~
   :126:1: note: expanded from here
   __do_insw
   ^
   arch/powerpc/include/asm/io.h:557:56: note: expanded from macro '__do_insw'
   #define __do_insw(p, b, n)  readsw((PCI_IO_ADDR)_IO_BASE+(p), (b), (n))
  ~^
   In file included from drivers/staging/rtl8723bs/core/rtw_security.c:8:
   In file included from drivers/staging/rtl8723bs/include/drv_types.h:20:
   In file included from drivers/staging/rtl8723bs/include/osdep_service.h:15:
   In file included from 
drivers/staging/rtl8723bs/include/osdep_service_linux.h:19:
   In file included from include/linux/netdevice.h:37:
   In file included from include/net/net_namespace.h:38:
   In file included from include/linux/skbuff.h:31:
   In file included from include/linux/dma-mapping.h:10:
   In file included from include/linux/scatterlist.h:9:
   In file included from arch/powerpc/include/asm/io.h:619:
   arch/powerpc/include/asm/io-defs.h:47:1: warning: performing pointer 
arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
   DEF_PCI_AC_NORET(insl, (unsigned long p, void *b, unsigned long c),
   ^~~
   arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 
'DEF_PCI_AC_NORET'
   __do_##name al; \
   ^~
   :128:1: note: expanded from here
   __do_insl
   ^
   arch/powerpc/include/asm/io.h:558:56: note: expanded from macro '__do_insl'
   #define __do_insl(p, b, n)  readsl((PCI_IO_ADDR)_IO_BASE+(p), (b), (n))
  ~^
   In file included from drivers/staging/rtl8723bs/core/rtw_security.c:8:
   In file included from drivers/staging/rtl8723bs/include/drv_types.h:20:
   In file included from drivers/staging/rtl8723bs/include/osdep_service.h:15:
   In file included from 
drivers/staging/rtl8723bs/include/osdep_service_linux.h:19:
   In file included from include/linux/netdevice.h:37:
   In file included from include/net/net_namespace.h:38:
   In file included from include/linux/skbuff.h:31:
   In file included from include/linux/dma-mapping.h:10:
   In file included from include/linux/scatterlist.h:9:
   In file included from arch/powerpc/include/asm/io.h:619:
   arch/powerpc/include/asm/io-defs.h:49:1: warning: performing pointer 
arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
   DEF_PCI_AC_NORET(outsb, (unsigned long p, const void *b, unsigned long c),
   ^~
   arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 
'DEF_PCI_AC_NORET'
   __do_##name al; \
   ^~
   :130:1: note: expanded from here
   __do_outsb
   ^
   arch/powerpc/include/asm/io.h:559:58: note: expanded from macro '__do_outsb'
   #define __do_outsb(p, b, n) writesb((PCI_IO_ADDR)_IO_BASE+(p),(b),(n))
   ~^
   In file included from