[Buildroot] [PATCH] package/ltp-testsuite: bump version to 20230516
Thomas Petazzoni
thomas.petazzoni at bootlin.com
Sat Jul 29 20:40:46 UTC 2023
On Sun, 21 May 2023 15:50:13 +0200
Petr Vorel <pevik at seznam.cz> wrote:
> From: Petr Vorel <petr.vorel at gmail.com>
>
> Remove patch accepted in this release.
>
> Signed-off-by: Petr Vorel <petr.vorel at 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
More information about the buildroot
mailing list