linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] x86: Warn on orphan section placement
@ 2020-06-22 20:53 Kees Cook
  2020-06-22 20:53 ` [PATCH v2 1/3] vmlinux.lds.h: Add .gnu.version* to DISCARDS Kees Cook
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Kees Cook @ 2020-06-22 20:53 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: Kees Cook, Thomas Gleixner, Ingo Molnar, x86, Arnd Bergmann,
	Nick Desaulniers, Nathan Chancellor, clang-built-linux,
	linux-arch, linux-kernel

v2:
- split by architecture, rebase to v5.8-rc2
v1: https://lore.kernel.org/lkml/20200228002244.15240-1-keescook@chromium.org/

A recent bug[1] was solved for builds linked with ld.lld, and tracking
it down took way longer than it needed to (a year). Ultimately, it
boiled down to differences between ld.bfd and ld.lld's handling of
orphan sections. Similarly, the recent FGKASLR series brough up orphan
section handling too[2]. In both cases, it would have been nice if the
linker was running with --orphan-handling=warn so that surprise sections
wouldn't silently get mapped into the kernel image at locations up to the
whim of the linker's orphan handling logic. Instead, all desired sections
should be explicitly identified in the linker script (to be either kept or
discarded) with any orphans throwing a warning. The powerpc architecture
actually already does this, so this series extends coverage to x86.

Thanks!

-Kees

[1] https://github.com/ClangBuiltLinux/linux/issues/282
[2] https://lore.kernel.org/lkml/202002242122.AA4D1B8@keescook/

Kees Cook (3):
  vmlinux.lds.h: Add .gnu.version* to DISCARDS
  x86/build: Warn on orphan section placement
  x86/boot: Warn on orphan section placement

 arch/x86/Makefile                      |  4 ++++
 arch/x86/boot/compressed/Makefile      |  3 ++-
 arch/x86/boot/compressed/vmlinux.lds.S | 11 +++++++++++
 arch/x86/kernel/vmlinux.lds.S          |  6 ++++++
 include/asm-generic/vmlinux.lds.h      |  1 +
 5 files changed, 24 insertions(+), 1 deletion(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2020-06-22 23:30 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-22 20:53 [PATCH v2 0/3] x86: Warn on orphan section placement Kees Cook
2020-06-22 20:53 ` [PATCH v2 1/3] vmlinux.lds.h: Add .gnu.version* to DISCARDS Kees Cook
2020-06-22 22:00   ` Fangrui Song
2020-06-22 22:09     ` Kees Cook
2020-06-22 22:27     ` Kees Cook
2020-06-22 22:52       ` Fangrui Song
2020-06-22 22:57         ` Kees Cook
2020-06-22 23:04           ` Fāng-ruì Sòng
2020-06-22 23:30             ` Kees Cook
2020-06-22 20:53 ` [PATCH v2 2/3] x86/build: Warn on orphan section placement Kees Cook
2020-06-22 20:53 ` [PATCH v2 3/3] x86/boot: " Kees Cook
2020-06-22 22:06   ` Fangrui Song
2020-06-22 22:35     ` Kees Cook
2020-06-22 22:43     ` Kees Cook
2020-06-22 22:49       ` Fangrui Song
2020-06-22 23:00         ` Kees Cook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).