x86/tools/relocs: Add _etext and __end_of_kernel_reserve to S_REL
Subsystems (3)
PATCH 1/1 x86/tools/relocs: Add _etext and __end_of_kernel_reserve to S_REL
Pre-2.23 binutils makes symbols defined outside sections absolute, so these two symbols break the build on old linkers.
--- arch/x86/tools/relocs.c | 2 ++ 1 file changed, 2 insertions(+)
arch/x86/tools/relocs.c +2 -0
@@ -78,6 +78,8 @@ static const char * const sym_regex_kernel[S_NSYMTYPES] = {"__end_rodata_hpage_align|" #endif"__vvar_page|" +"_etext|" +"__end_of_kernel_reserve|" "_end)$" };
Signature · 1 line
2.24.1
Borislav Petkov
maintainerQuoted 2 lines · Arvind Sankar
Pre-2.23 binutils makes symbols defined outside sections absolute, so these two symbols break the build on old linkers.
-ENOTENOUGHINFO
Which old linkers, how exactly do they break the build, etc etc?
Please give exact reproduction steps.
Thx.
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteQuoted 4 lines · Borislav Petkov
Quoted 2 lines · Arvind Sankar
Pre-2.23 binutils makes symbols defined outside sections absolute, so these two symbols break the build on old linkers.
Quoted 8 lines
-ENOTENOUGHINFOWhich old linkers, how exactly do they break the build, etc etc?
Please give exact reproduction steps.
Thx.
binutils-2.21 and -2.22. An x86-64 defconfig will fail with
Invalid absolute R_X86_64_32S relocation: _etext
and after fixing that one, with
Invalid absolute R_X86_64_32S relocation: __end_of_kernel_reserve
Similar errors with 32-bit defconfig.
Should I resend with that added to the commit message?
PATCH v2 1/1 x86/tools/relocs: Add _etext and __end_of_kernel_reserve to S_REL
Prior to binutiles-2.23, ld treats the location counter as absolute if used outside an output section definition. From version 2.23 onwards, the location counter is treated as relative to an adjacent output section (usually the previous one, unless there isn't one or the location counter has been assigned to previously, in which case the next one).
The result is that a symbol definition in the linker script, such as
_etext = .;
that appears outside an output section definition makes _etext an absolute symbol prior to binutils-2.23 and a relative symbol from version 2.23 onwards. So when using a 2.21 or 2.22 vintage linker, the build fails with
Invalid absolute R_X86_64_32S relocation: _etext
for x86-64, and a similar message with R_386_32 for x86-32.
Fix this by adding these symbols to S_REL to tell the relocs tool that these should always be treated as relative symbols needing relocation.
---
v2: Added a more detailed commit message
arch/x86/tools/relocs.c | 2 ++ 1 file changed, 2 insertions(+)
arch/x86/tools/relocs.c +2 -0
@@ -78,6 +78,8 @@ static const char * const sym_regex_kernel[S_NSYMTYPES] = {"__end_rodata_hpage_align|" #endif"__vvar_page|" +"_etext|" +"__end_of_kernel_reserve|" "_end)$" };
Signature · 1 line
2.24.1
Quoted 1 line · Arvind Sankar
Prior to binutiles-2.23, ld treats the location counter as absolute if
^ Please fix this typo before merging (thanks)
Borislav Petkov
maintainerQuoted 11 lines · Arvind Sankar
Quoted 10 lines · Borislav Petkov
Quoted 2 lines · Arvind Sankar
Pre-2.23 binutils makes symbols defined outside sections absolute, so these two symbols break the build on old linkers.
-ENOTENOUGHINFOWhich old linkers, how exactly do they break the build, etc etc?
Please give exact reproduction steps.
Quoted 7 lines
Quoted 2 lines
Thx.
binutils-2.21 and -2.22. An x86-64 defconfig will fail with
Invalid absoluteR_X86_64_32Srelocation:_etext
and after fixing that one, with
Invalid absoluteR_X86_64_32Srelocation:__end_of_kernel_reserve
I'm still not clear as to why this happens. I tried reproducing on openSUSE 12.1 which has
Repository: openSUSE-12.1-Oss
Name: binutils
Version: 2.21.1-12.1.4
and the build there fails with:
objdump: arch/x86/lib/clear_page_64.o: File format not recognized
objdump: arch/x86/lib/cmdline.o: File format not recognized
objdump: arch/x86/lib/cmpxchg16b_emu.o: File format not recognized
objdump: arch/x86/lib/copy_page_64.o: File format not recognized
objdump: arch/x86/lib/copy_user_64.o: File format not recognized
objdump: arch/x86/lib/cpu.o: File format not recognized
...
and objdump is part of binutils.
Now, this looks like another symptom of what you're reporting but what we're missing is the rootcause about *why* this happens.
Because if the issue is hard to fix or similar, then we probably should raise the minimum supported binutils version from 2.21 to something newer and not do this fix.
But before we do that, we need a proper analysis as to why it happens.
Also, what distro are you using to reproduce it on?
Thx.
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteQuoted 46 lines · Borislav Petkov
Quoted 11 lines · Arvind Sankar
Quoted 10 lines · Borislav Petkov
Quoted 2 lines · Arvind Sankar
Pre-2.23 binutils makes symbols defined outside sections absolute, so these two symbols break the build on old linkers.
-ENOTENOUGHINFOWhich old linkers, how exactly do they break the build, etc etc?
Please give exact reproduction steps.
Quoted 7 lines
Quoted 2 lines
Thx.
binutils-2.21 and -2.22. An x86-64 defconfig will fail with
Invalid absoluteR_X86_64_32Srelocation:_etext
and after fixing that one, with
Invalid absoluteR_X86_64_32Srelocation:__end_of_kernel_reserveI'm still not clear as to why this happens. I tried reproducing on openSUSE 12.1 which has
Repository: openSUSE-12.1-Oss
Name: binutils
Version: 2.21.1-12.1.4and the build there fails with:
objdump:
arch/x86/lib/clear_page_64.o: File format not recognized
objdump:arch/x86/lib/cmdline.o: File format not recognized
objdump:arch/x86/lib/cmpxchg16b_emu.o: File format not recognized
objdump:arch/x86/lib/copy_page_64.o: File format not recognized
objdump:arch/x86/lib/copy_user_64.o: File format not recognized
objdump:arch/x86/lib/cpu.o: File format not recognized
...and objdump is part of binutils.
Now, this looks like another symptom of what you're reporting but what we're missing is the rootcause about *why* this happens.
Because if the issue is hard to fix or similar, then we probably should raise the minimum supported binutils version from 2.21 to something newer and not do this fix.
Quoted 6 lines
But before we do that, we need a proper analysis as to why it happens.
Also, what distro are you using to reproduce it on?
Thx.
I'm not sure if that's the same issue. The root cause for the one I reported is described in more detail in [1], and the change that makes these symbols no longer absolute is commit d2667025dd30 in binutils-gdb (sourceware.org seems to be taking too long to respond from here so I don't have the web link).
I'm running gentoo, but building the kernel using binutils-2.21.1 compiled from the GNU source tarball, and gcc-4.6.4 again compiled from source. (It's not something I normally need but I was investigating something else to see what exactly happens with older toolchains.)
I used the below to compile the kernel (I added in readelf/objdump/objcopy just now, and it does build until the relocs error). The config is x86-64 defconfig with CONFIG_RETPOLINE overridden to n (since gcc 4.6.4 doesn't support retpoline).
make O=~/kernel64 -j LD=~/old/bin/ld AS=~/old/bin/as READELF=~/old/bin/readelf \
OBJDUMP=~/old/bin/objdump OBJCOPY=~/old/bin/objcopy GCC=~/old/bin/gcc
Quoted 5 lines · Arvind Sankar
I'm running gentoo, but building the kernel using binutils-2.21.1 compiled from the GNU source tarball, and gcc-4.6.4 again compiled from source. (It's not something I normally need but I was investigating something else to see what exactly happens with older toolchains.)
Quoted 7 lines
I used the below to compile the kernel (I added in readelf/objdump/objcopy just now, and it does build until the relocs error). The config is x86-64 defconfig with
CONFIG_RETPOLINEoverridden to n (since gcc 4.6.4 doesn't support retpoline).make O=~/kernel64 -j LD=~/old/bin/ld AS=~/old/bin/as READELF=~/old/bin/readelf \
OBJDUMP=~/old/bin/objdump OBJCOPY=~/old/bin/objcopy GCC=~/old/bin/gcc
^^ that should be CC
Quoted 1 line
The built kernel (with this patch) does boot till userspace on qemu, so these old versions aren't producing a completely broken kernel.
Borislav Petkov
maintainerQuoted 5 lines · Arvind Sankar
I'm not sure if that's the same issue. The root cause for the one I reported is described in more detail in [1], and the change that makes these symbols no longer absolute is commit
d2667025dd30in binutils-gdb (sourceware.org seems to be taking too long to respond from here so I don't have the web link).
My binutils guy says that the proper fix should be to make those two symbols section-relative, i.e., move _etext at the end of the .text section and so on.
Please check whether this fixes the build issue too because if it does, it would be The RightThing(tm).
Quoted 5 lines
I'm running gentoo, but building the kernel using binutils-2.21.1 compiled from the GNU source tarball, and gcc-4.6.4 again compiled from source. (It's not something I normally need but I was investigating something else to see what exactly happens with older toolchains.)
Quoted 7 lines
I used the below to compile the kernel (I added in readelf/objdump/objcopy just now, and it does build until the relocs error). The config is x86-64 defconfig with
CONFIG_RETPOLINEoverridden to n (since gcc 4.6.4 doesn't support retpoline).make O=~/kernel64 -j LD=~/old/bin/ld AS=~/old/bin/as READELF=~/old/bin/readelf \
OBJDUMP=~/old/bin/objdump OBJCOPY=~/old/bin/objcopy GCC=~/old/bin/gcc
Make this all part of your commit message because it explains in detail how exactly you've triggered it so that anyone else reading this can reproduce her/himself.
Thx.
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteQuoted 7 lines · Borislav Petkov
Quoted 5 lines · Arvind Sankar
I'm not sure if that's the same issue. The root cause for the one I reported is described in more detail in [1], and the change that makes these symbols no longer absolute is commit
d2667025dd30in binutils-gdb (sourceware.org seems to be taking too long to respond from here so I don't have the web link).
Quoted 6 lines
My binutils guy says that the proper fix should be to make those two symbols section-relative, i.e., move
_etextat the end of the .text section and so on.Please check whether this fixes the build issue too because if it does, it would be The RightThing(tm).
According to Kees in [1] commit 392bef709659 ("x86/build: Move _etext to actual end of .text"), keeping _etext inside the .text section was incorrect in some situations with clang. That commit was later reverted because it broke old toolchains, and the new commit that did the same thing commit b907693883fd ("x86/vmlinux: Actually use _etext for the end of the text segment") does not mention that rationale.
Kees, is it still required to keep _etext out of .text, or can it be moved back in? If it has to remain outside,
_etext = _stext + SIZEOF(.text);
seems to leave _etext as a relative symbol, even though from the binutils documentation I'd have expected SIZEOF(.text), as a number, to be treated as an absolute expression outside an output section. Could you check if that would work for your case?
The __end_of_kernel_reserve can be made relative by just assigning it __bss_stop instead of the location counter.
I will note that the purpose of S_REL in relocs.c was originally to handle exactly this case of symbols defined outside output sections:
/*
* These symbols are known to be relative, even if the linker marks them
* as absolute (typically defined outside any section in the linker script.) */
[S_REL] =
Quoted 11 lines
Quoted 11 lines
I'm running gentoo, but building the kernel using binutils-2.21.1 compiled from the GNU source tarball, and gcc-4.6.4 again compiled from source. (It's not something I normally need but I was investigating something else to see what exactly happens with older toolchains.)
I used the below to compile the kernel (I added in readelf/objdump/objcopy just now, and it does build until the relocs error). The config is x86-64 defconfig with
CONFIG_RETPOLINEoverridden to n (since gcc 4.6.4 doesn't support retpoline).
Quoted 6 lines
Quoted 2 lines
make O=~/kernel64 -j LD=~/old/bin/ld AS=~/old/bin/as READELF=~/old/bin/readelf \
OBJDUMP=~/old/bin/objdump OBJCOPY=~/old/bin/objcopy GCC=~/old/bin/gccMake this all part of your commit message because it explains in detail how exactly you've triggered it so that anyone else reading this can reproduce her/himself.
How to reproduce is just "build with old binutils". I don't see it's reasonable to include a tutorial on how to build the kernel with a toolchain that's not installed in the default PATH, as part of the commit message.
Quoted 8 lines
Thx.
Signature · 4 lines
Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette
[1] x86/build: Move _etext to actual end of .text
When building x86 with Clang LTO and CFI, CFI jump regions are automatically added to the end of the .text section late in linking. As a result, the _etext position was being labelled before the appended jump regions, causing confusion about where the boundaries of the executable region actually are in the running kernel, and broke at least the fault injection code. This moves the _etext mark to outside (and immediately after) the .text area, as it already the case on other architectures (e.g. arm64, arm).
Borislav Petkov
maintainerQuoted 2 lines · Arvind Sankar
I will note that the purpose of
S_RELinrelocs.cwas originally to handle exactly this case of symbols defined outside output sections:
And we should try not to do hacks, if it can be fixed properly, as binutils expects symbols to be usually relative to a section.
Quoted 4 lines
How to reproduce is just "build with old binutils". I don't see it's reasonable to include a tutorial on how to build the kernel with a toolchain that's not installed in the default PATH, as part of the commit message.
The point is that it should be clear that it should state whether it is something you trigger with some stock distro which has been shipping this way or it is something you've customly created. Huge difference.
So pls make sure that is clear from the commit message.
Thx.
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteQuoted 6 lines · Borislav Petkov
Quoted 4 lines · Arvind Sankar
How to reproduce is just "build with old binutils". I don't see it's reasonable to include a tutorial on how to build the kernel with a toolchain that's not installed in the default PATH, as part of the commit message.
Quoted 6 lines
The point is that it should be clear that it should state whether it is something you trigger with some stock distro which has been shipping this way or it is something you've customly created. Huge difference.
So pls make sure that is clear from the commit message.
How is "breaks with binutils before version 2.23" not clear enough? It will break regardless of whether distro shipped v2.21 or you built v2.21. I'm _not_ creating a custom binutils with my own patches specifically to trigger this issue, it's stock binutils, as stock as you can get it.
Do you really want me to say in the commit message "to reproduce, first compile binutils-2.21 from source, then try to build the kernel with it"? Including this information would make sense only if the problem wasn't with stock binutils, but only with some specific distro's patched version. _Then_ it would make sense to say something like "binutils package v-xxx shipped with OpenSUSE v-yyy was broken, this commit works around it". This is a problem with _any_ binutils-2.21, there's nothing special about how you need to build it.
Borislav Petkov
maintainerQuoted 1 line · Arvind Sankar
How is "breaks with binutils before version 2.23" not clear enough? It
Nevermind, I'll write it myself if/when I end up applying some version of it. I've wasted enough time trying to get my point across.
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteQuoted 6 lines · Borislav Petkov
Quoted 1 line · Arvind Sankar
How is "breaks with binutils before version 2.23" not clear enough? It
Nevermind, I'll write it myself if/when I end up applying some version of it. I've wasted enough time trying to get my point across.
You're wasting time, because you're not _listening_ to the other guy. There is nothing special about how to repro this bug. It can be repro'd by building binutils-2.21.1 from source, it can be repro'd by building with a distro that packaged 2.21 -- such as OpenSUSE 12.1 [1], it can be repro'd by Mauro doing an Android build [2].
The common thread in all that, is that the kernel is being built with a binutils prior to version 2.23, which is what is noted in the commit log as it stands.
[1] https://lore.kernel.org/lkml/[email protected]/
[2] https://lore.kernel.org/lkml/CAEQFVGbWKf2ksMrMmtymewArSF=ztNgeuieEQ3wvKrX1r759Aw@mail.gmail.com/
Borislav Petkov
maintainerQuoted 9 lines · Arvind Sankar
Quoted 6 lines · Borislav Petkov
Quoted 1 line · Arvind Sankar
How is "breaks with binutils before version 2.23" not clear enough? It
Nevermind, I'll write it myself if/when I end up applying some version of it. I've wasted enough time trying to get my point across.
You're wasting time, because you're not _listening_ to the other guy.
FFS you're still missing the point: the question is whether this is a widespread issue - a distro shipping this funky binutils and therefore it being a problem on potentially more than one environment - or something people can only trigger by *specially* building themselves and thus a lot more seldom occurrence.
And I've answered the question myself by booting openSUSE 12.1 - i.e., at least one distro has it.
And regardless, so what if you add some more text to the commit message? Are you afraid that you'll over-describe the issue? Hell, you've typed more just in debating this.
And let me tell you why it is a good thing to have more detailed explanations in commit messages: when you move on and go do something else, all that is left is a commit message for maintainers to do git archaeology on and scratch heads as to why stuff was done the way it was.
And this happens very often: read a oneliner commit message and go find a crystal ball to figure out what the author meant.
And I told you that *I* will write it myself and you wouldn't have to do diddly squat. And yet you still can't let it go!
So you can debate all you want - you won't change my mind about wanting to have stuff explained in detail in commit messages.
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteQuoted 9 lines · Borislav Petkov
FFS you're still missing the point: the question is whether this is a widespread issue - a distro shipping this funky binutils and therefore it being a problem on potentially more than one environment - or something people can only trigger by *specially* building themselves and thus a lot more seldom occurrence.
And I've answered the question myself by booting openSUSE 12.1 - i.e., at least one distro has it.
This is just a misunderstanding on what you were asking to be added then. I have no objections to noting that popular distros have shipped with those problematic binutils versions, so keeping them in mind is important.
Quoted 7 lines · Borislav Petkov
Quoted 2 lines · Arvind Sankar
I will note that the purpose of
S_RELinrelocs.cwas originally to handle exactly this case of symbols defined outside output sections:And we should try not to do hacks, if it can be fixed properly, as binutils expects symbols to be usually relative to a section.
I've poked around a bit more, and all the hacks in relocs.c in S_REL, other than init_per_cpu__.*, are only there to work around old and/or buggy binutils versions from the 2.21-2.22 days.
The current code is *not* broken for binutils-2.23+, where none of these symbols are marked as absolute. IOW, the current code is perfectly fine and generates relative symbols for any binutils not of 2.21-2.22 vintage.
So we have the following choices:
* bump minimum supported binutils version to 2.23, and remove all the hacks for earlier versions.
* add a couple of hacks to relocs.c to account for new symbols, as in v2
* complicate regular code, as in v3, which Kees says might break new code [1] and Tom says is bad for future kernel hackers [2]
[1] https://lore.kernel.org/lkml/202001131750.C1B8468@keescook/
[2] https://lore.kernel.org/lkml/[email protected]/
PATCH v3 1/1 x86/vmlinux: Fix vmlinux.lds.S with pre-2.23 binutils
In reply to Arvind SankarPrior to binutils-2.23, ld treats the location counter as absolute if used outside an output section definition. From version 2.23 onwards, the location counter is treated as relative to an adjacent output section (usually the previous one, unless there isn't one or the location counter has been assigned to previously, in which case the next one).
The result is that a symbol definition in the linker script, such as
_etext = .;
that appears outside an output section definition makes _etext an absolute symbol prior to binutils-2.23 and a relative symbol from version 2.23 onwards. So when using a 2.21 or 2.22 vintage linker, the build fails with
Invalid absolute R_X86_64_32S relocation: _etext
for x86-64, and a similar message with R_386_32 for x86-32.
This can be reproduced with the official 2.21.1 and 2.22 binutils releases.
Commit b907693883fd ("x86/vmlinux: Actually use _etext for the end of the text segment") moved _etext out of the .text section to place it after the exception table, however since commit f0d7ee17d57c ("x86/vmlinux: Move EXCEPTION_TABLE to RO_DATA segment") this is no longer needed. Move _etext back inside .text to make it relative even with older linkers.
Commit c603a309cc75 ("x86/mm: Identify the end of the kernel area to be reserved") defines __end_of_kernel_reserve using the location counter outside an output section definition. Use __bss_stop instead of the location counter for the definition to make it relative with older linkers.
---
v3: Modify vmlinux.lds.S instead of adding more workarounds to tools/relocs.c
arch/x86/kernel/vmlinux.lds.S | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
arch/x86/kernel/vmlinux.lds.S +5 -3
@@ -144,10 +144,12 @@ SECTIONS *(.text.__x86.indirect_thunk) __indirect_thunk_end = .; #endif + + /* End of text section */ + _etext = .; } :text =0xcccc - /* End of text section, which should occupy whole number of pages */ - _etext = .; + /* .text should occupy whole number of pages */ . = ALIGN(PAGE_SIZE); X86_ALIGN_RODATA_BEGIN
@@ -372,7 +374,7 @@ SECTIONS * explicitly reserved using memblock_reserve() or it will be discarded * and treated as available memory. */ - __end_of_kernel_reserve = .; + __end_of_kernel_reserve = __bss_stop; . = ALIGN(PAGE_SIZE); .brk : AT(ADDR(.brk) - LOAD_OFFSET) {
Signature · 1 line
2.24.1
Re: [PATCH v3] x86/vmlinux: Fix vmlinux.lds.S with pre-2.23 binutils
Quoted 61 lines · Arvind Sankar
Prior to binutils-2.23, ld treats the location counter as absolute if used outside an output section definition. From version 2.23 onwards, the location counter is treated as relative to an adjacent output section (usually the previous one, unless there isn't one or the location counter has been assigned to previously, in which case the next one).
The result is that a symbol definition in the linker script, such as
_etext = .;that appears outside an output section definition makes
_etextan absolute symbol prior to binutils-2.23 and a relative symbol from version 2.23 onwards. So when using a 2.21 or 2.22 vintage linker, the build fails with
Invalid absoluteR_X86_64_32Srelocation:_etext
for x86-64, and a similar message withR_386_32for x86-32.This can be reproduced with the official 2.21.1 and 2.22 binutils releases.
Commit
b907693883fd("x86/vmlinux: Actually use_etextfor the end of the text segment") moved_etextout of the .text section to place it after the exception table, however since commitf0d7ee17d57c("x86/vmlinux: MoveEXCEPTION_TABLEtoRO_DATAsegment") this is no longer needed. Move_etextback inside .text to make it relative even with older linkers.Commit
c603a309cc75("x86/mm: Identify the end of the kernel area to be reserved") defines__end_of_kernel_reserveusing the location counter outside an output section definition. Use__bss_stopinstead of the location counter for the definition to make it relative with older linkers.Fixes b907693883fd ("x86/vmlinux: Actually use _etext for the end of the text segment")Fixes c603a309cc75 ("x86/mm: Identify the end of the kernel area to be reserved")Signed-off-by Arvind Sankar <[email protected]>---
v3: Modifyvmlinux.lds.Sinstead of adding more workarounds totools/relocs.carch/x86/kernel/vmlinux.lds.S | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)arch/x86/kernel/vmlinux.lds.S +4
-2@@ -144,10 +144,12 @@ SECTIONS *(.text.__x86.indirect_thunk) __indirect_thunk_end = .; #endif + + /* End of text section */ + _etext = .; } :text =0xcccc - /* End of text section, which should occupy whole number of pages */ - _etext = .; + /* .text should occupy whole number of pages */ . = ALIGN(PAGE_SIZE); X86_ALIGN_RODATA_BEGIN
arch/x86/kernel/vmlinux.lds.S SECTIONS · line 377
Quoted 5 lines
arch/x86/kernel/vmlinux.lds.S +1
-1@@ -372,7 +374,7 @@ SECTIONS * explicitly reserved using memblock_reserve() or it will be discarded * and treated as available memory. */ - __end_of_kernel_reserve = .; + __end_of_kernel_reserve = __bss_stop;
The only thing I worry about is if someone inserts a section between the bss section and here and doesn't update this value.
Thanks,
Tom
Quoted 4 lines
arch/x86/kernel/vmlinux.lds.S +0
-0. = ALIGN(PAGE_SIZE); .brk : AT(ADDR(.brk) - LOAD_OFFSET) {
Re: [PATCH v3] x86/vmlinux: Fix vmlinux.lds.S with pre-2.23 binutils
Quoted 10 lines · Tom Lendacky
Review SECTIONS · line 377
Quoted 6 lines
(quoted diff) +1
-1@@ -372,7 +374,7 @@ SECTIONS * explicitly reserved using memblock_reserve() or it will be discarded * and treated as available memory. */ - __end_of_kernel_reserve = .; + __end_of_kernel_reserve = __bss_stop;The only thing I worry about is if someone inserts a section between the bss section and here and doesn't update this value.
Quoted 2 lines
Thanks,
Tom
Could do something like this, or maybe with just the comment?
arch/x86/kernel/vmlinux.lds.S +10 -0
@@ -373,9 +373,16 @@ SECTIONS * automatically reserved in setup_arch(). Anything after here must be * explicitly reserved using memblock_reserve() or it will be discarded * and treated as available memory. + * + * Note that this is defined to use __bss_stop rather than dot for + * compatibility with binutils <2.23, so the definition MUST be updated + * if another section is added after .bss. */ __end_of_kernel_reserve = __bss_stop; + /* Used for build-time check that __end_of_kernel_reserve is correct */ + __end_of_kernel_reserve_check = .; + . = ALIGN(PAGE_SIZE); .brk : AT(ADDR(.brk) - LOAD_OFFSET) { __brk_base = .;
@@ -451,6 +458,9 @@ INIT_PER_CPU(irq_stack_backing_store); #endif /* CONFIG_X86_32 */ +. = ASSERT(__end_of_kernel_reserve == __end_of_kernel_reserve_check, + "__end_of_kernel_reserve is incorrectly defined"); + #ifdef CONFIG_KEXEC_CORE #include <asm/kexec.h>
Kees Cook
NAKRe: [PATCH v3] x86/vmlinux: Fix vmlinux.lds.S with pre-2.23 binutils
In reply to Arvind SankarQuoted 48 lines · Arvind Sankar
Prior to binutils-2.23, ld treats the location counter as absolute if used outside an output section definition. From version 2.23 onwards, the location counter is treated as relative to an adjacent output section (usually the previous one, unless there isn't one or the location counter has been assigned to previously, in which case the next one).
The result is that a symbol definition in the linker script, such as
_etext = .;that appears outside an output section definition makes
_etextan absolute symbol prior to binutils-2.23 and a relative symbol from version 2.23 onwards. So when using a 2.21 or 2.22 vintage linker, the build fails with
Invalid absoluteR_X86_64_32Srelocation:_etext
for x86-64, and a similar message withR_386_32for x86-32.This can be reproduced with the official 2.21.1 and 2.22 binutils releases.
Commit
b907693883fd("x86/vmlinux: Actually use_etextfor the end of the text segment") moved_etextout of the .text section to place it after the exception table, however since commitf0d7ee17d57c("x86/vmlinux: MoveEXCEPTION_TABLEtoRO_DATAsegment") this is no longer needed. Move_etextback inside .text to make it relative even with older linkers.Commit
c603a309cc75("x86/mm: Identify the end of the kernel area to be reserved") defines__end_of_kernel_reserveusing the location counter outside an output section definition. Use__bss_stopinstead of the location counter for the definition to make it relative with older linkers.Fixes b907693883fd ("x86/vmlinux: Actually use _etext for the end of the text segment")Fixes c603a309cc75 ("x86/mm: Identify the end of the kernel area to be reserved")Signed-off-by Arvind Sankar <[email protected]>---
v3: Modifyvmlinux.lds.Sinstead of adding more workarounds totools/relocs.carch/x86/kernel/vmlinux.lds.S | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)arch/x86/kernel/vmlinux.lds.S +0
-0@@ -144,10 +144,12 @@ SECTIONS *(.text.__x86.indirect_thunk) __indirect_thunk_end = .;
arch/x86/kernel/vmlinux.lds.S SECTIONS · line 153
Quoted 10 lines
arch/x86/kernel/vmlinux.lds.S +4
-2#endif + + /* End of text section */ + _etext = .; } :text =0xcccc - /* End of text section, which should occupy whole number of pages */ - _etext = .; + /* .text should occupy whole number of pages */ . = ALIGN(PAGE_SIZE);
NAK: linkers can add things at the end of .text that will go missing from the kernel if _etext isn't _outside_ the .text section, truly beyond the end of the .text section. This patch will break Control Flow Integrity checking since the jump tables are at the end of .text.
Boris, we're always working around weird linker problems; I don't see a problem with the v2 patch to fix up old binutils...
-Kees
Quoted 14 lines
arch/x86/kernel/vmlinux.lds.S +1
-1X86_ALIGN_RODATA_BEGIN@@ -372,7 +374,7 @@ SECTIONS * explicitly reserved using memblock_reserve() or it will be discarded * and treated as available memory. */ - __end_of_kernel_reserve = .; + __end_of_kernel_reserve = __bss_stop; . = ALIGN(PAGE_SIZE); .brk : AT(ADDR(.brk) - LOAD_OFFSET) {Signature · 1 line
2.24.1
Signature · 1 line
Kees Cook
H. Peter Anvin
reviewerRe: [PATCH v3] x86/vmlinux: Fix vmlinux.lds.S with pre-2.23 binutils
On 2020-01-13 17:53, Kees Cook wrote:>>
Quoted 23 lines
Quoted 7 lines
arch/x86/kernel/vmlinux.lds.S +0
-0@@ -144,10 +144,12 @@ SECTIONS *(.text.__x86.indirect_thunk) __indirect_thunk_end = .;arch/x86/kernel/vmlinux.lds.S SECTIONS · line 153
Quoted 10 lines
arch/x86/kernel/vmlinux.lds.S +4
-2#endif + + /* End of text section */ + _etext = .; } :text =0xcccc - /* End of text section, which should occupy whole number of pages */ - _etext = .; + /* .text should occupy whole number of pages */ . = ALIGN(PAGE_SIZE);NAK: linkers can add things at the end of .text that will go missing from the kernel if
_etextisn't _outside_ the .text section, truly beyond the end of the .text section. This patch will break Control Flow Integrity checking since the jump tables are at the end of .text.
Quoted 3 lines
Boris, we're always working around weird linker problems; I don't see a problem with the v2 patch to fix up old binutils...
Why not add the marker into a separate section instead of leaving it as an absolute "floater"? Very old binutils would botch that case, but I think that has been long since addressed well below our current minimum version.
-hpa
Re: [PATCH v3] x86/vmlinux: Fix vmlinux.lds.S with pre-2.23 binutils
Quoted 24 lines · H. Peter Anvin
On 2020-01-13 17:53, Kees Cook wrote:>>
Quoted 23 lines
Quoted 7 lines
arch/x86/kernel/vmlinux.lds.S +0
-0@@ -144,10 +144,12 @@ SECTIONS *(.text.__x86.indirect_thunk) __indirect_thunk_end = .;arch/x86/kernel/vmlinux.lds.S SECTIONS · line 153
Quoted 10 lines
arch/x86/kernel/vmlinux.lds.S +4
-2#endif + + /* End of text section */ + _etext = .; } :text =0xcccc - /* End of text section, which should occupy whole number of pages */ - _etext = .; + /* .text should occupy whole number of pages */ . = ALIGN(PAGE_SIZE);NAK: linkers can add things at the end of .text that will go missing from the kernel if
_etextisn't _outside_ the .text section, truly beyond the end of the .text section. This patch will break Control Flow Integrity checking since the jump tables are at the end of .text.
Quoted 7 lines
Quoted 3 lines
Boris, we're always working around weird linker problems; I don't see a problem with the v2 patch to fix up old binutils...
Why not add the marker into a separate section instead of leaving it as an absolute "floater"? Very old binutils would botch that case, but I think that has been long since addressed well below our current minimum version.
Can you send a patch with what you're thinking?
Signature · 1 line
Kees Cook
Re: [PATCH v3] x86/vmlinux: Fix vmlinux.lds.S with pre-2.23 binutils
In reply to H. Peter AnvinQuoted 28 lines · H. Peter Anvin
On 2020-01-13 17:53, Kees Cook wrote:>>
Quoted 23 lines
Quoted 7 lines
arch/x86/kernel/vmlinux.lds.S +0
-0@@ -144,10 +144,12 @@ SECTIONS *(.text.__x86.indirect_thunk) __indirect_thunk_end = .;arch/x86/kernel/vmlinux.lds.S SECTIONS · line 153
Quoted 10 lines
arch/x86/kernel/vmlinux.lds.S +4
-2#endif + + /* End of text section */ + _etext = .; } :text =0xcccc - /* End of text section, which should occupy whole number of pages */ - _etext = .; + /* .text should occupy whole number of pages */ . = ALIGN(PAGE_SIZE);NAK: linkers can add things at the end of .text that will go missing from the kernel if
_etextisn't _outside_ the .text section, truly beyond the end of the .text section. This patch will break Control Flow Integrity checking since the jump tables are at the end of .text.Quoted 3 lines
Boris, we're always working around weird linker problems; I don't see a problem with the v2 patch to fix up old binutils...
Quoted 8 lines
Why not add the marker into a separate section instead of leaving it as an absolute "floater"? Very old binutils would botch that case, but I think that has been long since addressed well below our current minimum version.
-hpa
Kees, thanks, I noted in the other email that you had mentioned this in a since-reverted commit, but you did not mention in the most recent commit.
hpa, I think this runs afoul of the bug you noted in commit fd952815307f ("x86-32, relocs: Whitelist more symbols for ld bug workaround"), ld version 2.22.52.0.[12] can incorrectly promote relative symbols to absolute, if the output section they appear in is otherwise empty.
That's 2.22, which is more recent than the 2.21 that the kernel documents as supported.
[email protected]
reviewerRe: [PATCH v3] x86/vmlinux: Fix vmlinux.lds.S with pre-2.23 binutils
Quoted 50 lines · Arvind Sankar
Quoted 2 lines · H. Peter Anvin
On 2020-01-13 17:53, Kees Cook wrote:>>
Quoted 1 line
Review
Quoted 1 line
(quoted diff) +0
-0
b/arch/x86/kernel/vmlinux.lds.SQuoted 12 lines
Quoted 12 lines
Quoted 12 lines
index
3a1a819da137..bad4e22384dc100644arch/x86/kernel/vmlinux.lds.S +3
-0@@ -144,10 +144,12 @@ SECTIONS *(.text.__x86.indirect_thunk) __indirect_thunk_end = .; #endif + + /* End of text section */ + _etext = .; } :text =0xccccQuoted 1 line
Quoted 1 line
arch/x86/kernel/vmlinux.lds.S SECTIONS · line 149
Quoted 1 line
arch/x86/kernel/vmlinux.lds.S +0
-1- /* End of text section, which should occupy whole number ofpages */
Quoted 5 lines
Quoted 5 lines
arch/x86/kernel/vmlinux.lds.S SECTIONS · line 153
Quoted 3 lines
arch/x86/kernel/vmlinux.lds.S +1
-1- _etext = .; + /* .text should occupy whole number of pages */ . = ALIGN(PAGE_SIZE);NAK: linkers can add things at the end of .text that will go
missing from
Quoted 1 line
Quoted 1 line
the kernel if
_etextisn't _outside_ the .text section, trulybeyond the
Quoted 1 line
Quoted 1 line
end of the .text section. This patch will break Control Flow
Integrity
Quoted 3 lines
Quoted 3 lines
checking since the jump tables are at the end of .text.
Boris, we're always working around weird linker problems; I don't
see a
Quoted 4 lines
Quoted 2 lines
problem with the v2 patch to fix up old binutils...
Why not add the marker into a separate section instead of leaving it
as an
Quoted 1 line
absolute "floater"? Very old binutils would botch that case, but I
think that
Quoted 6 lines
has been long since addressed well below our current minimum version.
-hpa
Kees, thanks, I noted in the other email that you had mentioned this in a since-reverted commit, but you did not mention in the most recent commit.
Quoted 8 lines
hpa, I think this runs afoul of the bug you noted in commit
fd952815307f
("x86-32, relocs: Whitelist more symbols for ld bug workaround"), ld version 2.22.52.0.[12] can incorrectly promote relative symbols to absolute, if the output section they appear in is otherwise empty.That's 2.22, which is more recent than the 2.21 that the kernel documents as supported.
Oh right... they introduced that little piece of drain bramage.
Signature · 1 line
Sent from my Android device with K-9 Mail. Please excuse my brevity.
Borislav Petkov
maintainerRe: [PATCH v3] x86/vmlinux: Fix vmlinux.lds.S with pre-2.23 binutils
In reply to Kees CookQuoted 4 lines · Kees Cook
NAK: linkers can add things at the end of .text that will go missing from the kernel if
_etextisn't _outside_ the .text section, truly beyond the end of the .text section. This patch will break Control Flow Integrity checking since the jump tables are at the end of .text.
Err, which linkers are those? Please elaborate.
In any case, after reading the thread, I can't help but favor the idea of us bumping min binutils version to 2.23.
Michael (on Cc) says that the 2.21 was kinda broken wrt to the symbols fun outside of sections, 2.22 tried to fix it, see
fd952815307f ("x86-32, relocs: Whitelist more symbols for ld bug workaround")
which Arvind pointed out and 2.23 fixed it for real.
Now, 2.23 is still very ancient. I'm looking at our releases: openSUSE 12.1 has the minimum supported gcc version 4.6 by the kernel and also the minimum binutils version 2.21 which we support according to Documentation/process/changes.rst
Now, openSUSE 12.1 is ancient and we ourselves advise people to update to current distros so I don't think anyone would still run it.
So, considering that upping the binutils version would save us from all this trouble I say we try it after 5.5 releases for a maximum time of a full 5.6 release cycle and see who complains.
Considering how no one triggered this yet until Arvind, I think no one would complain. But I might be wrong.
So what do people think? hpa?
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette[email protected]
reviewerRe: [PATCH v3] x86/vmlinux: Fix vmlinux.lds.S with pre-2.23 binutils
Quoted 30 lines · Borislav Petkov
Quoted 1 line · Kees Cook
NAK: linkers can add things at the end of .text that will go missing
from
Quoted 1 line
the kernel if
_etextisn't _outside_ the .text section, truly beyondthe
Quoted 1 line
end of the .text section. This patch will break Control Flow
Integrity
Quoted 1 line
checking since the jump tables are at the end of .text.
Err, which linkers are those? Please elaborate.
In any case, after reading the thread, I can't help but favor the idea of us bumping min binutils version to 2.23.
Michael (on Cc) says that the 2.21 was kinda broken wrt to the symbols fun outside of sections, 2.22 tried to fix it, see
fd952815307f("x86-32, relocs: Whitelist more symbols for ld bug workaround")which Arvind pointed out and 2.23 fixed it for real.
Now, 2.23 is still very ancient. I'm looking at our releases: openSUSE 12.1 has the minimum supported gcc version 4.6 by the kernel and also the minimum binutils version 2.21 which we support according to
Documentation/process/changes.rstNow, openSUSE 12.1 is ancient and we ourselves advise people to update to current distros so I don't think anyone would still run it.
Quoted 8 lines
So, considering that upping the binutils version would save us from all this trouble I say we try it after 5.5 releases for a maximum time of a full 5.6 release cycle and see who complains.
Considering how no one triggered this yet until Arvind, I think no one would complain. But I might be wrong.
So what do people think? hpa?
I'm all for dumping support for an ancient, known buggy binutils.
Signature · 1 line
Sent from my Android device with K-9 Mail. Please excuse my brevity.
Re: [PATCH v3] x86/vmlinux: Fix vmlinux.lds.S with pre-2.23 binutils
In reply to Borislav PetkovQuoted 18 lines · Borislav Petkov
Quoted 4 lines · Kees Cook
NAK: linkers can add things at the end of .text that will go missing from the kernel if
_etextisn't _outside_ the .text section, truly beyond the end of the .text section. This patch will break Control Flow Integrity checking since the jump tables are at the end of .text.Err, which linkers are those? Please elaborate.
In any case, after reading the thread, I can't help but favor the idea of us bumping min binutils version to 2.23.
Michael (on Cc) says that the 2.21 was kinda broken wrt to the symbols fun outside of sections, 2.22 tried to fix it, see
fd952815307f("x86-32, relocs: Whitelist more symbols for ld bug workaround")which Arvind pointed out and 2.23 fixed it for real.
Quoted 7 lines
Now, 2.23 is still very ancient. I'm looking at our releases: openSUSE 12.1 has the minimum supported gcc version 4.6 by the kernel and also the minimum binutils version 2.21 which we support according to
Documentation/process/changes.rstNow, openSUSE 12.1 is ancient and we ourselves advise people to update to current distros so I don't think anyone would still run it.
RHEL7 looks to have been released with 2.23 and we already don't support the version in RHEL6, so that should be good too.
Quoted 10 lines
So, considering that upping the binutils version would save us from all this trouble I say we try it after 5.5 releases for a maximum time of a full 5.6 release cycle and see who complains.
Considering how no one triggered this yet until Arvind, I think no one would complain. But I might be wrong.
So what do people think? hpa?
Thumbs up from me -- I had thought there were a few other reports earlier about these, but looking at those threads, it seems like they're all actually with ld.gold, which we already decided to drop support for in commit 75959d44f9dc ("kbuild: Fail if gold linker is detected").
Quoted 5 lines
Signature · 4 lines
Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette
Borislav Petkov
maintainerRe: [PATCH v3] x86/vmlinux: Fix vmlinux.lds.S with pre-2.23 binutils
Quoted 2 lines · Arvind Sankar
RHEL7 looks to have been released with 2.23 and we already don't support the version in RHEL6, so that should be good too.
Good.
Quoted 2 lines
Thumbs up from me -- I had thought there were a few other reports earlier about these,
Lemme clarify what I meant: I'm not aware of any other reports wrt current kernel and ancient binutils build issues.
Quoted 3 lines
but looking at those threads, it seems like they're
all actually with ld.gold, which we already decided to drop support for in commit75959d44f9dc("kbuild: Fail if gold linker is detected").
Ok, then. So I'd say, we should do a trivial patch upping the binutils version in Documentation/process/changes.rst with an explanation why we're doing it. I'll queue it after 5.6-rc1 into tip and then it would spend the maximal amount of exposure time in linux-next until it releases in 5.7 sometime in the late summer.
I think that's the maximal exposure we can do before it hits an upstream, non-rc release and hope that whoever wants to complain, will do so before then.
Thx.
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteBorislav Petkov
maintainerPATCH 1/1 Documentation/changes: Raise minimum supported binutils version to 2.23
Long overdue patch, see below.
Plan is to queue it after 5.7-rc1.
---
From: Borislav Petkov <[email protected]>
Date: Mon, 16 Mar 2020 16:28:36 +0100
Subject: [PATCH] Documentation/changes: Raise minimum supported binutilsa version to 2.23
The currently minimum-supported binutils version 2.21 has the problem of promoting symbols which are defined outside of a section into absolute. According to Arvind:
binutils-2.21 and -2.22. An x86-64 defconfig will fail with
Invalid absolute R_X86_64_32S relocation: _etext
and after fixing that one, with
Invalid absolute R_X86_64_32S relocation: __end_of_kernel_reserve
Those two versions of binutils have a bug when it comes to handling symbols defined outside of a section and binutils 2.23 has the proper fix, see: https://sourceware.org/legacy-ml/binutils/2012-06/msg00155.html
Therefore, up to the fixed version directly, skipping the broken ones.
Currently shipping distros already have the fixed binutils version so there should be no breakage resulting from this.
For more details about the whole thing, see the thread in Link.
--- Documentation/process/changes.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/process/changes.rst +1 -1
@@ -31,7 +31,7 @@ you probably needn't concern yourself with pcmciautils. ====================== =============== ======================================== GNU C 4.6 gcc --version GNU make 3.81 make --version -binutils 2.21 ld -v +binutils 2.23 ld -v flex 2.5.35 flex --version bison 2.0 bison --version util-linux 2.10o fdformat --version
Signature · 7 lines
2.21.0
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteRe: [PATCH] Documentation/changes: Raise minimum supported binutils version to 2.23
Quoted 22 lines · Borislav Petkov
Long overdue patch, see below.
Plan is to queue it after 5.7-rc1.
---
From: Borislav Petkov <[email protected]>
Date: Mon, 16 Mar 2020 16:28:36 +0100
Subject: [PATCH]Documentation/changes: Raise minimum supported binutilsa version to 2.23The currently minimum-supported binutils version 2.21 has the problem of promoting symbols which are defined outside of a section into absolute. According to Arvind:
binutils-2.21 and -2.22. An x86-64 defconfig will fail with
Invalid absoluteR_X86_64_32Srelocation:_etext
and after fixing that one, with
Invalid absoluteR_X86_64_32Srelocation:__end_of_kernel_reserveThose two versions of binutils have a bug when it comes to handling symbols defined outside of a section and binutils 2.23 has the proper fix, see: https://sourceware.org/legacy-ml/binutils/2012-06/msg00155.html
Quoted 8 lines
Therefore, up to the fixed version directly, skipping the broken ones.
Currently shipping distros already have the fixed binutils version so there should be no breakage resulting from this.
For more details about the whole thing, see the thread in Link.
Signed-off-by Borislav Petkov <[email protected]>
-Kees
Quoted 26 lines
--- Documentation/process/changes.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Documentation/process/changes.rst +1
-1@@ -31,7 +31,7 @@ you probably needn't concern yourself with pcmciautils. ====================== =============== ======================================== GNU C 4.6 gcc --version GNU make 3.81 make --version -binutils 2.21 ld -v +binutils 2.23 ld -v flex 2.5.35 flex --version bison 2.0 bison --version util-linux 2.10o fdformat --versionSignature · 7 lines
2.21.0 -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette
Signature · 1 line
Kees Cook
Re: [PATCH] Documentation/changes: Raise minimum supported binutils version to 2.23
In reply to Borislav PetkovQuoted 22 lines · Borislav Petkov
Long overdue patch, see below.
Plan is to queue it after 5.7-rc1.
---
From: Borislav Petkov <[email protected]>
Date: Mon, 16 Mar 2020 16:28:36 +0100
Subject: [PATCH]Documentation/changes: Raise minimum supported binutilsa version to 2.23The currently minimum-supported binutils version 2.21 has the problem of promoting symbols which are defined outside of a section into absolute. According to Arvind:
binutils-2.21 and -2.22. An x86-64 defconfig will fail with
Invalid absoluteR_X86_64_32Srelocation:_etext
and after fixing that one, with
Invalid absoluteR_X86_64_32Srelocation:__end_of_kernel_reserveThose two versions of binutils have a bug when it comes to handling symbols defined outside of a section and binutils 2.23 has the proper fix, see: https://sourceware.org/legacy-ml/binutils/2012-06/msg00155.html
Quoted 6 lines
Therefore, up to the fixed version directly, skipping the broken ones.
Currently shipping distros already have the fixed binutils version so there should be no breakage resulting from this.
For more details about the whole thing, see the thread in Link.
That sounds very good to me. Then we'll be able to use ADX instructions without ifdefs.
Re: [PATCH] Documentation/changes: Raise minimum supported binutils version to 2.23
Quoted 28 lines · Jason A. Donenfeld
Quoted 27 lines · Borislav Petkov
Long overdue patch, see below.
Plan is to queue it after 5.7-rc1.
---
From: Borislav Petkov <[email protected]>
Date: Mon, 16 Mar 2020 16:28:36 +0100
Subject: [PATCH]Documentation/changes: Raise minimum supported binutilsa version to 2.23The currently minimum-supported binutils version 2.21 has the problem of promoting symbols which are defined outside of a section into absolute. According to Arvind:
binutils-2.21 and -2.22. An x86-64 defconfig will fail with
Invalid absoluteR_X86_64_32Srelocation:_etext
and after fixing that one, with
Invalid absoluteR_X86_64_32Srelocation:__end_of_kernel_reserveThose two versions of binutils have a bug when it comes to handling symbols defined outside of a section and binutils 2.23 has the proper fix, see: https://sourceware.org/legacy-ml/binutils/2012-06/msg00155.html
Therefore, up to the fixed version directly, skipping the broken ones.
Currently shipping distros already have the fixed binutils version so there should be no breakage resulting from this.
Quoted 6 lines
Quoted 1 line
For more details about the whole thing, see the thread in Link.
That sounds very good to me. Then we'll be able to use ADX instructions without ifdefs.
Can you send these now and we can land in 5.7 with the doc change?
-Kees
Signature · 1 line
Kees Cook
Re: [PATCH] Documentation/changes: Raise minimum supported binutils version to 2.23
Quoted 30 lines · Kees Cook
Quoted 28 lines · Jason A. Donenfeld
Quoted 27 lines · Borislav Petkov
Long overdue patch, see below.
Plan is to queue it after 5.7-rc1.
---
From: Borislav Petkov <[email protected]>
Date: Mon, 16 Mar 2020 16:28:36 +0100
Subject: [PATCH]Documentation/changes: Raise minimum supported binutilsa version to 2.23The currently minimum-supported binutils version 2.21 has the problem of promoting symbols which are defined outside of a section into absolute. According to Arvind:
binutils-2.21 and -2.22. An x86-64 defconfig will fail with
Invalid absoluteR_X86_64_32Srelocation:_etext
and after fixing that one, with
Invalid absoluteR_X86_64_32Srelocation:__end_of_kernel_reserveThose two versions of binutils have a bug when it comes to handling symbols defined outside of a section and binutils 2.23 has the proper fix, see: https://sourceware.org/legacy-ml/binutils/2012-06/msg00155.html
Therefore, up to the fixed version directly, skipping the broken ones.
Currently shipping distros already have the fixed binutils version so there should be no breakage resulting from this.
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
For more details about the whole thing, see the thread in Link.
That sounds very good to me. Then we'll be able to use ADX instructions without ifdefs.
Can you send these now and we can land in 5.7 with the doc change?
By the way, while we're in the process of updating dependencies, what if we ratched the minimum binutils on x86 up to 2.25 (which is still quite old)? In this case, we could get rid of *all* of the CONFIG_AS_* ifdefs throughout.
Jason
RE: [PATCH] Documentation/changes: Raise minimum supported binutils version to 2.23
From: Jason A. Donenfeld
Quoted 1 line
Sent: 23 March 2020 21:12
...
Quoted 4 lines
By the way, while we're in the process of updating dependencies, what if we ratched the minimum binutils on x86 up to 2.25 (which is still quite old)? In this case, we could get rid of *all* of the CONFIG_AS_* ifdefs throughout.
Even my system has 2.23.2, although I've had to pull in a later version of old of the elf libraries at some point.
Unfortunately we have to support customers who insist on using very old distributions - and it is easiest to build things on systems with similar old userspace.
The memcpy/memmove fiasco and changes to C++ 'character traits' make anything else almost impossible.
Unnecessary minimum versions do cause grief.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)
Re: [PATCH] Documentation/changes: Raise minimum supported binutils version to 2.23
In reply to Kees CookHi.
Quoted 32 lines · Kees Cook
Quoted 30 lines · Jason A. Donenfeld
Quoted 28 lines · Borislav Petkov
Long overdue patch, see below.
Plan is to queue it after 5.7-rc1.
---
From: Borislav Petkov <[email protected]>
Date: Mon, 16 Mar 2020 16:28:36 +0100
Subject: [PATCH]Documentation/changes: Raise minimum supported binutilsa version to 2.23The currently minimum-supported binutils version 2.21 has the problem of promoting symbols which are defined outside of a section into absolute. According to Arvind:
binutils-2.21 and -2.22. An x86-64 defconfig will fail with
Invalid absoluteR_X86_64_32Srelocation:_etext
and after fixing that one, with
Invalid absoluteR_X86_64_32Srelocation:__end_of_kernel_reserveThose two versions of binutils have a bug when it comes to handling symbols defined outside of a section and binutils 2.23 has the proper fix, see: https://sourceware.org/legacy-ml/binutils/2012-06/msg00155.html
Therefore, up to the fixed version directly, skipping the broken ones.
Currently shipping distros already have the fixed binutils version so there should be no breakage resulting from this.
For more details about the whole thing, see the thread in Link.
Quoted 8 lines
Quoted 4 lines
That sounds very good to me. Then we'll be able to use ADX instructions without ifdefs.
Can you send these now and we can land in 5.7 with the doc change?
-Kees
Kees,
I folded this patch into the following series (16 patches):
https://lore.kernel.org/patchwork/project/lkml/list/?series=435391
This patch (14/16) is a prerequisite for 15/16.
Borislav,
When I forwarded this patch, I fixed up one more line. (changes.rst duplicates the same information...)
Please see this. I hope this should be OK.
https://lore.kernel.org/patchwork/patch/1214519/
Quoted 2 lines
--
Kees Cook
--
Best Regards
Masahiro Yamada
Re: [PATCH] Documentation/changes: Raise minimum supported binutils version to 2.23
Quoted 30 lines · Masahiro Yamada
Hi.
Quoted 24 lines · Kees Cook
Quoted 22 lines · Jason A. Donenfeld
Quoted 21 lines · Borislav Petkov
Long overdue patch, see below.
Plan is to queue it after 5.7-rc1.
---
From: Borislav Petkov <[email protected]>
Date: Mon, 16 Mar 2020 16:28:36 +0100
Subject: [PATCH]Documentation/changes: Raise minimum supported binutilsa version to 2.23The currently minimum-supported binutils version 2.21 has the problem of promoting symbols which are defined outside of a section into absolute. According to Arvind:
binutils-2.21 and -2.22. An x86-64 defconfig will fail with
Invalid absoluteR_X86_64_32Srelocation:_etext
and after fixing that one, with
Invalid absoluteR_X86_64_32Srelocation:__end_of_kernel_reserveThose two versions of binutils have a bug when it comes to handling symbols defined outside of a section and binutils 2.23 has the proper fix, see: https://sourceware.org/legacy-ml/binutils/2012-06/msg00155.html
This seems to be also related to 7883a14339299773b2ce08dcfd97c63c199a9289
I had noticed the symbol "_text"
was absolute on binutils <= 2.22,
but I was not sure whether it was a bug of the tool.
I applied the fix.
Perhaps, it was unneeded given that we require the binutils 2.23
Quoted 45 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Therefore, up to the fixed version directly, skipping the broken ones.
Currently shipping distros already have the fixed binutils version so there should be no breakage resulting from this.
For more details about the whole thing, see the thread in Link.
Quoted 8 lines
Quoted 4 lines
That sounds very good to me. Then we'll be able to use ADX instructions without ifdefs.
Can you send these now and we can land in 5.7 with the doc change?
-Kees
Kees,
I folded this patch into the following series (16 patches):
https://lore.kernel.org/patchwork/project/lkml/list/?series=435391This patch (14/16) is a prerequisite for 15/16.
Borislav,
When I forwarded this patch, I fixed up one more line. (
changes.rstduplicates the same information...)Please see this. I hope this should be OK.
https://lore.kernel.org/patchwork/patch/1214519/Quoted 2 lines
--
Kees Cook--
Best Regards
Masahiro Yamada
Signature · 2 lines
Best Regards Masahiro Yamada
Re: [PATCH] Documentation/changes: Raise minimum supported binutils version to 2.23
Quoted 37 lines · Masahiro Yamada
Quoted 30 lines · Masahiro Yamada
Hi.
Quoted 24 lines · Kees Cook
Quoted 22 lines · Jason A. Donenfeld
Quoted 21 lines · Borislav Petkov
Long overdue patch, see below.
Plan is to queue it after 5.7-rc1.
---
From: Borislav Petkov <[email protected]>
Date: Mon, 16 Mar 2020 16:28:36 +0100
Subject: [PATCH]Documentation/changes: Raise minimum supported binutilsa version to 2.23The currently minimum-supported binutils version 2.21 has the problem of promoting symbols which are defined outside of a section into absolute. According to Arvind:
binutils-2.21 and -2.22. An x86-64 defconfig will fail with
Invalid absoluteR_X86_64_32Srelocation:_etext
and after fixing that one, with
Invalid absoluteR_X86_64_32Srelocation:__end_of_kernel_reserveThose two versions of binutils have a bug when it comes to handling symbols defined outside of a section and binutils 2.23 has the proper fix, see: https://sourceware.org/legacy-ml/binutils/2012-06/msg00155.html
This seems to be also related to
7883a14339299773b2ce08dcfd97c63c199a9289
Quoted 8 lines
I had noticed the symbol "
_text"
was absolute on binutils <= 2.22,
but I was not sure whether it was a bug of the tool.I applied the fix.
Perhaps, it was unneeded given that we require the binutils 2.23
Which architecture? x86 at least doesn't even build with <= 2.22, but adding workarounds for that shows _text as section-relative (T in nm output).
Re: [PATCH] Documentation/changes: Raise minimum supported binutils version to 2.23
Quoted 43 lines · Arvind Sankar
Quoted 41 lines · Masahiro Yamada
Quoted 30 lines · Masahiro Yamada
Hi.
Quoted 24 lines · Kees Cook
Quoted 22 lines · Jason A. Donenfeld
Quoted 21 lines · Borislav Petkov
Long overdue patch, see below.
Plan is to queue it after 5.7-rc1.
---
From: Borislav Petkov <[email protected]>
Date: Mon, 16 Mar 2020 16:28:36 +0100
Subject: [PATCH]Documentation/changes: Raise minimum supported binutilsa version to 2.23The currently minimum-supported binutils version 2.21 has the problem of promoting symbols which are defined outside of a section into absolute. According to Arvind:
binutils-2.21 and -2.22. An x86-64 defconfig will fail with
Invalid absoluteR_X86_64_32Srelocation:_etext
and after fixing that one, with
Invalid absoluteR_X86_64_32Srelocation:__end_of_kernel_reserveThose two versions of binutils have a bug when it comes to handling symbols defined outside of a section and binutils 2.23 has the proper fix, see: https://sourceware.org/legacy-ml/binutils/2012-06/msg00155.html
This seems to be also related to
7883a14339299773b2ce08dcfd97c63c199a9289I had noticed the symbol "
_text"
was absolute on binutils <= 2.22,
but I was not sure whether it was a bug of the tool.
Quoted 8 lines
Quoted 4 lines
I applied the fix.
Perhaps, it was unneeded given that we require the binutils 2.23Which architecture? x86 at least doesn't even build with <= 2.22, but adding workarounds for that shows
_textas section-relative (T in nm output).
The reporter found this for PowerPC,
but I think this could happen on any architecture.
https://patchwork.kernel.org/patch/11430243/
Signature · 2 lines
Best Regards Masahiro Yamada
Re: [PATCH] Documentation/changes: Raise minimum supported binutils version to 2.23
Quoted 7 lines · Masahiro Yamada
Quoted 4 lines · Arvind Sankar
Which architecture? x86 at least doesn't even build with <= 2.22, but adding workarounds for that shows
_textas section-relative (T in nm output).
Quoted 6 lines
The reporter found this for PowerPC,
but I think this could happen on any architecture.
Ok, the powerpc linker script defines _text outside any output section, so it is indeed the same issue as with _etext on x86.
Borislav Petkov
maintainerRe: [PATCH] Documentation/changes: Raise minimum supported binutils version to 2.23
In reply to Masahiro YamadaQuoted 7 lines · Masahiro Yamada
Borislav,
When I forwarded this patch, I fixed up one more line. (
changes.rstduplicates the same information...)Please see this. I hope this should be OK.
https://lore.kernel.org/patchwork/patch/1214519/
Thanks.
However, I wanted to queue this patch *after* 5.7-rc1 and so that it lands in 5.8 and so that it has a maximum cycle in testing - well, it is not really testing but getting more people to see it and have the chance to complain - and not queue it now.
I did some searching on distrowatch.com last night and the couple of distros shipping binutils 2.23 I saw, were already EOL but the search was not exhaustive.
And from looking at your patchset, I think it should get the max time testing in linux-next too, so that we have time to address any build issues it might uncover.
IMO.
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteRe: [PATCH] Documentation/changes: Raise minimum supported binutils version to 2.23
Quoted 12 lines · Borislav Petkov
Quoted 7 lines · Masahiro Yamada
Borislav,
When I forwarded this patch, I fixed up one more line. (
changes.rstduplicates the same information...)Please see this. I hope this should be OK.
https://lore.kernel.org/patchwork/patch/1214519/Thanks.
Quoted 8 lines
However, I wanted to queue this patch *after* 5.7-rc1 and so that it lands in 5.8 and so that it has a maximum cycle in testing - well, it is not really testing but getting more people to see it and have the chance to complain - and not queue it now.
I did some searching on distrowatch.com last night and the couple of distros shipping binutils 2.23 I saw, were already EOL but the search was not exhaustive.
OK, if we take time for this decision,
we can drop 14/16 and 15/16 for now.
Quoted 3 lines
And from looking at your patchset, I think it should get the max time testing in linux-next too, so that we have time to address any build issues it might uncover.
Linus was positive to have this for 5.7
https://lkml.org/lkml/2020/3/21/262
I hope 01-13 will get merged for the next MW. We still have a couple of weeks to test it in -next.
Quoted 7 lines
IMO.
--
Regards/Gruss,
Boris.
Signature · 2 lines
Best Regards Masahiro Yamada
Borislav Petkov
maintainerRe: [PATCH] Documentation/changes: Raise minimum supported binutils version to 2.23
Quoted 2 lines · Masahiro Yamada
Linus was positive to have this for 5.7
https://lkml.org/lkml/2020/3/21/262
Linus acked a 3-patch series there - not that, AFAICT.
Quoted 2 lines
I hope 01-13 will get merged for the next MW. We still have a couple of weeks to test it in -next.
We'll see how testing turns out...
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteRe: [PATCH] Documentation/changes: Raise minimum supported binutils version to 2.23
In reply to Borislav PetkovQuoted 6 lines · Borislav Petkov
Quoted 5 lines · Masahiro Yamada
Borislav,
When I forwarded this patch, I fixed up one more line. (
changes.rstduplicates the same information...)
Quoted 7 lines
Quoted 2 lines
Please see this. I hope this should be OK.
https://lore.kernel.org/patchwork/patch/1214519/Thanks.
However, I wanted to queue this patch *after* 5.7-rc1 and so that it lands in 5.8
Both Kees and I were pretty positive yesterday about getting this done in 5.7, now. I don't think that filing these away in some subsystem tree will actually result in any more bugs being shaken out, than if we just do this at the very very beginning of the 5.7 cycle.
Borislav Petkov
maintainerRe: [PATCH] Documentation/changes: Raise minimum supported binutils version to 2.23
Quoted 2 lines · Jason A. Donenfeld
Both Kees and I were pretty positive yesterday about getting this done in 5.7, now.
Are you or Kees going to deal with any fallout from upping the binutils version, rushed in in the last week before the merge window?
Because I sure as hell am not. *Especially* if there's no big difference when it goes in.
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteRe: [PATCH] Documentation/changes: Raise minimum supported binutils version to 2.23
Quoted 3 lines · Borislav Petkov
Are you or Kees going to deal with any fallout from upping the binutils version, rushed in in the last week before the merge window?
I think it's ok. It's not going to cause any _subtle_ failures, it's going to cause very clear "oh, now it doesn't build" errors.
No?
And binutils 2.23 is what, 7+ years old by now and apparently had known failure cases too.
But if there are silent and subtle failures, that might be a reason to be careful. Are there?
Linus
Borislav Petkov
maintainerRe: [PATCH] Documentation/changes: Raise minimum supported binutils version to 2.23
Quoted 10 lines · Linus Torvalds
I think it's ok. It's not going to cause any _subtle_ failures, it's going to cause very clear "oh, now it doesn't build" errors.
No?
And binutils 2.23 is what, 7+ years old by now and apparently had known failure cases too.
But if there are silent and subtle failures, that might be a reason to be careful. Are there?
Well, not that I know of and that's why I'm being overly cautious. Maybe too cautious but a lot of hectic testing of last minute fixes in the past have taught me to take my time.
And since it doesn't really matter when the patch goes in - there's always the next merge window - I would prefer to take our time and have it simmer in -next for max period.
So yeah, 2.23 has been tested for a long time now and it is very likely that nothing would happen and if you think it's ok, then sure. Then if you happen to see urgent pull requests with build or some other fixes, at least you'll be prepared. :-)
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteRe: [PATCH] Documentation/changes: Raise minimum supported binutils version to 2.23
Quoted 16 lines · Borislav Petkov
Quoted 10 lines · Linus Torvalds
I think it's ok. It's not going to cause any _subtle_ failures, it's going to cause very clear "oh, now it doesn't build" errors.
No?
And binutils 2.23 is what, 7+ years old by now and apparently had known failure cases too.
But if there are silent and subtle failures, that might be a reason to be careful. Are there?
Well, not that I know of and that's why I'm being overly cautious. Maybe too cautious but a lot of hectic testing of last minute fixes in the past have taught me to take my time.
Quoted 9 lines
And since it doesn't really matter when the patch goes in - there's always the next merge window - I would prefer to take our time and have it simmer in -next for max period.
So yeah, 2.23 has been tested for a long time now and it is very likely that nothing would happen and if you think it's ok, then sure. Then if you happen to see urgent pull requests with build or some other fixes, at least you'll be prepared. :-)
This is just a documentation patch right? Nothing actually changes with the build. The only possible thing that we would potentially have to deal with is
(1) people noticing the doc change and complaining that they still need to use binutils-2.21 for some reason -- but they can't currently build an x86 kernel without patches anyway, so...
(2) people noticing the doc change and suggesting moving to 2.26 or some later version instead of 2.23.
Re: [PATCH] Documentation/changes: Raise minimum supported binutils version to 2.23
Quoted 27 lines · Arvind Sankar
Quoted 16 lines · Borislav Petkov
Quoted 10 lines · Linus Torvalds
I think it's ok. It's not going to cause any _subtle_ failures, it's going to cause very clear "oh, now it doesn't build" errors.
No?
And binutils 2.23 is what, 7+ years old by now and apparently had known failure cases too.
But if there are silent and subtle failures, that might be a reason to be careful. Are there?
Well, not that I know of and that's why I'm being overly cautious. Maybe too cautious but a lot of hectic testing of last minute fixes in the past have taught me to take my time.
Quoted 9 lines
And since it doesn't really matter when the patch goes in - there's always the next merge window - I would prefer to take our time and have it simmer in -next for max period.
So yeah, 2.23 has been tested for a long time now and it is very likely that nothing would happen and if you think it's ok, then sure. Then if you happen to see urgent pull requests with build or some other fixes, at least you'll be prepared. :-)
Quoted 7 lines
This is just a documentation patch right? Nothing actually changes with the build. The only possible thing that we would potentially have to deal with is
(1) people noticing the doc change and complaining that they still need to use binutils-2.21 for some reason -- but they can't currently build an x86 kernel without patches anyway, so...
The __end_of_kernel_reserve symbol that breaks with the 2.21-2.22 binutils was added in v5.3, so we've already gone 3 kernel versions without complaints.
Quoted 3 lines
(2) people noticing the doc change and suggesting moving to 2.26 or some later version instead of 2.23.
Re: [PATCH] Documentation/changes: Raise minimum supported binutils version to 2.23
In reply to Arvind SankarQuoted 2 lines · Arvind Sankar
This is just a documentation patch right?
That patch, yes.
However, there's a second patch that knows that if we have binutils >= 2.22, then we don't need to check for AVX2 or ADX support, because we know it's there.
Linus
Re: [PATCH] Documentation/changes: Raise minimum supported binutils version to 2.23
Quoted 11 lines · Linus Torvalds
Quoted 2 lines · Arvind Sankar
This is just a documentation patch right?
That patch, yes.
However, there's a second patch that knows that if we have binutils >= 2.22, then we don't need to check for AVX2 or ADX support, because we know it's there.
Linus
Ok. But if you're otherwise ok taking those AVX2/ADX patches for 5.7, as noted in my other email [1], the x86 build has been broken with binutils <= 2.22 since v5.3.
Re: [PATCH] Documentation/changes: Raise minimum supported binutils version to 2.23
In reply to Linus TorvaldsQuoted 8 lines · Linus Torvalds
Quoted 3 lines · Borislav Petkov
Are you or Kees going to deal with any fallout from upping the binutils version, rushed in in the last week before the merge window?
I think it's ok. It's not going to cause any _subtle_ failures, it's going to cause very clear "oh, now it doesn't build" errors.
Quoted 7 lines
No?
And binutils 2.23 is what, 7+ years old by now and apparently had known failure cases too.
But if there are silent and subtle failures, that might be a reason to be careful. Are there?
FWIW, I have plenty of other hills to die on, so I have no urgency on this change. I actually thought it had already happened, since it was brought up a while ago. :) I am just excited to see it happen since it unblocks other work I've been touching. As long as it's "eventually", I don't care when. :)
Signature · 1 line
Kees Cook
Re: [PATCH] Documentation/changes: Raise minimum supported binutilsa version to 2.23
In reply to Borislav PetkovQuoted 15 lines
The currently minimum-supported binutils version 2.21 has the problem of promoting symbols which are defined outside of a section into absolute. According to Arvind:
binutils-2.21 and -2.22. An x86-64 defconfig will fail with
Invalid absoluteR_X86_64_32Srelocation:_etext
and after fixing that one, with
Invalid absoluteR_X86_64_32Srelocation:__end_of_kernel_reserveThose two versions of binutils have a bug when it comes to handling symbols defined outside of a section and binutils 2.23 has the proper fix, see: https://sourceware.org/legacy-ml/binutils/2012-06/msg00155.html
Therefore, up to the fixed version directly, skipping the broken ones.
Quoted 7 lines
Currently shipping distros already have the fixed binutils version so there should be no breakage resulting from this.
For more details about the whole thing, see the thread in Link.
Quoted 37 lines · Borislav Petkov
Quoted 11 lines · Arvind Sankar
Quoted 10 lines · Borislav Petkov
Quoted 2 lines · Arvind Sankar
Pre-2.23 binutils makes symbols defined outside sections absolute, so these two symbols break the build on old linkers.
-ENOTENOUGHINFOWhich old linkers, how exactly do they break the build, etc etc?
Please give exact reproduction steps.
Quoted 7 lines
Quoted 2 lines
Thx.
binutils-2.21 and -2.22. An x86-64 defconfig will fail with
Invalid absoluteR_X86_64_32Srelocation:_etext
and after fixing that one, with
Invalid absoluteR_X86_64_32Srelocation:__end_of_kernel_reserveI'm still not clear as to why this happens. I tried reproducing on openSUSE 12.1 which has
Repository: openSUSE-12.1-Oss
Name: binutils
Version: 2.21.1-12.1.4and the build there fails with:
objdump:
arch/x86/lib/clear_page_64.o: File format not recognized
objdump:arch/x86/lib/cmdline.o: File format not recognized
objdump:arch/x86/lib/cmpxchg16b_emu.o: File format not recognized
objdump:arch/x86/lib/copy_page_64.o: File format not recognized
objdump:arch/x86/lib/copy_user_64.o: File format not recognized
objdump:arch/x86/lib/cpu.o: File format not recognized
...
Quoted 4 lines
and objdump is part of binutils.
Now, this looks like another symptom of what you're reporting but what we're missing is the rootcause about *why* this happens.
I tried out OpenSUSE 12.1 in a VM, and this one seems to be related to something that changes in the build when libelf-devel is installed. Deleting that package and switching UNWINDER_ORC (which says it requires libelf-devel) to UNWINDER_FRAME_POINTER builds without the file format errors.
Quoted 16 lines
Because if the issue is hard to fix or similar, then we probably should raise the minimum supported binutils version from 2.21 to something newer and not do this fix.
But before we do that, we need a proper analysis as to why it happens.
Also, what distro are you using to reproduce it on?
Thx.
Signature · 4 lines
Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette
Quoted 9 lines · Borislav Petkov
Quoted 2 lines · Arvind Sankar
Pre-2.23 binutils makes symbols defined outside sections absolute, so these two symbols break the build on old linkers.
-ENOTENOUGHINFOWhich old linkers, how exactly do they break the build, etc etc?
Please give exact reproduction steps.
Mauro (now CCed) ran into this too, but on 32-bit builds only with older binutils. I hadn't set up an environment to try to reproduce it yet, but it seems like this patch would fix it. Mauro can you test this? Does it fix it for you too?
https://lore.kernel.org/lkml/[email protected]/
-Kees
Signature · 1 line
Kees Cook
A message that is not in the archive (sent off-list or not yet received): CAEQFVGa4fksPRtiLtBckSgbJY_JSHr07hoy5+5w-pAYym16YVg@mail.gmail.com
PATCH 1/1 x86/tools/relocs: Add _etext and __end_of_kernel_reserve to S_REL
Message resent as plain text to [email protected] because of rejection of previous message
---------- Forwarded message ---------
From: Mauro Rossi <[email protected]>
Date: Sat, Jan 11, 2020 at 8:36 PM
Subject: Re: [PATCH] x86/tools/relocs: Add _etext and __end_of_kernel_reserve to S_REL
To: Kees Cook <[email protected]>
Cc: Borislav Petkov <[email protected]>, Arvind Sankar <[email protected]>, Thomas Gleixner <[email protected]>, Ingo Molnar <[email protected]>, H. Peter Anvin <[email protected]>, <[email protected]>, Linux Kernel Mailing List <[email protected]>, Thomas Lendacky <[email protected]>
Hello Kees,
Quoted 12 lines · Kees Cook
Quoted 9 lines · Borislav Petkov
Quoted 2 lines · Arvind Sankar
Pre-2.23 binutils makes symbols defined outside sections absolute, so these two symbols break the build on old linkers.
-ENOTENOUGHINFOWhich old linkers, how exactly do they break the build, etc etc?
Please give exact reproduction steps.
Quoted 8 lines
Mauro (now CCed) ran into this too, but on 32-bit builds only with older binutils. I hadn't set up an environment to try to reproduce it yet, but it seems like this patch would fix it. Mauro can you test this? Does it fix it for you too?
https://lore.kernel.org/lkml/[email protected]/
-Kees
The patch solves the issue with Android build of 32bit kernel, I don't see 'Invalid absolute R_386_32 relocation' errors anymore.
Thanks a lot!
Mauro