[tip: x86/build] vmlinux.lds.h: Allow EXCEPTION_TABLE to live in RO_DATA

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


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

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

vmlinux.lds.h: Allow EXCEPTION_TABLE to live in RO_DATA

Many architectures have an EXCEPTION_TABLE that needs to be only
readable. As such, it should live in RO_DATA. Create a macro to identify
this case for the architectures that can move EXCEPTION_TABLE into
RO_DATA.

Signed-off-by: Kees Cook <keescook at chromium.org>
Signed-off-by: Borislav Petkov <bp at suse.de>
Acked-by: Will Deacon <will at kernel.org>
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: linuxppc-dev at lists.ozlabs.org
Cc: linux-s390 at vger.kernel.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: x86-ml <x86 at kernel.org>
Cc: Yoshinori Sato <ysato at users.sourceforge.jp>
Link: https://lkml.kernel.org/r/20191029211351.13243-15-keescook@chromium.org
---
 include/asm-generic/vmlinux.lds.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 356078e..9867d8e 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -69,6 +69,17 @@
 #define NOTES_HEADERS_RESTORE
 #endif
 
+/*
+ * Some architectures have non-executable read-only exception tables.
+ * They can be added to the RO_DATA segment by specifying their desired
+ * alignment.
+ */
+#ifdef RO_EXCEPTION_TABLE_ALIGN
+#define RO_EXCEPTION_TABLE	EXCEPTION_TABLE(RO_EXCEPTION_TABLE_ALIGN)
+#else
+#define RO_EXCEPTION_TABLE
+#endif
+
 /* Align . to a 8 byte boundary equals to maximum function alignment. */
 #define ALIGN_FUNCTION()  . = ALIGN(8)
 
@@ -513,6 +524,7 @@
 		__stop___modver = .;					\
 	}								\
 									\
+	RO_EXCEPTION_TABLE						\
 	NOTES								\
 									\
 	. = ALIGN((align));						\


More information about the Linuxppc-dev mailing list