Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni via buildroot <buildroot@buildroot.org>
To: Petr Vorel <pevik@seznam.cz>
Cc: Fabrice Fontaine <fontaine.fabrice@gmail.com>,
	"Yann E . MORIN" <yann.morin.1998@free.fr>,
	buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH] package/ltp-testsuite: bump version to 20230516
Date: Sat, 29 Jul 2023 22:40:46 +0200	[thread overview]
Message-ID: <20230729224046.11915c19@windsurf> (raw)
In-Reply-To: <20230521135013.528157-1-pevik@seznam.cz>

On Sun, 21 May 2023 15:50:13 +0200
Petr Vorel <pevik@seznam.cz> wrote:

> From: Petr Vorel <petr.vorel@gmail.com>
> 
> Remove patch accepted in this release.
> 
> Signed-off-by: Petr Vorel <petr.vorel@gmail.com>

I think we can't apply until the above is resolved, as it will affect a
significant number of builds. See below for some hints on what I
believe is going on.

> FYI bootlin-x86-64-glibc fails on new KVM tests. I suspect it's a glibc
> bug, because it works well on all classic distro native gcc/clang
> toolchains (CentOS 7, various Debian and Ubuntu, openSUSE, ...):
> 
> CC testcases/kernel/kvm/lib_x86.o
> kvm_svm01.c: In function ‘guest_main’:
> kvm_svm01.c:42:13: warning: array subscript 0 is outside array bounds of ‘uint32_t[0]’ {aka ‘unsigned int[]’} [-Warray-bounds]
>    42 |         if (*avic_ptr != 0xaaaaaaaa)
>       |             ^~~~~~~~~
> kvm_svm01.c:45:9: warning: array subscript 0 is outside array bounds of ‘uint32_t[0]’ {aka ‘unsigned int[]’} [-Warray-bounds]
>    45 |         *avic_ptr = AVIC_TEST_VAL;
>       |         ^~~~~~~~~
> kvm_svm01.c: In function ‘main’:
> kvm_svm01.c:93:13: warning: array subscript 0 is outside array bounds of ‘uint32_t[0]’ {aka ‘unsigned int[]’} [-Warray-bounds]
>    93 |         if (*avic_ptr != AVIC_TEST_VAL) {
>       |             ^~~~~~~~~
> br-test-pkg/bootlin-x86-64-glibc/host/opt/ext-toolchain/bin/../lib/gcc/x86_64-buildroot-linux-gnu/12.2.0/../../../../x86_64-buildroot-linux-gnu/bin/ld: lib_x86.o: in function `kvm_init_guest_vmcb':
> lib_x86.c:(.text+0x7c3): undefined reference to `__stack_chk_fail'
> collect2: error: ld returned 1 exit status
> make[4]: *** [br-test-pkg/bootlin-x86-64-glibc/build/ltp-testsuite-20230516/testcases/kernel/kvm/Makefile:59: kvm_svm01-payload.o] Error 1
> make[4]: *** Waiting for unfinished jobs....
> br-test-pkg/bootlin-x86-64-glibc/host/opt/ext-toolchain/bin/../lib/gcc/x86_64-buildroot-linux-gnu/12.2.0/../../../../x86_64-buildroot-linux-gnu/bin/ld: lib_x86.o: in function `kvm_init_guest_vmcb':
> lib_x86.c:(.text+0x7c3): undefined reference to `__stack_chk_fail'
> collect2: error: ld returned 1 exit status
> make[4]: *** [br-test-pkg/bootlin-x86-64-glibc/build/ltp-testsuite-20230516/testcases/kernel/kvm/Makefile:59: kvm_pagefault01-payload.o] Error 1
> CC testcases/kernel/kvm/lib_host.o
> make[3]: *** [../../include/mk/generic_trunk_target.inc:108: all] Error 2
> make[2]: *** [../include/mk/generic_trunk_target.inc:108: all] Error 2
> 
> It'd also fail on bootlin-x86-64-musl, but it's being skipped due
> 5e1c238b72.
> 
> Any hint how to workaround this is appreciated.

I don't think it's a glibc bug. The code being built in
testcases/kernel/kvm/ is some bare-metal code. The problem is that it
is being built with Stack Smashing Protection (-fstack-protector),
which requires runtime support from the gcc runtime... but that doesn't
exist for bare-metal code.

What's strange is that testcases/kernel/kvm/Makefile properly accounts
for that and passes -fno-stack-protector:

GUEST_CFLAGS = -ffreestanding -O2 -Wall -fno-asynchronous-unwind-tables -mno-mmx -mno-sse
GUEST_LDFLAGS = -nostdlib -Wl,--build-id=none -fno-stack-protector -z noexecstack

and then these flags are used as the CFLAGS/CPPFLAGS

lib_guest.o $(ARCH_OBJ): CPPFLAGS       := $(GUEST_CPPFLAGS)
lib_guest.o $(ARCH_OBJ): CFLAGS         := $(GUEST_CFLAGS)

Also, the compiler wrapper is passing -fstack-protector if you have one
of the BR2_SSP_* options enabled.

So in order to understand what's going on, could you:

(1) Run the build of ltp-testsuite in verbose mode, so that we get the
    actual compiler/linker command line, with all flags.

(2) Run the build with BR2_DEBUG_WRAPPER=2 to get the details of what
    the wrapper is doing ?

Also, which value are you using for the BR2_SSP_* Buildroot options?

Thanks!

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

      reply	other threads:[~2023-07-29 20:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-21 13:50 [Buildroot] [PATCH] package/ltp-testsuite: bump version to 20230516 Petr Vorel
2023-07-29 20:40 ` Thomas Petazzoni via buildroot [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=20230729224046.11915c19@windsurf \
    --to=buildroot@buildroot.org \
    --cc=fontaine.fabrice@gmail.com \
    --cc=pevik@seznam.cz \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=yann.morin.1998@free.fr \
    /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