path: root/arch/parisc/include/asm
diff options
authorKees Cook <>2016-02-17 14:41:15 -0800
committerIngo Molnar <>2016-02-22 08:51:38 +0100
commitc74ba8b3480da6ddaea17df2263ec09b869ac496 (patch)
tree140a306921102302d7358432a90334ee028122d5 /arch/parisc/include/asm
parent9ccaf77cf05915f51231d158abfd5448aedde758 (diff)
arch: Introduce post-init read-only memory
One of the easiest ways to protect the kernel from attack is to reduce the internal attack surface exposed when a "write" flaw is available. By making as much of the kernel read-only as possible, we reduce the attack surface. Many things are written to only during __init, and never changed again. These cannot be made "const" since the compiler will do the wrong thing (we do actually need to write to them). Instead, move these items into a memory region that will be made read-only during mark_rodata_ro() which happens after all kernel __init code has finished. This introduces __ro_after_init as a way to mark such memory, and adds some documentation about the existing __read_mostly marking. This improves the security of the Linux kernel by marking formerly read-write memory regions as read-only on a fully booted up system. Based on work by PaX Team and Brad Spengler. Signed-off-by: Kees Cook <> Cc: Andy Lutomirski <> Cc: Arnd Bergmann <> Cc: Borislav Petkov <> Cc: Brad Spengler <> Cc: Brian Gerst <> Cc: David Brown <> Cc: Denys Vlasenko <> Cc: Emese Revfy <> Cc: H. Peter Anvin <> Cc: Linus Torvalds <> Cc: Mathias Krause <> Cc: Michael Ellerman <> Cc: PaX Team <> Cc: Peter Zijlstra <> Cc: Thomas Gleixner <> Cc: Cc: linux-arch <> Link: Signed-off-by: Ingo Molnar <>
Diffstat (limited to 'arch/parisc/include/asm')
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/parisc/include/asm/cache.h b/arch/parisc/include/asm/cache.h
index 3d0e17bcc8e9..df0f52bd18b4 100644
--- a/arch/parisc/include/asm/cache.h
+++ b/arch/parisc/include/asm/cache.h
@@ -22,6 +22,9 @@
#define __read_mostly __attribute__((__section__(".data..read_mostly")))
+/* Read-only memory is marked before mark_rodata_ro() is called. */
+#define __ro_after_init __read_mostly
void parisc_cache_init(void); /* initializes cache-flushing */
void disable_sr_hashing_asm(int); /* low level support for above */
void disable_sr_hashing(void); /* turns off space register hashing */