Message ID | 20230623125416.481755-3-thuth@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Rework LDFLAGS and link with noexecstack | expand |
On Fri, Jun 23, 2023, Thomas Huth wrote: > Newer versions of ld (from binutils 2.40) complain on s390x and x86: > > ld: warning: s390x/cpu.o: missing .note.GNU-stack section implies > executable stack > ld: NOTE: This behaviour is deprecated and will be removed in a > future version of the linker > > We can silence these warnings by using "-z noexecstack" for linking > (which should not have any real influence on the kvm-unit-tests since > the information from the ELF header is not used here anyway, so it's > just cosmetics). > > Signed-off-by: Thomas Huth <thuth@redhat.com> > --- > Makefile | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/Makefile b/Makefile > index 0e5d85a1..20f7137c 100644 > --- a/Makefile > +++ b/Makefile > @@ -96,7 +96,7 @@ CFLAGS += -Woverride-init -Wmissing-prototypes -Wstrict-prototypes > > autodepend-flags = -MMD -MF $(dir $*).$(notdir $*).d > > -LDFLAGS += -nostdlib > +LDFLAGS += -nostdlib -z noexecstack Drat, the pull request[1] I sent to Paolo yesterday only fixes x86[2]. Paolo, want me to redo the pull request to drop the x86-specific patch? [1] https://lore.kernel.org/all/20230622211440.2595272-1-seanjc@google.com [2] https://lore.kernel.org/all/20230406220839.835163-1-seanjc@google.com
On 23/06/2023 16.24, Sean Christopherson wrote: > On Fri, Jun 23, 2023, Thomas Huth wrote: >> Newer versions of ld (from binutils 2.40) complain on s390x and x86: >> >> ld: warning: s390x/cpu.o: missing .note.GNU-stack section implies >> executable stack >> ld: NOTE: This behaviour is deprecated and will be removed in a >> future version of the linker >> >> We can silence these warnings by using "-z noexecstack" for linking >> (which should not have any real influence on the kvm-unit-tests since >> the information from the ELF header is not used here anyway, so it's >> just cosmetics). >> >> Signed-off-by: Thomas Huth <thuth@redhat.com> >> --- >> Makefile | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/Makefile b/Makefile >> index 0e5d85a1..20f7137c 100644 >> --- a/Makefile >> +++ b/Makefile >> @@ -96,7 +96,7 @@ CFLAGS += -Woverride-init -Wmissing-prototypes -Wstrict-prototypes >> >> autodepend-flags = -MMD -MF $(dir $*).$(notdir $*).d >> >> -LDFLAGS += -nostdlib >> +LDFLAGS += -nostdlib -z noexecstack > > Drat, the pull request[1] I sent to Paolo yesterday only fixes x86[2]. Oops, sorry, I did not notice that patch in my overcrowded mailboxes (or forgot about it during KVM forum...) :-/ > Paolo, want me to redo the pull request to drop the x86-specific patch? I can also respin my patch on top of your series later ... the problem currently also only seems to happen on x86 and s390x, on ppc64 and aarch64, the linker does not complain ... so maybe it's even better to do it per-architecture only anyway? Opinions? Thomas
On Fri, Jun 23, 2023, Thomas Huth wrote: > On 23/06/2023 16.24, Sean Christopherson wrote: > > On Fri, Jun 23, 2023, Thomas Huth wrote: > > > Newer versions of ld (from binutils 2.40) complain on s390x and x86: > > > > > > ld: warning: s390x/cpu.o: missing .note.GNU-stack section implies > > > executable stack > > > ld: NOTE: This behaviour is deprecated and will be removed in a > > > future version of the linker > > > > > > We can silence these warnings by using "-z noexecstack" for linking > > > (which should not have any real influence on the kvm-unit-tests since > > > the information from the ELF header is not used here anyway, so it's > > > just cosmetics). > > > > > > Signed-off-by: Thomas Huth <thuth@redhat.com> > > > --- > > > Makefile | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/Makefile b/Makefile > > > index 0e5d85a1..20f7137c 100644 > > > --- a/Makefile > > > +++ b/Makefile > > > @@ -96,7 +96,7 @@ CFLAGS += -Woverride-init -Wmissing-prototypes -Wstrict-prototypes > > > autodepend-flags = -MMD -MF $(dir $*).$(notdir $*).d > > > -LDFLAGS += -nostdlib > > > +LDFLAGS += -nostdlib -z noexecstack > > > > Drat, the pull request[1] I sent to Paolo yesterday only fixes x86[2]. > > Oops, sorry, I did not notice that patch in my overcrowded mailboxes (or > forgot about it during KVM forum...) :-/ Heh, you gave a Reviewed-by[*], so either its the latter, or you've got a clone running around :-) [*] https://lore.kernel.org/all/916aac4f-97b8-70c2-de39-87438eb4aea4@redhat.com > > Paolo, want me to redo the pull request to drop the x86-specific patch? > > I can also respin my patch on top of your series later ... the problem > currently also only seems to happen on x86 and s390x, on ppc64 and aarch64, > the linker does not complain ... so maybe it's even better to do it > per-architecture only anyway? Opinions? I don't think it makes sense to do this per-arch, other architectures likely aren't problematic purely because of linker specific behavior, e.g. see https://patches.linaro.org/project/binutils/patch/1506025575-1559-1-git-send-email-jim.wilson@linaro.org
On 27/06/2023 00.34, Sean Christopherson wrote: > On Fri, Jun 23, 2023, Thomas Huth wrote: >> On 23/06/2023 16.24, Sean Christopherson wrote: >>> On Fri, Jun 23, 2023, Thomas Huth wrote: >>>> Newer versions of ld (from binutils 2.40) complain on s390x and x86: >>>> >>>> ld: warning: s390x/cpu.o: missing .note.GNU-stack section implies >>>> executable stack >>>> ld: NOTE: This behaviour is deprecated and will be removed in a >>>> future version of the linker >>>> >>>> We can silence these warnings by using "-z noexecstack" for linking >>>> (which should not have any real influence on the kvm-unit-tests since >>>> the information from the ELF header is not used here anyway, so it's >>>> just cosmetics). >>>> >>>> Signed-off-by: Thomas Huth <thuth@redhat.com> >>>> --- >>>> Makefile | 2 +- >>>> 1 file changed, 1 insertion(+), 1 deletion(-) >>>> >>>> diff --git a/Makefile b/Makefile >>>> index 0e5d85a1..20f7137c 100644 >>>> --- a/Makefile >>>> +++ b/Makefile >>>> @@ -96,7 +96,7 @@ CFLAGS += -Woverride-init -Wmissing-prototypes -Wstrict-prototypes >>>> autodepend-flags = -MMD -MF $(dir $*).$(notdir $*).d >>>> -LDFLAGS += -nostdlib >>>> +LDFLAGS += -nostdlib -z noexecstack >>> >>> Drat, the pull request[1] I sent to Paolo yesterday only fixes x86[2]. ... >>> Paolo, want me to redo the pull request to drop the x86-specific patch? >> >> I can also respin my patch on top of your series later ... the problem >> currently also only seems to happen on x86 and s390x, on ppc64 and aarch64, >> the linker does not complain ... so maybe it's even better to do it >> per-architecture only anyway? Opinions? > > I don't think it makes sense to do this per-arch, other architectures likely aren't > problematic purely because of linker specific behavior, e.g. see > > https://patches.linaro.org/project/binutils/patch/1506025575-1559-1-git-send-email-jim.wilson@linaro.org Ok, I've pushed now my patches since other people were running into this issue, too (see https://lore.kernel.org/kvm/20230809091717.1549-1-nrb@linux.ibm.com/ ). Sean, could you please rebase your series now? Thanks, Thomas
diff --git a/Makefile b/Makefile index 0e5d85a1..20f7137c 100644 --- a/Makefile +++ b/Makefile @@ -96,7 +96,7 @@ CFLAGS += -Woverride-init -Wmissing-prototypes -Wstrict-prototypes autodepend-flags = -MMD -MF $(dir $*).$(notdir $*).d -LDFLAGS += -nostdlib +LDFLAGS += -nostdlib -z noexecstack $(libcflat): $(cflatobjs) $(AR) rcs $@ $^
Newer versions of ld (from binutils 2.40) complain on s390x and x86: ld: warning: s390x/cpu.o: missing .note.GNU-stack section implies executable stack ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker We can silence these warnings by using "-z noexecstack" for linking (which should not have any real influence on the kvm-unit-tests since the information from the ELF header is not used here anyway, so it's just cosmetics). Signed-off-by: Thomas Huth <thuth@redhat.com> --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)