[tip: x86/build] x86/vmlinux: Restore "text" Program Header with dummy section

tip-bot2 for Kees Cook tip-bot2 at linutronix.de
Tue Nov 5 20:27:34 AEDT 2019


The following commit has been merged into the x86/build branch of tip:

Commit-ID:     7a42d41d9dc2829bdf589db855ce3f948de2da6b
Gitweb:        https://git.kernel.org/tip/7a42d41d9dc2829bdf589db855ce3f948de2da6b
Author:        Kees Cook <keescook at chromium.org>
AuthorDate:    Tue, 29 Oct 2019 14:13:29 -07:00
Committer:     Borislav Petkov <bp at suse.de>
CommitterDate: Mon, 04 Nov 2019 15:34:36 +01:00

x86/vmlinux: Restore "text" Program Header with dummy section

In a linker script, if one places a section in one or more segments using
":PHDR", then the linker will place all subsequent allocatable sections,
which do not specify ":PHDR", into the same segments. In order to have
the NOTES section in both PT_LOAD (":text") and PT_NOTE (":note"), both
segments are marked, and the only way to undo this to keep subsequent
sections out of PT_NOTE is to mark the following section with just the
single desired PT_LOAD (":text").

In preparation for having a common NOTES macro, perform the segment
assignment using a dummy section (as done by other architectures).

Signed-off-by: Kees Cook <keescook at chromium.org>
Signed-off-by: Borislav Petkov <bp at suse.de>
Cc: Andy Lutomirski <luto at kernel.org>
Cc: Arnd Bergmann <arnd at arndb.de>
Cc: Dave Hansen <dave.hansen at linux.intel.com>
Cc: linux-alpha at vger.kernel.org
Cc: linux-arch at vger.kernel.org
Cc: linux-arm-kernel at lists.infradead.org
Cc: linux-c6x-dev at linux-c6x.org
Cc: linux-ia64 at vger.kernel.org
Cc: linux-s390 at vger.kernel.org
Cc: linuxppc-dev at lists.ozlabs.org
Cc: Michael Ellerman <mpe at ellerman.id.au>
Cc: Michal Simek <monstr at monstr.eu>
Cc: Rick Edgecombe <rick.p.edgecombe at intel.com>
Cc: Segher Boessenkool <segher at kernel.crashing.org>
Cc: Will Deacon <will at kernel.org>
Cc: Yoshinori Sato <ysato at users.sourceforge.jp>
Cc: x86-ml <x86 at kernel.org>
Link: https://lkml.kernel.org/r/20191029211351.13243-8-keescook@chromium.org
---
 arch/x86/kernel/vmlinux.lds.S | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S
index e2feacf..788e789 100644
--- a/arch/x86/kernel/vmlinux.lds.S
+++ b/arch/x86/kernel/vmlinux.lds.S
@@ -147,8 +147,9 @@ SECTIONS
 	} :text = 0x9090
 
 	NOTES :text :note
+	.dummy : { *(.dummy) } :text
 
-	EXCEPTION_TABLE(16) :text = 0x9090
+	EXCEPTION_TABLE(16)
 
 	/* .text should occupy whole number of pages */
 	. = ALIGN(PAGE_SIZE);


More information about the Linuxppc-dev mailing list