From: Kees Cook <keescook@chromium.org>
To: kernel test robot <lkp@intel.com>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
Linux Memory Management List <linux-mm@kvack.org>,
"Gustavo A. R. Silva" <gustavoars@kernel.org>
Subject: Re: [linux-next:master 3357/8413] drivers/scsi/FlashPoint.c:1712:12: warning: stack frame size (1056) exceeds limit (1024) in 'FlashPoint_HandleInterrupt'
Date: Tue, 13 Jun 2023 14:22:26 -0700 [thread overview]
Message-ID: <202306131418.35B5D649DC@keescook> (raw)
In-Reply-To: <202306100035.VTusNhm4-lkp@intel.com>
On Sat, Jun 10, 2023 at 12:58:23AM +0800, kernel test robot wrote:
> First bad commit (maybe != root cause):
>
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> head: 53ab6975c12d1ad86c599a8927e8c698b144d669
> commit: df8fc4e934c12b906d08050d7779f292b9c5c6b5 [3357/8413] kbuild: Enable -fstrict-flex-arrays=3
> config: powerpc-allmodconfig (https://download.01.org/0day-ci/archive/20230610/202306100035.VTusNhm4-lkp@intel.com/config)
> compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project.git 4a5ac14ee968ff0ad5d2cc1ffa0299048db4c88a)
> reproduce (this is a W=1 build):
> mkdir -p ~/bin
> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # install powerpc cross compiling tool for clang build
> # apt-get install binutils-powerpc-linux-gnu
> # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=df8fc4e934c12b906d08050d7779f292b9c5c6b5
> git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
> git fetch --no-tags linux-next master
> git checkout df8fc4e934c12b906d08050d7779f292b9c5c6b5
> # save the config file
> mkdir build_dir && cp config build_dir/.config
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang ~/bin/make.cross W=1 O=build_dir ARCH=powerpc olddefconfig
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang ~/bin/make.cross W=1 O=build_dir ARCH=powerpc SHELL=/bin/bash drivers/
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202306100035.VTusNhm4-lkp@intel.com/
>
> All warnings (new ones prefixed by >>):
>
> In file included from drivers/scsi/BusLogic.c:51:
> >> drivers/scsi/FlashPoint.c:1712:12: warning: stack frame size (1056) exceeds limit (1024) in 'FlashPoint_HandleInterrupt' [-Wframe-larger-than]
> 1712 | static int FlashPoint_HandleInterrupt(void *pcard)
> | ^
> 1 warning generated.
I wasn't able to generate the warning with my Clang, but it sure is
close! Building with KCFLAGS=-Rpass-analysis=stack-frame-layout I see:
In file included from ../drivers/scsi/BusLogic.c:51:
../drivers/scsi/FlashPoint.c:1713:1: remark:
Function: FlashPoint_HandleInterrupt
Offset: [SP-4], Type: Protector, Align: 4, Size: 4
Offset: [SP-8], Type: Spill, Align: 8, Size: 4
Offset: [SP-12], Type: Spill, Align: 4, Size: 4
Offset: [SP-16], Type: Spill, Align: 16, Size: 4
Offset: [SP-20], Type: Spill, Align: 4, Size: 4
Offset: [SP-24], Type: Spill, Align: 8, Size: 4
Offset: [SP-28], Type: Spill, Align: 4, Size: 4
Offset: [SP-32], Type: Spill, Align: 16, Size: 4
Offset: [SP-36], Type: Spill, Align: 4, Size: 4
Offset: [SP-40], Type: Spill, Align: 8, Size: 4
Offset: [SP-44], Type: Spill, Align: 4, Size: 4
Offset: [SP-48], Type: Spill, Align: 16, Size: 4
Offset: [SP-52], Type: Spill, Align: 4, Size: 4
Offset: [SP-56], Type: Spill, Align: 8, Size: 4
Offset: [SP-60], Type: Spill, Align: 4, Size: 4
Offset: [SP-64], Type: Spill, Align: 16, Size: 4
Offset: [SP-68], Type: Spill, Align: 4, Size: 4
Offset: [SP-72], Type: Spill, Align: 8, Size: 4
Offset: [SP-76], Type: Variable, Align: 4, Size: 4
Offset: [SP-80], Type: Spill, Align: 4, Size: 4
Offset: [SP-84], Type: Spill, Align: 4, Size: 4
...[4 byte spills]...
Offset: [SP-1012], Type: Variable, Align: 4, Size: 4
Offset: [SP-1016], Type: Variable, Align: 4, Size: 4
[-Rpass-analysis=stack-frame-layout]
So something is very weird in FlashPoint_HandleInterrupt -- it has a
single while loop with an internal if/else if/.../else chain. So I don't
see why it would need such extensive spills...
This seems like a missed optimization in Clang, maybe?
--
Kees Cook
next prev parent reply other threads:[~2023-06-13 21:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-09 16:58 kernel test robot
2023-06-13 21:22 ` Kees Cook [this message]
2023-06-14 20:27 ` Nick Desaulniers
2023-06-14 22:58 ` Kees Cook
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=202306131418.35B5D649DC@keescook \
--to=keescook@chromium.org \
--cc=gustavoars@kernel.org \
--cc=linux-mm@kvack.org \
--cc=lkp@intel.com \
--cc=llvm@lists.linux.dev \
--cc=oe-kbuild-all@lists.linux.dev \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox