Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

asm-generic: Consolidate mark_rodata_ro()

Instead of defining mark_rodata_ro() in each architecture, consolidate it.

Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Will Deacon <will.deacon@arm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Gross <agross@codeaurora.org>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Ashok Kumar <ashoks@broadcom.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Borislav Petkov <bp@suse.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: David Brown <david.brown@linaro.org>
Cc: David Hildenbrand <dahi@linux.vnet.ibm.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: Emese Revfy <re.emese@gmail.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Helge Deller <deller@gmx.de>
Cc: James E.J. Bottomley <jejb@parisc-linux.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Luis R. Rodriguez <mcgrof@suse.com>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mathias Krause <minipli@googlemail.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Nicolas Pitre <nicolas.pitre@linaro.org>
Cc: PaX Team <pageexec@freemail.hu>
Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Stephen Boyd <sboyd@codeaurora.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Toshi Kani <toshi.kani@hp.com>
Cc: kernel-hardening@lists.openwall.com
Cc: linux-arch <linux-arch@vger.kernel.org>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-parisc@vger.kernel.org
Link: http://lkml.kernel.org/r/1455748879-21872-2-git-send-email-keescook@chromium.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>

authored by

Kees Cook and committed by
Ingo Molnar
e267d97b 81f70ba2

+4 -10
-1
arch/arm/include/asm/cacheflush.h
··· 491 491 #endif 492 492 493 493 #ifdef CONFIG_DEBUG_RODATA 494 - void mark_rodata_ro(void); 495 494 void set_kernel_text_rw(void); 496 495 void set_kernel_text_ro(void); 497 496 #else
-4
arch/arm64/include/asm/cacheflush.h
··· 156 156 int set_memory_x(unsigned long addr, int numpages); 157 157 int set_memory_nx(unsigned long addr, int numpages); 158 158 159 - #ifdef CONFIG_DEBUG_RODATA 160 - void mark_rodata_ro(void); 161 - #endif 162 - 163 159 #endif
-4
arch/parisc/include/asm/cacheflush.h
··· 121 121 } 122 122 } 123 123 124 - #ifdef CONFIG_DEBUG_RODATA 125 - void mark_rodata_ro(void); 126 - #endif 127 - 128 124 #include <asm/kmap_types.h> 129 125 130 126 #define ARCH_HAS_KMAP
-1
arch/x86/include/asm/cacheflush.h
··· 92 92 #define mmio_flush_range(addr, size) clflush_cache_range(addr, size) 93 93 94 94 #ifdef CONFIG_DEBUG_RODATA 95 - void mark_rodata_ro(void); 96 95 extern const int rodata_test_data; 97 96 extern int kernel_set_to_readonly; 98 97 void set_kernel_text_rw(void);
+4
include/linux/init.h
··· 142 142 void __init load_default_modules(void); 143 143 int __init init_rootfs(void); 144 144 145 + #ifdef CONFIG_DEBUG_RODATA 146 + void mark_rodata_ro(void); 147 + #endif 148 + 145 149 extern void (*late_time_init)(void); 146 150 147 151 extern bool initcall_debug;