All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: Fabio Aiuto <fabioaiuto83@gmail.com>
Cc: devel@driverdev.osuosl.org, clang-built-linux@googlegroups.com,
	kbuild-all@lists.01.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: 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'
Date: Fri, 21 May 2021 12:19:39 -0700	[thread overview]
Message-ID: <YKgHy7ZNNxv/KMl8@archlinux-ax161> (raw)
In-Reply-To: <20210521142656.GA1409@agape.jhs>

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
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

WARNING: multiple messages have this Message-ID (diff)
From: Nathan Chancellor <nathan@kernel.org>
To: kbuild-all@lists.01.org
Subject: 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'
Date: Fri, 21 May 2021 12:19:39 -0700	[thread overview]
Message-ID: <YKgHy7ZNNxv/KMl8@archlinux-ax161> (raw)
In-Reply-To: <20210521142656.GA1409@agape.jhs>

[-- Attachment #1: Type: text/plain, Size: 4258 bytes --]

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

  reply	other threads:[~2021-05-21 19:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-20  9:03 [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' kernel test robot
2021-05-20  9:03 ` kernel test robot
2021-05-21 14:26 ` Fabio Aiuto
2021-05-21 14:26   ` Fabio Aiuto
2021-05-21 19:19   ` Nathan Chancellor [this message]
2021-05-21 19:19     ` Nathan Chancellor
2021-05-22  7:48     ` Fabio Aiuto
2021-05-22  7:48       ` Fabio Aiuto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YKgHy7ZNNxv/KMl8@archlinux-ax161 \
    --to=nathan@kernel.org \
    --cc=clang-built-linux@googlegroups.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=fabioaiuto83@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kbuild-all@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.