All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heiko Carstens <hca@linux.ibm.com>
To: Jan-Benedict Glaw <jbglaw@lug-owl.de>
Cc: linux-s390@vger.kernel.org, Harald Freudenberger <freude@linux.ibm.com>
Subject: Re: debug_defconfig: error: call to '__write_overflow' declared with attribute error: detected write beyond size of object passed as 1st parameter
Date: Tue, 28 Sep 2021 12:43:25 +0200	[thread overview]
Message-ID: <YVLxzffW9a/FAVTt@osiris> (raw)
In-Reply-To: <20210924220235.nw5yicp5z27svvn5@lug-owl.de>

On Sat, Sep 25, 2021 at 12:02:35AM +0200, Jan-Benedict Glaw wrote:
> Hi!
> 
> I'm building a lot of Binutils/GCC targets and with those the Linux
> kernel defconfigs.
> 
> For s390, I started to see a build error when building the
> debug_defconfig:
> 
> [mk all 2021-09-20 04:27:45]   s390x-linux-gnu-gcc -Wp,-MMD,arch/s390/crypto/.paes_s390.o.d -nostdinc -isystem /var/lib/laminar/run/linux-s390-debug_defconfig/8/toolchain/bin/../lib/gcc/s390x-linux-gnu/12.0.0/include -I./arch/s390/include -I./arch/s390/include/generated  -I./include -I./arch/s390/include/uapi -I./arch/s390/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/compiler-version.h -include ./include/linux/kconfig.h -include ./include/linux/compiler_types.h -D__KERNEL__ -fmacro-prefix-map=./= -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Wno-format-security -std=gnu89 -m64 -fPIE -mbackchain -msoft-float -march=zEC12 -mtune=zEC12 -Wa,-I./arch/s390/include -mpacked-stack -D__PACK_STACK -mindirect-branch=thunk -mfunction-return=thunk -mindirect-branch-table -DCC_USING_EXPOLINE -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -DCONFIG_AS_CFI_VAL_OFFSET=1 -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -Wno-address-of-packed-member -O2 -fno-allow-store-data-races -Wframe-larger-than=2048 -fno-stack-protector -Wimplicit-fallthrough=5 -Wno-main -Wno-unused-but-set-variable -Wno-unused-const-variable -ftrivial-auto-var-init=zero -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang -fno-stack-clash-protection -g -gdwarf-4 -pg -mrecord-mcount -mnop-mcount -mfentry -DCC_USING_NOP_MCOUNT -DCC_USING_FENTRY -fno-inline-functions-called-once -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wno-stringop-truncation -Wno-zero-length-bounds -Wno-array-bounds -Wno-stringop-overflow -Wno-restrict -Wno-maybe-uninitialized -fno-strict-overflow -fno-stack-check -fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -Wno-packed-not-aligned  -DMODULE -fPIC  -DKBUILD_BASENAME='"paes_s390"' -DKBUILD_MODNAME='"paes_s390"' -D__KBUILD_MODNAME=kmod_paes_s390 -c -o arch/s390/crypto/paes_s390.o arch/s390/crypto/paes_s390.c
> [mk all 2021-09-20 04:27:47] In file included from ./include/linux/string.h:262,
> [mk all 2021-09-20 04:27:47]                  from ./include/linux/bitmap.h:10,
> [mk all 2021-09-20 04:27:47]                  from ./include/linux/cpumask.h:12,
> [mk all 2021-09-20 04:27:47]                  from ./include/linux/smp.h:13,
> [mk all 2021-09-20 04:27:47]                  from ./include/linux/lockdep.h:14,
> [mk all 2021-09-20 04:27:47]                  from ./include/linux/spinlock.h:63,
> [mk all 2021-09-20 04:27:47]                  from ./include/linux/mmzone.h:8,
> [mk all 2021-09-20 04:27:47]                  from ./include/linux/gfp.h:6,
> [mk all 2021-09-20 04:27:47]                  from ./include/linux/slab.h:15,
> [mk all 2021-09-20 04:27:47]                  from ./include/linux/crypto.h:20,
> [mk all 2021-09-20 04:27:47]                  from ./include/crypto/aes.h:10,
> [mk all 2021-09-20 04:27:47]                  from arch/s390/crypto/paes_s390.c:16:
> [mk all 2021-09-20 04:27:47] In function 'memcpy',
> [mk all 2021-09-20 04:27:47]     inlined from '__paes_convert_key.part.0' at arch/s390/crypto/paes_s390.c:153:2:
> [mk all 2021-09-20 04:27:47] ./include/linux/fortify-string.h:185:25: error: call to '__write_overflow' declared with attribute error: detected write beyond size of object passed as 1st parameter
> [mk all 2021-09-20 04:27:47]   185 |                         __write_overflow();
> [mk all 2021-09-20 04:27:47]       |                         ^~~~~~~~~~~~~~~~~~
> [mk all 2021-09-20 04:27:47] make[2]: *** [scripts/Makefile.build:277: arch/s390/crypto/paes_s390.o] Error 1
> [mk all 2021-09-20 04:27:47] make[1]: *** [scripts/Makefile.build:540: arch/s390/crypto] Error 2
> [mk all 2021-09-20 04:27:47] make: *** [Makefile:1868: arch/s390] Error 2
> 
> 
> On a first glimpse, I don't see how this overflows. Is it a compiler
> bug? Used GCC is "s390x-linux-gnu-gcc (GCC) 12.0.0 20210917
> (experimental)", while an older build for debug_defconfig (using an
> older GCC, probably ce3316e9c02c81c509173572c71a101f4eb62a24 as of Thu
> Jun 24 13:49:51 2021 -0400) succeeded.
> 
>   OTOH, I might have failed to pinpoint the actual bug and the newer GCC
> correctly caught it?

This _looks_ like a compiler bug. Disassembling the function plus
using pahole told me that everything should be ok. However I used
gcc-11 instead of experimental gcc-12.

Adding Harald, just in case I missed something.

      reply	other threads:[~2021-09-28 10:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-24 22:02 debug_defconfig: error: call to '__write_overflow' declared with attribute error: detected write beyond size of object passed as 1st parameter Jan-Benedict Glaw
2021-09-28 10:43 ` Heiko Carstens [this message]

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=YVLxzffW9a/FAVTt@osiris \
    --to=hca@linux.ibm.com \
    --cc=freude@linux.ibm.com \
    --cc=jbglaw@lug-owl.de \
    --cc=linux-s390@vger.kernel.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.