All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Vorel <petr.vorel@gmail.com>
To: Joerg Vehlow <lkml@jv-coder.de>
Cc: "Yann E. MORIN" <yann.morin.1998@free.fr>,
	Martin Doucha <mdoucha@suse.cz>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	Buildroot Mailing List <buildroot@buildroot.org>,
	Fabrice Fontaine <fontaine.fabrice@gmail.com>,
	ltp@lists.linux.it
Subject: Re: [Buildroot] [LTP] [PATCH 2/2] kvm: Fix undefined reference to __stack_chk_fail()
Date: Mon, 13 Jun 2022 23:31:15 +0200	[thread overview]
Message-ID: <Yqeso3ZYuZZatAfQ@pevik> (raw)
In-Reply-To: <024cf3d9-f9c1-80a4-8b06-799309912c7f@jv-coder.de>

Hi all,

> Hi,


> Am 6/9/2022 um 10:26 AM schrieb Martin Doucha:
> > On 06. 06. 22 20:43, Petr Vorel wrote:
> >> Some x86_64 buildroot toolchains (bootlin-x86-64-glibc,
> >> bootlin-x86-64-musl) try to link to __stack_chk_fail().
> >> -nostdlib is not enough, it requires also -fstack-protector.

> >> x86_64-buildroot-linux-gnu/bin/ld: /tmp/ccgBXEoR.o: in function `handle_page_fault':
> >> kvm_pagefault01.c:(.text+0x5d): undefined reference to `__stack_chk_fail'
> >> collect2: error: ld returned 1 exit status

> >> Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
> >> ---
> >>  testcases/kernel/kvm/Makefile | 2 +-
> >>  1 file changed, 1 insertion(+), 1 deletion(-)

> >> diff --git a/testcases/kernel/kvm/Makefile b/testcases/kernel/kvm/Makefile
> >> index 8d5193d8e..bce1a4eb5 100644
> >> --- a/testcases/kernel/kvm/Makefile
> >> +++ b/testcases/kernel/kvm/Makefile
> >> @@ -9,7 +9,7 @@ ASFLAGS =
> >>  CPPFLAGS += -I$(abs_srcdir)/include
> >>  GUEST_CPPFLAGS = $(CPPFLAGS) -DCOMPILE_PAYLOAD
> >>  GUEST_CFLAGS = -ffreestanding -O2 -Wall -fno-asynchronous-unwind-tables -mno-mmx -mno-sse
> >> -GUEST_LDFLAGS = -nostdlib -Wl,--build-id=none
> >> +GUEST_LDFLAGS = -nostdlib -Wl,--build-id=none -fstack-protector

> > We should use -fno-stack-protector here instead. Your patch probably
> > enables linking of libssp despite -nostdlib which we don't want. The GCC
> > stack protector may also break tests because bootstrap initializes stack
> > manually instead of letting GCC handle it.
> I can confirm, that adding -fno-stack-protector to GUEST_LDFLAGS fixes
> the linker error.

Thanks a lot for your input. Martin, thanks a lot for testing.
I also verified that -fno-stack-protector fix compilation, thus patchset merged.

Kind regards,
Petr

> >>  GUEST_LDLIBS =

> >>  FILTER_OUT_MAKE_TARGETS := lib_guest lib_host lib_x86



> Joerg
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

WARNING: multiple messages have this Message-ID (diff)
From: Petr Vorel <petr.vorel@gmail.com>
To: Joerg Vehlow <lkml@jv-coder.de>
Cc: "Yann E. MORIN" <yann.morin.1998@free.fr>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	Buildroot Mailing List <buildroot@buildroot.org>,
	Fabrice Fontaine <fontaine.fabrice@gmail.com>,
	ltp@lists.linux.it
Subject: Re: [LTP] [PATCH 2/2] kvm: Fix undefined reference to __stack_chk_fail()
Date: Mon, 13 Jun 2022 23:31:15 +0200	[thread overview]
Message-ID: <Yqeso3ZYuZZatAfQ@pevik> (raw)
In-Reply-To: <024cf3d9-f9c1-80a4-8b06-799309912c7f@jv-coder.de>

