x86/boot: Discard .discard.unreachable for arch/x86/boot/compressed/vmlinux
PATCH 1/1 x86/boot: Discard .discard.unreachable for arch/x86/boot/compressed/vmlinux
In the latest efi tree, ce5e3f909fc0ed67e58367b9c56a54c20a51080b "efi/printf: Add 64-bit and 8-bit integer support", arch/x86/boot/compressed/vmlinux may have an undesired .discard.unreachable section from drivers/firmware/efi/libstub/vsprintf.stub.o
.discard.unreachable contains an R_X86_64_PC32 relocation, which will be warned by LLD: a non-SHF_ALLOC section (.discard.unreachable) is not part of the memory image, thus conceptually the distance between a non-SHF_ALLOC and a SHF_ALLOC is not a constant which can be resolved at link time.
% ld.lld -m elf_x86_64 -T arch/x86/boot/compressed/vmlinux.lds ... -o arch/x86/boot/compressed/vmlinux ld.lld: warning: vsprintf.c:(.discard.unreachable+0x0): has non-ABS relocation R_X86_64_PC32 against symbol ''
Reuse the DISCARDS macro which includes .discard.* to drop .discard.unreachable
--- arch/x86/boot/compressed/vmlinux.lds.S | 2 ++ 1 file changed, 2 insertions(+)
arch/x86/boot/compressed/vmlinux.lds.S +2 -0
@@ -74,4 +74,6 @@ SECTIONS #endif . = ALIGN(PAGE_SIZE); /* keep ZO size page aligned */ _end = .; + + DISCARDS }
Signature · 1 line
2.26.2.761.g0e0b3e54be-goog
Quoted 36 lines · Fangrui Song
In the latest efi tree,
ce5e3f909fc0ed67e58367b9c56a54c20a51080b"efi/printf: Add 64-bit and 8-bit integer support",arch/x86/boot/compressed/vmlinuxmay have an undesired .discard.unreachable section fromdrivers/firmware/efi/libstub/vsprintf.stub.o.discard.unreachable contains an
R_X86_64_PC32relocation, which will be warned by LLD: a non-SHF_ALLOC section (.discard.unreachable) is not part of the memory image, thus conceptually the distance between a non-SHF_ALLOC and aSHF_ALLOCis not a constant which can be resolved at link time.% ld.lld -m
elf_x86_64-Tarch/x86/boot/compressed/vmlinux.lds... -oarch/x86/boot/compressed/vmlinuxld.lld: warning: vsprintf.c:(.discard.unreachable+0x0): has non-ABS relocationR_X86_64_PC32against symbol ''Reuse the DISCARDS macro which includes .discard.* to drop .discard.unreachable
Reported-by kbuild test robot <[email protected]>Signed-off-by Fangrui Song <[email protected]>--- arch/x86/boot/compressed/vmlinux.lds.S | 2 ++ 1 file changed, 2 insertions(+)arch/x86/boot/compressed/vmlinux.lds.S +2
-0@@ -74,4 +74,6 @@ SECTIONS #endif . = ALIGN(PAGE_SIZE); /* keep ZO size page aligned */ _end = .; + + DISCARDS }Signature · 1 line
2.26.2.761.g0e0b3e54be-goog
Thanks! Maybe add a note in the commit message that the section is generated from unreachable() annotations when CONFIG_STACK_VALIDATION is enabled.
Quoted 11 lines · Fangrui Song' via Clang Built Linux
In the latest efi tree,
ce5e3f909fc0ed67e58367b9c56a54c20a51080b"efi/printf: Add 64-bit and 8-bit integer support",arch/x86/boot/compressed/vmlinuxmay have an undesired .discard.unreachable section fromdrivers/firmware/efi/libstub/vsprintf.stub.o.discard.unreachable contains an
R_X86_64_PC32relocation, which will be warned by LLD: a non-SHF_ALLOC section (.discard.unreachable) is not part of the memory image, thus conceptually the distance between a non-SHF_ALLOC and aSHF_ALLOCis not a constant which can be resolved at link time.
Quoted 7 lines
% ld.lld -m
elf_x86_64-Tarch/x86/boot/compressed/vmlinux.lds... -oarch/x86/boot/compressed/vmlinuxld.lld: warning: vsprintf.c:(.discard.unreachable+0x0): has non-ABS relocationR_X86_64_PC32against symbol ''Reuse the DISCARDS macro which includes .discard.* to drop .discard.unreachable
Reported-by kbuild test robot <[email protected]>Signed-off-by Fangrui Song <[email protected]>
Yay macro usage! :)
Signature · 1 line
Kees Cook
Sedat Dilek
Tested-byQuoted 16 lines · Kees Cook
Quoted 14 lines · Fangrui Song' via Clang Built Linux
In the latest efi tree,
ce5e3f909fc0ed67e58367b9c56a54c20a51080b"efi/printf: Add 64-bit and 8-bit integer support",arch/x86/boot/compressed/vmlinuxmay have an undesired .discard.unreachable section fromdrivers/firmware/efi/libstub/vsprintf.stub.o.discard.unreachable contains an
R_X86_64_PC32relocation, which will be warned by LLD: a non-SHF_ALLOC section (.discard.unreachable) is not part of the memory image, thus conceptually the distance between a non-SHF_ALLOC and aSHF_ALLOCis not a constant which can be resolved at link time.% ld.lld -m
elf_x86_64-Tarch/x86/boot/compressed/vmlinux.lds... -oarch/x86/boot/compressed/vmlinuxld.lld: warning: vsprintf.c:(.discard.unreachable+0x0): has non-ABS relocationR_X86_64_PC32against symbol ''
Quoted 9 lines
Quoted 4 lines
Reuse the DISCARDS macro which includes .discard.* to drop .discard.unreachable
Reported-by kbuild test robot <[email protected]>Signed-off-by Fangrui Song <[email protected]>Yay macro usage! :)
Reviewed-by Kees Cook <[email protected]>
Feel free to add...
Linux v5.7-rc6+ with Clang and LLD v10.0.1-rc1
...together with one more patches in the x86/boot area:
x86/boot: Correct relocation destination on old linkers
Next run will include:
x86/boot: Add .text.startup to setup.ld (v2)
- Sedat -
[1] https://github.com/llvm/llvm-project/releases/tag/llvmorg-10.0.1-rc1
Ard Biesheuvel
maintainerQuoted 37 lines · Sedat Dilek
Quoted 16 lines · Kees Cook
Quoted 14 lines · Fangrui Song' via Clang Built Linux
In the latest efi tree,
ce5e3f909fc0ed67e58367b9c56a54c20a51080b"efi/printf: Add 64-bit and 8-bit integer support",arch/x86/boot/compressed/vmlinuxmay have an undesired .discard.unreachable section fromdrivers/firmware/efi/libstub/vsprintf.stub.o.discard.unreachable contains an
R_X86_64_PC32relocation, which will be warned by LLD: a non-SHF_ALLOC section (.discard.unreachable) is not part of the memory image, thus conceptually the distance between a non-SHF_ALLOC and aSHF_ALLOCis not a constant which can be resolved at link time.% ld.lld -m
elf_x86_64-Tarch/x86/boot/compressed/vmlinux.lds... -oarch/x86/boot/compressed/vmlinuxld.lld: warning: vsprintf.c:(.discard.unreachable+0x0): has non-ABS relocationR_X86_64_PC32against symbol ''Quoted 9 lines
Quoted 4 lines
Reuse the DISCARDS macro which includes .discard.* to drop .discard.unreachable
Reported-by kbuild test robot <[email protected]>Signed-off-by Fangrui Song <[email protected]>Yay macro usage! :)
Reviewed-by Kees Cook <[email protected]>Feel free to add...
Linux v5.7-rc6+ with Clang and LLD v10.0.1-rc1
...together with one more patches in the x86/boot area:
x86/boot: Correct relocation destination on old linkers
Quoted 7 lines
Next run will include:
x86/boot: Add .text.startup to setup.ld (v2)
- Sedat -
[1] https://github.com/llvm/llvm-project/releases/tag/llvmorg-10.0.1-rc1
Thanks, I'll queue this up.
Quoted 41 lines · Ard Biesheuvel
Quoted 39 lines · Sedat Dilek
Quoted 16 lines · Kees Cook
Quoted 14 lines · Fangrui Song' via Clang Built Linux
In the latest efi tree,
ce5e3f909fc0ed67e58367b9c56a54c20a51080b"efi/printf: Add 64-bit and 8-bit integer support",arch/x86/boot/compressed/vmlinuxmay have an undesired .discard.unreachable section fromdrivers/firmware/efi/libstub/vsprintf.stub.o.discard.unreachable contains an
R_X86_64_PC32relocation, which will be warned by LLD: a non-SHF_ALLOC section (.discard.unreachable) is not part of the memory image, thus conceptually the distance between a non-SHF_ALLOC and aSHF_ALLOCis not a constant which can be resolved at link time.% ld.lld -m
elf_x86_64-Tarch/x86/boot/compressed/vmlinux.lds... -oarch/x86/boot/compressed/vmlinuxld.lld: warning: vsprintf.c:(.discard.unreachable+0x0): has non-ABS relocationR_X86_64_PC32against symbol ''Quoted 9 lines
Quoted 4 lines
Reuse the DISCARDS macro which includes .discard.* to drop .discard.unreachable
Reported-by kbuild test robot <[email protected]>Signed-off-by Fangrui Song <[email protected]>Yay macro usage! :)
Reviewed-by Kees Cook <[email protected]>Feel free to add...
Linux v5.7-rc6+ with Clang and LLD v10.0.1-rc1
...together with one more patches in the x86/boot area:
x86/boot: Correct relocation destination on old linkers
Next run will include:
Quoted 7 lines
Quoted 5 lines
x86/boot: Add .text.startup to setup.ld (v2)
- Sedat -
[1] https://github.com/llvm/llvm-project/releases/tag/llvmorg-10.0.1-rc1
Thanks, I'll queue this up.
Just FYI:
It's in tip.git#x86/build already.
- Sedat -
Ard Biesheuvel
maintainerQuoted 49 lines · Sedat Dilek
Quoted 47 lines · Ard Biesheuvel
Quoted 44 lines · Sedat Dilek
Quoted 16 lines · Kees Cook
Quoted 14 lines · Fangrui Song' via Clang Built Linux
In the latest efi tree,
ce5e3f909fc0ed67e58367b9c56a54c20a51080b"efi/printf: Add 64-bit and 8-bit integer support",arch/x86/boot/compressed/vmlinuxmay have an undesired .discard.unreachable section fromdrivers/firmware/efi/libstub/vsprintf.stub.o.discard.unreachable contains an
R_X86_64_PC32relocation, which will be warned by LLD: a non-SHF_ALLOC section (.discard.unreachable) is not part of the memory image, thus conceptually the distance between a non-SHF_ALLOC and aSHF_ALLOCis not a constant which can be resolved at link time.% ld.lld -m
elf_x86_64-Tarch/x86/boot/compressed/vmlinux.lds... -oarch/x86/boot/compressed/vmlinuxld.lld: warning: vsprintf.c:(.discard.unreachable+0x0): has non-ABS relocationR_X86_64_PC32against symbol ''Quoted 9 lines
Quoted 4 lines
Reuse the DISCARDS macro which includes .discard.* to drop .discard.unreachable
Reported-by kbuild test robot <[email protected]>Signed-off-by Fangrui Song <[email protected]>Yay macro usage! :)
Reviewed-by Kees Cook <[email protected]>Feel free to add...
Linux v5.7-rc6+ with Clang and LLD v10.0.1-rc1
...together with one more patches in the x86/boot area:
x86/boot: Correct relocation destination on old linkers
Next run will include:
x86/boot: Add .text.startup to setup.ld (v2)
- Sedat -
[1] https://github.com/llvm/llvm-project/releases/tag/llvmorg-10.0.1-rc1
Quoted 8 lines
Quoted 1 line
Thanks, I'll queue this up.
Just FYI:
It's in tip.git#x86/build already.- Sedat -
Thanks for the head's up. I'll remove it from my branch again.
The following commit has been merged into the x86/build branch of tip:
The following commit has been merged into the x86/build branch of tip:
Commit-ID: d6ee6529436a15a0541aff6e1697989ee7dc2c44 Gitweb: https://git.kernel.org/tip/d6ee6529436a15a0541aff6e1697989ee7dc2c44 Author: Fangrui Song <[email protected]> AuthorDate: Wed, 20 May 2020 11:20:10 -07:00 Committer: Borislav Petkov <[email protected]> CommitterDate: Fri, 22 May 2020 12:42:07 +02:00
x86/boot: Discard .discard.unreachable for arch/x86/boot/compressed/vmlinux
With commit
ce5e3f909fc0 ("efi/printf: Add 64-bit and 8-bit integer support")
arch/x86/boot/compressed/vmlinux may have an undesired .discard.unreachable section coming from drivers/firmware/efi/libstub/vsprintf.stub.o. That section gets generated from unreachable() annotations when CONFIG_STACK_VALIDATION is enabled.
.discard.unreachable contains an R_X86_64_PC32 relocation which will be warned about by LLD: a non-SHF_ALLOC section (.discard.unreachable) is not part of the memory image, thus conceptually the distance between a non-SHF_ALLOC and a SHF_ALLOC is not a constant which can be resolved at link time:
% ld.lld -m elf_x86_64 -T arch/x86/boot/compressed/vmlinux.lds ... -o arch/x86/boot/compressed/vmlinux ld.lld: warning: vsprintf.c:(.discard.unreachable+0x0): has non-ABS relocation R_X86_64_PC32 against symbol ''
Reuse the DISCARDS macro which includes .discard.* to drop .discard.unreachable.
[ bp: Massage and complete the commit message. ]
--- arch/x86/boot/compressed/vmlinux.lds.S | 2 ++ 1 file changed, 2 insertions(+)
arch/x86/boot/compressed/vmlinux.lds.S +2 -0
@@ -73,4 +73,6 @@ SECTIONS #endif . = ALIGN(PAGE_SIZE); /* keep ZO size page aligned */ _end = .; + + DISCARDS }