Hi all,

> Hi,


> Am 6/9/2022 um 10:26 AM schrieb Martin Doucha:
> > On 06. 06. 22 20:43, Petr Vorel wrote:
> >> Some x86_64 buildroot toolchains (bootlin-x86-64-glibc,
> >> bootlin-x86-64-musl) try to link to __stack_chk_fail().
> >> -nostdlib is not enough, it requires also -fstack-protector.

> >> x86_64-buildroot-linux-gnu/bin/ld: /tmp/ccgBXEoR.o: in function `handle_page_fault':
> >> kvm_pagefault01.c:(.text+0x5d): undefined reference to `__stack_chk_fail'
> >> collect2: error: ld returned 1 exit status

> >> Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
> >> ---
> >>  testcases/kernel/kvm/Makefile | 2 +-
> >>  1 file changed, 1 insertion(+), 1 deletion(-)

> >> diff --git a/testcases/kernel/kvm/Makefile b/testcases/kernel/kvm/Makefile
> >> index 8d5193d8e..bce1a4eb5 100644
> >> --- a/testcases/kernel/kvm/Makefile
> >> +++ b/testcases/kernel/kvm/Makefile
> >> @@ -9,7 +9,7 @@ ASFLAGS =
> >>  CPPFLAGS += -I$(abs_srcdir)/include
> >>  GUEST_CPPFLAGS = $(CPPFLAGS) -DCOMPILE_PAYLOAD
> >>  GUEST_CFLAGS = -ffreestanding -O2 -Wall -fno-asynchronous-unwind-tables -mno-mmx -mno-sse
> >> -GUEST_LDFLAGS = -nostdlib -Wl,--build-id=none
> >> +GUEST_LDFLAGS = -nostdlib -Wl,--build-id=none -fstack-protector

> > We should use -fno-stack-protector here instead. Your patch probably
> > enables linking of libssp despite -nostdlib which we don't want. The GCC
> > stack protector may also break tests because bootstrap initializes stack
> > manually instead of letting GCC handle it.
> I can confirm, that adding -fno-stack-protector to GUEST_LDFLAGS fixes
> the linker error.

Thanks a lot for your input. Martin, thanks a lot for testing.
I also verified that -fno-stack-protector fix compilation, thus patchset merged.

Kind regards,
Petr

> >>  GUEST_LDLIBS =

> >>  FILTER_OUT_MAKE_TARGETS := lib_guest lib_host lib_x86



> Joerg

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2022-06-13 21:31 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-06 18:43 [Buildroot] [PATCH 0/2] LTP compilation fixes for buildroot toolchains Petr Vorel
2022-06-06 18:43 ` [LTP] " Petr Vorel
2022-06-06 18:43 ` [Buildroot] [PATCH 1/2] kvm: Fix compilation on x86 Petr Vorel
2022-06-06 18:43   ` [LTP] " Petr Vorel
2022-06-08 14:39   ` Cyril Hrubis
2022-06-06 18:43 ` [Buildroot] [PATCH 2/2] kvm: Fix undefined reference to __stack_chk_fail() Petr Vorel
2022-06-06 18:43   ` [LTP] " Petr Vorel
2022-06-08 14:36   ` Cyril Hrubis
2022-06-09  8:26   ` Martin Doucha
2022-06-09 12:26     ` [Buildroot] " Thomas Petazzoni via buildroot
2022-06-09 12:26       ` [LTP] " Thomas Petazzoni via ltp
2022-06-10  7:56     ` Joerg Vehlow
2022-06-13 21:31       ` Petr Vorel [this message]
2022-06-13 21:31         ` Petr Vorel

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=Yqeso3ZYuZZatAfQ@pevik \
    --to=petr.vorel@gmail.com \
    --cc=buildroot@buildroot.org \
    --cc=fontaine.fabrice@gmail.com \
    --cc=lkml@jv-coder.de \
    --cc=ltp@lists.linux.it \
    --cc=mdoucha@suse.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 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.