summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaura Abbott <labbott@redhat.com>2017-02-06 19:31:58 -0500
committerKees Cook <keescook@chromium.org>2017-02-07 15:32:52 -0500
commit0f5bf6d0afe4be6e1391908ff2d6dc9730e91550 (patch)
tree12c10057175483fe3f3720b37b7ffb5b73241b2a
parentad21fc4faa2a1f919bac1073b885df9310dbc581 (diff)
arch: Rename CONFIG_DEBUG_RODATA and CONFIG_DEBUG_MODULE_RONX
Both of these options are poorly named. The features they provide are necessary for system security and should not be considered debug only. Change the names to CONFIG_STRICT_KERNEL_RWX and CONFIG_STRICT_MODULE_RWX to better describe what these options do. Signed-off-by: Laura Abbott <labbott@redhat.com> Acked-by: Jessica Yu <jeyu@redhat.com> Signed-off-by: Kees Cook <keescook@chromium.org>
-rw-r--r--Documentation/DocBook/kgdb.tmpl8
-rw-r--r--Documentation/security/self-protection.txt4
-rw-r--r--arch/Kconfig4
-rw-r--r--arch/arm/configs/aspeed_g4_defconfig4
-rw-r--r--arch/arm/configs/aspeed_g5_defconfig4
-rw-r--r--arch/arm/include/asm/cacheflush.h2
-rw-r--r--arch/arm/kernel/patch.c4
-rw-r--r--arch/arm/kernel/vmlinux.lds.S8
-rw-r--r--arch/arm/mm/Kconfig2
-rw-r--r--arch/arm/mm/init.c4
-rw-r--r--arch/arm64/Kconfig.debug2
-rw-r--r--arch/arm64/kernel/insn.c2
-rw-r--r--arch/parisc/configs/712_defconfig1
-rw-r--r--arch/parisc/configs/c3000_defconfig1
-rw-r--r--arch/parisc/mm/init.c2
-rw-r--r--include/linux/filter.h4
-rw-r--r--include/linux/init.h4
-rw-r--r--include/linux/module.h2
-rw-r--r--init/main.c4
-rw-r--r--kernel/configs/android-recommended.config2
-rw-r--r--kernel/module.c6
-rw-r--r--kernel/power/hibernate.c2
-rw-r--r--kernel/power/power.h4
-rw-r--r--kernel/power/snapshot.c4
24 files changed, 41 insertions, 43 deletions
diff --git a/Documentation/DocBook/kgdb.tmpl b/Documentation/DocBook/kgdb.tmpl
index f3abca7ec53d..856ac20bf367 100644
--- a/Documentation/DocBook/kgdb.tmpl
+++ b/Documentation/DocBook/kgdb.tmpl
@@ -115,12 +115,12 @@
115 </para> 115 </para>
116 <para> 116 <para>
117 If the architecture that you are using supports the kernel option 117 If the architecture that you are using supports the kernel option
118 CONFIG_DEBUG_RODATA, you should consider turning it off. This 118 CONFIG_STRICT_KERNEL_RWX, you should consider turning it off. This
119 option will prevent the use of software breakpoints because it 119 option will prevent the use of software breakpoints because it
120 marks certain regions of the kernel's memory space as read-only. 120 marks certain regions of the kernel's memory space as read-only.
121 If kgdb supports it for the architecture you are using, you can 121 If kgdb supports it for the architecture you are using, you can
122 use hardware breakpoints if you desire to run with the 122 use hardware breakpoints if you desire to run with the
123 CONFIG_DEBUG_RODATA option turned on, else you need to turn off 123 CONFIG_STRICT_KERNEL_RWX option turned on, else you need to turn off
124 this option. 124 this option.
125 </para> 125 </para>
126 <para> 126 <para>
@@ -135,7 +135,7 @@
135 <para>Here is an example set of .config symbols to enable or 135 <para>Here is an example set of .config symbols to enable or
136 disable for kgdb: 136 disable for kgdb:
137 <itemizedlist> 137 <itemizedlist>
138 <listitem><para># CONFIG_DEBUG_RODATA is not set</para></listitem> 138 <listitem><para># CONFIG_STRICT_KERNEL_RWX is not set</para></listitem>
139 <listitem><para>CONFIG_FRAME_POINTER=y</para></listitem> 139 <listitem><para>CONFIG_FRAME_POINTER=y</para></listitem>
140 <listitem><para>CONFIG_KGDB=y</para></listitem> 140 <listitem><para>CONFIG_KGDB=y</para></listitem>
141 <listitem><para>CONFIG_KGDB_SERIAL_CONSOLE=y</para></listitem> 141 <listitem><para>CONFIG_KGDB_SERIAL_CONSOLE=y</para></listitem>
@@ -166,7 +166,7 @@
166 </para> 166 </para>
167 <para>Here is an example set of .config symbols to enable/disable kdb: 167 <para>Here is an example set of .config symbols to enable/disable kdb:
168 <itemizedlist> 168 <itemizedlist>
169 <listitem><para># CONFIG_DEBUG_RODATA is not set</para></listitem> 169 <listitem><para># CONFIG_STRICT_KERNEL_RWX is not set</para></listitem>
170 <listitem><para>CONFIG_FRAME_POINTER=y</para></listitem> 170 <listitem><para>CONFIG_FRAME_POINTER=y</para></listitem>
171 <listitem><para>CONFIG_KGDB=y</para></listitem> 171 <listitem><para>CONFIG_KGDB=y</para></listitem>
172 <listitem><para>CONFIG_KGDB_SERIAL_CONSOLE=y</para></listitem> 172 <listitem><para>CONFIG_KGDB_SERIAL_CONSOLE=y</para></listitem>
diff --git a/Documentation/security/self-protection.txt b/Documentation/security/self-protection.txt
index f41dd00e8b98..141acfebe6ef 100644
--- a/Documentation/security/self-protection.txt
+++ b/Documentation/security/self-protection.txt
@@ -51,8 +51,8 @@ kernel, they are implemented in a way where the memory is temporarily
51made writable during the update, and then returned to the original 51made writable during the update, and then returned to the original
52permissions.) 52permissions.)
53 53
54In support of this are (the poorly named) CONFIG_DEBUG_RODATA and 54In support of this are CONFIG_STRICT_KERNEL_RWX and
55CONFIG_DEBUG_SET_MODULE_RONX, which seek to make sure that code is not 55CONFIG_STRICT_MODULE_RWX, which seek to make sure that code is not
56writable, data is not executable, and read-only data is neither writable 56writable, data is not executable, and read-only data is neither writable
57nor executable. 57nor executable.
58 58
diff --git a/arch/Kconfig b/arch/Kconfig
index 3f8b8be3036f..33f5a555c32a 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -790,7 +790,7 @@ config ARCH_OPTIONAL_KERNEL_RWX_DEFAULT
790config ARCH_HAS_STRICT_KERNEL_RWX 790config ARCH_HAS_STRICT_KERNEL_RWX
791 def_bool n 791 def_bool n
792 792
793config DEBUG_RODATA 793config STRICT_KERNEL_RWX
794 bool "Make kernel text and rodata read-only" if ARCH_OPTIONAL_KERNEL_RWX 794 bool "Make kernel text and rodata read-only" if ARCH_OPTIONAL_KERNEL_RWX
795 depends on ARCH_HAS_STRICT_KERNEL_RWX 795 depends on ARCH_HAS_STRICT_KERNEL_RWX
796 default !ARCH_OPTIONAL_KERNEL_RWX || ARCH_OPTIONAL_KERNEL_RWX_DEFAULT 796 default !ARCH_OPTIONAL_KERNEL_RWX || ARCH_OPTIONAL_KERNEL_RWX_DEFAULT
@@ -806,7 +806,7 @@ config DEBUG_RODATA
806config ARCH_HAS_STRICT_MODULE_RWX 806config ARCH_HAS_STRICT_MODULE_RWX
807 def_bool n 807 def_bool n
808 808
809config DEBUG_SET_MODULE_RONX 809config STRICT_MODULE_RWX
810 bool "Set loadable kernel module data as NX and text as RO" if ARCH_OPTIONAL_KERNEL_RWX 810 bool "Set loadable kernel module data as NX and text as RO" if ARCH_OPTIONAL_KERNEL_RWX
811 depends on ARCH_HAS_STRICT_MODULE_RWX && MODULES 811 depends on ARCH_HAS_STRICT_MODULE_RWX && MODULES
812 default !ARCH_OPTIONAL_KERNEL_RWX || ARCH_OPTIONAL_KERNEL_RWX_DEFAULT 812 default !ARCH_OPTIONAL_KERNEL_RWX || ARCH_OPTIONAL_KERNEL_RWX_DEFAULT
diff --git a/arch/arm/configs/aspeed_g4_defconfig b/arch/arm/configs/aspeed_g4_defconfig
index ca39c04fec6b..05b99bc1c1ce 100644
--- a/arch/arm/configs/aspeed_g4_defconfig
+++ b/arch/arm/configs/aspeed_g4_defconfig
@@ -25,7 +25,6 @@ CONFIG_MODULE_UNLOAD=y
25# CONFIG_ARCH_MULTI_V7 is not set 25# CONFIG_ARCH_MULTI_V7 is not set
26CONFIG_ARCH_ASPEED=y 26CONFIG_ARCH_ASPEED=y
27CONFIG_MACH_ASPEED_G4=y 27CONFIG_MACH_ASPEED_G4=y
28CONFIG_DEBUG_RODATA=y
29CONFIG_AEABI=y 28CONFIG_AEABI=y
30CONFIG_UACCESS_WITH_MEMCPY=y 29CONFIG_UACCESS_WITH_MEMCPY=y
31CONFIG_SECCOMP=y 30CONFIG_SECCOMP=y
@@ -79,7 +78,8 @@ CONFIG_DEBUG_LL_UART_8250=y
79CONFIG_DEBUG_UART_PHYS=0x1e784000 78CONFIG_DEBUG_UART_PHYS=0x1e784000
80CONFIG_DEBUG_UART_VIRT=0xe8784000 79CONFIG_DEBUG_UART_VIRT=0xe8784000
81CONFIG_EARLY_PRINTK=y 80CONFIG_EARLY_PRINTK=y
82CONFIG_DEBUG_SET_MODULE_RONX=y 81CONFIG_STRICT_MODULE_RWX=y
82CONFIG_STRICT_KERNEL_RWX=y
83# CONFIG_XZ_DEC_X86 is not set 83# CONFIG_XZ_DEC_X86 is not set
84# CONFIG_XZ_DEC_POWERPC is not set 84# CONFIG_XZ_DEC_POWERPC is not set
85# CONFIG_XZ_DEC_IA64 is not set 85# CONFIG_XZ_DEC_IA64 is not set
diff --git a/arch/arm/configs/aspeed_g5_defconfig b/arch/arm/configs/aspeed_g5_defconfig
index 4f366b0370e9..05a16d53d03c 100644
--- a/arch/arm/configs/aspeed_g5_defconfig
+++ b/arch/arm/configs/aspeed_g5_defconfig
@@ -26,7 +26,6 @@ CONFIG_ARCH_MULTI_V6=y
26# CONFIG_ARCH_MULTI_V7 is not set 26# CONFIG_ARCH_MULTI_V7 is not set
27CONFIG_ARCH_ASPEED=y 27CONFIG_ARCH_ASPEED=y
28CONFIG_MACH_ASPEED_G5=y 28CONFIG_MACH_ASPEED_G5=y
29CONFIG_DEBUG_RODATA=y
30CONFIG_AEABI=y 29CONFIG_AEABI=y
31CONFIG_UACCESS_WITH_MEMCPY=y 30CONFIG_UACCESS_WITH_MEMCPY=y
32CONFIG_SECCOMP=y 31CONFIG_SECCOMP=y
@@ -81,7 +80,8 @@ CONFIG_DEBUG_LL_UART_8250=y
81CONFIG_DEBUG_UART_PHYS=0x1e784000 80CONFIG_DEBUG_UART_PHYS=0x1e784000
82CONFIG_DEBUG_UART_VIRT=0xe8784000 81CONFIG_DEBUG_UART_VIRT=0xe8784000
83CONFIG_EARLY_PRINTK=y 82CONFIG_EARLY_PRINTK=y
84CONFIG_DEBUG_SET_MODULE_RONX=y 83CONFIG_STRICT_MODULE_RWX=y
84CONFIG_STRICT_KERNEL_RWX=y
85# CONFIG_XZ_DEC_X86 is not set 85# CONFIG_XZ_DEC_X86 is not set
86# CONFIG_XZ_DEC_POWERPC is not set 86# CONFIG_XZ_DEC_POWERPC is not set
87# CONFIG_XZ_DEC_IA64 is not set 87# CONFIG_XZ_DEC_IA64 is not set
diff --git a/arch/arm/include/asm/cacheflush.h b/arch/arm/include/asm/cacheflush.h
index bdd283bc5842..02454fa15d2c 100644
--- a/arch/arm/include/asm/cacheflush.h
+++ b/arch/arm/include/asm/cacheflush.h
@@ -490,7 +490,7 @@ static inline int set_memory_x(unsigned long addr, int numpages) { return 0; }
490static inline int set_memory_nx(unsigned long addr, int numpages) { return 0; } 490static inline int set_memory_nx(unsigned long addr, int numpages) { return 0; }
491#endif 491#endif
492 492
493#ifdef CONFIG_DEBUG_RODATA 493#ifdef CONFIG_STRICT_KERNEL_RWX
494void set_kernel_text_rw(void); 494void set_kernel_text_rw(void);
495void set_kernel_text_ro(void); 495void set_kernel_text_ro(void);
496#else 496#else
diff --git a/arch/arm/kernel/patch.c b/arch/arm/kernel/patch.c
index 69bda1a5707e..020560b2dcb7 100644
--- a/arch/arm/kernel/patch.c
+++ b/arch/arm/kernel/patch.c
@@ -24,9 +24,9 @@ static void __kprobes *patch_map(void *addr, int fixmap, unsigned long *flags)
24 bool module = !core_kernel_text(uintaddr); 24 bool module = !core_kernel_text(uintaddr);
25 struct page *page; 25 struct page *page;
26 26
27 if (module && IS_ENABLED(CONFIG_DEBUG_SET_MODULE_RONX)) 27 if (module && IS_ENABLED(CONFIG_STRICT_MODULE_RWX))
28 page = vmalloc_to_page(addr); 28 page = vmalloc_to_page(addr);
29 else if (!module && IS_ENABLED(CONFIG_DEBUG_RODATA)) 29 else if (!module && IS_ENABLED(CONFIG_STRICT_KERNEL_RWX))
30 page = virt_to_page(addr); 30 page = virt_to_page(addr);
31 else 31 else
32 return addr; 32 return addr;
diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S
index f7f55df0bf7b..ce18007f9e4e 100644
--- a/arch/arm/kernel/vmlinux.lds.S
+++ b/arch/arm/kernel/vmlinux.lds.S
@@ -97,7 +97,7 @@ SECTIONS
97 HEAD_TEXT 97 HEAD_TEXT
98 } 98 }
99 99
100#ifdef CONFIG_DEBUG_RODATA 100#ifdef CONFIG_STRICT_KERNEL_RWX
101 . = ALIGN(1<<SECTION_SHIFT); 101 . = ALIGN(1<<SECTION_SHIFT);
102#endif 102#endif
103 103
@@ -158,7 +158,7 @@ SECTIONS
158 158
159 NOTES 159 NOTES
160 160
161#ifdef CONFIG_DEBUG_RODATA 161#ifdef CONFIG_STRICT_KERNEL_RWX
162 . = ALIGN(1<<SECTION_SHIFT); 162 . = ALIGN(1<<SECTION_SHIFT);
163#else 163#else
164 . = ALIGN(PAGE_SIZE); 164 . = ALIGN(PAGE_SIZE);
@@ -230,7 +230,7 @@ SECTIONS
230 PERCPU_SECTION(L1_CACHE_BYTES) 230 PERCPU_SECTION(L1_CACHE_BYTES)
231#endif 231#endif
232 232
233#ifdef CONFIG_DEBUG_RODATA 233#ifdef CONFIG_STRICT_KERNEL_RWX
234 . = ALIGN(1<<SECTION_SHIFT); 234 . = ALIGN(1<<SECTION_SHIFT);
235#else 235#else
236 . = ALIGN(THREAD_SIZE); 236 . = ALIGN(THREAD_SIZE);
@@ -325,7 +325,7 @@ SECTIONS
325 STABS_DEBUG 325 STABS_DEBUG
326} 326}
327 327
328#ifdef CONFIG_DEBUG_RODATA 328#ifdef CONFIG_STRICT_KERNEL_RWX
329/* 329/*
330 * Without CONFIG_DEBUG_ALIGN_RODATA, __start_rodata_section_aligned will 330 * Without CONFIG_DEBUG_ALIGN_RODATA, __start_rodata_section_aligned will
331 * be the first section-aligned location after __start_rodata. Otherwise, 331 * be the first section-aligned location after __start_rodata. Otherwise,
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
index 419a0355d4e4..35e3a56e5d86 100644
--- a/arch/arm/mm/Kconfig
+++ b/arch/arm/mm/Kconfig
@@ -1053,7 +1053,7 @@ config ARCH_SUPPORTS_BIG_ENDIAN
1053 1053
1054config DEBUG_ALIGN_RODATA 1054config DEBUG_ALIGN_RODATA
1055 bool "Make rodata strictly non-executable" 1055 bool "Make rodata strictly non-executable"
1056 depends on DEBUG_RODATA 1056 depends on STRICT_KERNEL_RWX
1057 default y 1057 default y
1058 help 1058 help
1059 If this is set, rodata will be made explicitly non-executable. This 1059 If this is set, rodata will be made explicitly non-executable. This
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index 370581aeb871..4be0bee4c357 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -572,7 +572,7 @@ void __init mem_init(void)
572 } 572 }
573} 573}
574 574
575#ifdef CONFIG_DEBUG_RODATA 575#ifdef CONFIG_STRICT_KERNEL_RWX
576struct section_perm { 576struct section_perm {
577 const char *name; 577 const char *name;
578 unsigned long start; 578 unsigned long start;
@@ -741,7 +741,7 @@ void set_kernel_text_ro(void)
741 741
742#else 742#else
743static inline void fix_kernmem_perms(void) { } 743static inline void fix_kernmem_perms(void) { }
744#endif /* CONFIG_DEBUG_RODATA */ 744#endif /* CONFIG_STRICT_KERNEL_RWX */
745 745
746void free_tcmmem(void) 746void free_tcmmem(void)
747{ 747{
diff --git a/arch/arm64/Kconfig.debug b/arch/arm64/Kconfig.debug
index 939815e8d695..560a8d85a4f8 100644
--- a/arch/arm64/Kconfig.debug
+++ b/arch/arm64/Kconfig.debug
@@ -72,7 +72,7 @@ config DEBUG_WX
72 If in doubt, say "Y". 72 If in doubt, say "Y".
73 73
74config DEBUG_ALIGN_RODATA 74config DEBUG_ALIGN_RODATA
75 depends on DEBUG_RODATA 75 depends on STRICT_KERNEL_RWX
76 bool "Align linker sections up to SECTION_SIZE" 76 bool "Align linker sections up to SECTION_SIZE"
77 help 77 help
78 If this option is enabled, sections that may potentially be marked as 78 If this option is enabled, sections that may potentially be marked as
diff --git a/arch/arm64/kernel/insn.c b/arch/arm64/kernel/insn.c
index 94b62c1fa4df..67f9cb9e8512 100644
--- a/arch/arm64/kernel/insn.c
+++ b/arch/arm64/kernel/insn.c
@@ -93,7 +93,7 @@ static void __kprobes *patch_map(void *addr, int fixmap)
93 bool module = !core_kernel_text(uintaddr); 93 bool module = !core_kernel_text(uintaddr);
94 struct page *page; 94 struct page *page;
95 95
96 if (module && IS_ENABLED(CONFIG_DEBUG_SET_MODULE_RONX)) 96 if (module && IS_ENABLED(CONFIG_STRICT_MODULE_RWX))
97 page = vmalloc_to_page(addr); 97 page = vmalloc_to_page(addr);
98 else if (!module) 98 else if (!module)
99 page = pfn_to_page(PHYS_PFN(__pa(addr))); 99 page = pfn_to_page(PHYS_PFN(__pa(addr)));
diff --git a/arch/parisc/configs/712_defconfig b/arch/parisc/configs/712_defconfig
index db8f56bf3883..143d02652792 100644
--- a/arch/parisc/configs/712_defconfig
+++ b/arch/parisc/configs/712_defconfig
@@ -182,7 +182,6 @@ CONFIG_DEBUG_FS=y
182CONFIG_DEBUG_KERNEL=y 182CONFIG_DEBUG_KERNEL=y
183CONFIG_DEBUG_MUTEXES=y 183CONFIG_DEBUG_MUTEXES=y
184# CONFIG_RCU_CPU_STALL_DETECTOR is not set 184# CONFIG_RCU_CPU_STALL_DETECTOR is not set
185CONFIG_DEBUG_RODATA=y
186CONFIG_CRYPTO_NULL=m 185CONFIG_CRYPTO_NULL=m
187CONFIG_CRYPTO_TEST=m 186CONFIG_CRYPTO_TEST=m
188CONFIG_CRYPTO_HMAC=y 187CONFIG_CRYPTO_HMAC=y
diff --git a/arch/parisc/configs/c3000_defconfig b/arch/parisc/configs/c3000_defconfig
index fb92b8920785..8e8f0e34f817 100644
--- a/arch/parisc/configs/c3000_defconfig
+++ b/arch/parisc/configs/c3000_defconfig
@@ -166,7 +166,6 @@ CONFIG_DEBUG_KERNEL=y
166CONFIG_DEBUG_MUTEXES=y 166CONFIG_DEBUG_MUTEXES=y
167# CONFIG_DEBUG_BUGVERBOSE is not set 167# CONFIG_DEBUG_BUGVERBOSE is not set
168# CONFIG_RCU_CPU_STALL_DETECTOR is not set 168# CONFIG_RCU_CPU_STALL_DETECTOR is not set
169CONFIG_DEBUG_RODATA=y
170CONFIG_CRYPTO_NULL=m 169CONFIG_CRYPTO_NULL=m
171CONFIG_CRYPTO_TEST=m 170CONFIG_CRYPTO_TEST=m
172CONFIG_CRYPTO_MD5=m 171CONFIG_CRYPTO_MD5=m
diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
index e02ada312be8..a055e5b6b380 100644
--- a/arch/parisc/mm/init.c
+++ b/arch/parisc/mm/init.c
@@ -545,7 +545,7 @@ void free_initmem(void)
545} 545}
546 546
547 547
548#ifdef CONFIG_DEBUG_RODATA 548#ifdef CONFIG_STRICT_KERNEL_RWX
549void mark_rodata_ro(void) 549void mark_rodata_ro(void)
550{ 550{
551 /* rodata memory was already mapped with KERNEL_RO access rights by 551 /* rodata memory was already mapped with KERNEL_RO access rights by
diff --git a/include/linux/filter.h b/include/linux/filter.h
index a0934e6c9bab..c6dd53e88711 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -543,7 +543,7 @@ static inline bool bpf_prog_was_classic(const struct bpf_prog *prog)
543 543
544#define bpf_classic_proglen(fprog) (fprog->len * sizeof(fprog->filter[0])) 544#define bpf_classic_proglen(fprog) (fprog->len * sizeof(fprog->filter[0]))
545 545
546#ifdef CONFIG_DEBUG_SET_MODULE_RONX 546#ifdef CONFIG_STRICT_MODULE_RWX
547static inline void bpf_prog_lock_ro(struct bpf_prog *fp) 547static inline void bpf_prog_lock_ro(struct bpf_prog *fp)
548{ 548{
549 set_memory_ro((unsigned long)fp, fp->pages); 549 set_memory_ro((unsigned long)fp, fp->pages);
@@ -561,7 +561,7 @@ static inline void bpf_prog_lock_ro(struct bpf_prog *fp)
561static inline void bpf_prog_unlock_ro(struct bpf_prog *fp) 561static inline void bpf_prog_unlock_ro(struct bpf_prog *fp)
562{ 562{
563} 563}
564#endif /* CONFIG_DEBUG_SET_MODULE_RONX */ 564#endif /* CONFIG_STRICT_MODULE_RWX */
565 565
566int sk_filter_trim_cap(struct sock *sk, struct sk_buff *skb, unsigned int cap); 566int sk_filter_trim_cap(struct sock *sk, struct sk_buff *skb, unsigned int cap);
567static inline int sk_filter(struct sock *sk, struct sk_buff *skb) 567static inline int sk_filter(struct sock *sk, struct sk_buff *skb)
diff --git a/include/linux/init.h b/include/linux/init.h
index 885c3e6d0f9d..79af0962fd52 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -126,10 +126,10 @@ void prepare_namespace(void);
126void __init load_default_modules(void); 126void __init load_default_modules(void);
127int __init init_rootfs(void); 127int __init init_rootfs(void);
128 128
129#if defined(CONFIG_DEBUG_RODATA) || defined(CONFIG_DEBUG_SET_MODULE_RONX) 129#if defined(CONFIG_STRICT_KERNEL_RWX) || defined(CONFIG_STRICT_MODULE_RWX)
130extern bool rodata_enabled; 130extern bool rodata_enabled;
131#endif 131#endif
132#ifdef CONFIG_DEBUG_RODATA 132#ifdef CONFIG_STRICT_KERNEL_RWX
133void mark_rodata_ro(void); 133void mark_rodata_ro(void);
134#endif 134#endif
135 135
diff --git a/include/linux/module.h b/include/linux/module.h
index 7c84273d60b9..d5afd142818f 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -764,7 +764,7 @@ extern int module_sysfs_initialized;
764 764
765#define __MODULE_STRING(x) __stringify(x) 765#define __MODULE_STRING(x) __stringify(x)
766 766
767#ifdef CONFIG_DEBUG_SET_MODULE_RONX 767#ifdef CONFIG_STRICT_MODULE_RWX
768extern void set_all_modules_text_rw(void); 768extern void set_all_modules_text_rw(void);
769extern void set_all_modules_text_ro(void); 769extern void set_all_modules_text_ro(void);
770extern void module_enable_ro(const struct module *mod, bool after_init); 770extern void module_enable_ro(const struct module *mod, bool after_init);
diff --git a/init/main.c b/init/main.c
index b0c9d6facef9..0b7bae29eef6 100644
--- a/init/main.c
+++ b/init/main.c
@@ -925,7 +925,7 @@ static int try_to_run_init_process(const char *init_filename)
925 925
926static noinline void __init kernel_init_freeable(void); 926static noinline void __init kernel_init_freeable(void);
927 927
928#if defined(CONFIG_DEBUG_RODATA) || defined(CONFIG_DEBUG_SET_MODULE_RONX) 928#if defined(CONFIG_STRICT_KERNEL_RWX) || defined(CONFIG_STRICT_MODULE_RWX)
929bool rodata_enabled __ro_after_init = true; 929bool rodata_enabled __ro_after_init = true;
930static int __init set_debug_rodata(char *str) 930static int __init set_debug_rodata(char *str)
931{ 931{
@@ -934,7 +934,7 @@ static int __init set_debug_rodata(char *str)
934__setup("rodata=", set_debug_rodata); 934__setup("rodata=", set_debug_rodata);
935#endif 935#endif
936 936
937#ifdef CONFIG_DEBUG_RODATA 937#ifdef CONFIG_STRICT_KERNEL_RWX
938static void mark_readonly(void) 938static void mark_readonly(void)
939{ 939{
940 if (rodata_enabled) 940 if (rodata_enabled)
diff --git a/kernel/configs/android-recommended.config b/kernel/configs/android-recommended.config
index 297756be369c..99127edc5204 100644
--- a/kernel/configs/android-recommended.config
+++ b/kernel/configs/android-recommended.config
@@ -11,7 +11,7 @@ CONFIG_BLK_DEV_LOOP=y
11CONFIG_BLK_DEV_RAM=y 11CONFIG_BLK_DEV_RAM=y
12CONFIG_BLK_DEV_RAM_SIZE=8192 12CONFIG_BLK_DEV_RAM_SIZE=8192
13CONFIG_COMPACTION=y 13CONFIG_COMPACTION=y
14CONFIG_DEBUG_RODATA=y 14CONFIG_STRICT_KERNEL_RWX=y
15CONFIG_DM_CRYPT=y 15CONFIG_DM_CRYPT=y
16CONFIG_DM_UEVENT=y 16CONFIG_DM_UEVENT=y
17CONFIG_DM_VERITY=y 17CONFIG_DM_VERITY=y
diff --git a/kernel/module.c b/kernel/module.c
index 5088784c0cf9..e71478569273 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -74,9 +74,9 @@
74/* 74/*
75 * Modules' sections will be aligned on page boundaries 75 * Modules' sections will be aligned on page boundaries
76 * to ensure complete separation of code and data, but 76 * to ensure complete separation of code and data, but
77 * only when CONFIG_DEBUG_SET_MODULE_RONX=y 77 * only when CONFIG_STRICT_MODULE_RWX=y
78 */ 78 */
79#ifdef CONFIG_DEBUG_SET_MODULE_RONX 79#ifdef CONFIG_STRICT_MODULE_RWX
80# define debug_align(X) ALIGN(X, PAGE_SIZE) 80# define debug_align(X) ALIGN(X, PAGE_SIZE)
81#else 81#else
82# define debug_align(X) (X) 82# define debug_align(X) (X)
@@ -1847,7 +1847,7 @@ static void mod_sysfs_teardown(struct module *mod)
1847 mod_sysfs_fini(mod); 1847 mod_sysfs_fini(mod);
1848} 1848}
1849 1849
1850#ifdef CONFIG_DEBUG_SET_MODULE_RONX 1850#ifdef CONFIG_STRICT_MODULE_RWX
1851/* 1851/*
1852 * LKM RO/NX protection: protect module's text/ro-data 1852 * LKM RO/NX protection: protect module's text/ro-data
1853 * from modification and any data from execution. 1853 * from modification and any data from execution.
diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
index b26dbc48c75b..86385af1080f 100644
--- a/kernel/power/hibernate.c
+++ b/kernel/power/hibernate.c
@@ -1156,7 +1156,7 @@ static int __init hibernate_setup(char *str)
1156 } else if (!strncmp(str, "no", 2)) { 1156 } else if (!strncmp(str, "no", 2)) {
1157 noresume = 1; 1157 noresume = 1;
1158 nohibernate = 1; 1158 nohibernate = 1;
1159 } else if (IS_ENABLED(CONFIG_DEBUG_RODATA) 1159 } else if (IS_ENABLED(CONFIG_STRICT_KERNEL_RWX)
1160 && !strncmp(str, "protect_image", 13)) { 1160 && !strncmp(str, "protect_image", 13)) {
1161 enable_restore_image_protection(); 1161 enable_restore_image_protection();
1162 } 1162 }
diff --git a/kernel/power/power.h b/kernel/power/power.h
index 1dfa0da827d3..7fdc40d31b7d 100644
--- a/kernel/power/power.h
+++ b/kernel/power/power.h
@@ -61,12 +61,12 @@ extern int hibernation_snapshot(int platform_mode);
61extern int hibernation_restore(int platform_mode); 61extern int hibernation_restore(int platform_mode);
62extern int hibernation_platform_enter(void); 62extern int hibernation_platform_enter(void);
63 63
64#ifdef CONFIG_DEBUG_RODATA 64#ifdef CONFIG_STRICT_KERNEL_RWX
65/* kernel/power/snapshot.c */ 65/* kernel/power/snapshot.c */
66extern void enable_restore_image_protection(void); 66extern void enable_restore_image_protection(void);
67#else 67#else
68static inline void enable_restore_image_protection(void) {} 68static inline void enable_restore_image_protection(void) {}
69#endif /* CONFIG_DEBUG_RODATA */ 69#endif /* CONFIG_STRICT_KERNEL_RWX */
70 70
71#else /* !CONFIG_HIBERNATION */ 71#else /* !CONFIG_HIBERNATION */
72 72
diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c
index 2d8e2b227db8..905d5bbd595f 100644
--- a/kernel/power/snapshot.c
+++ b/kernel/power/snapshot.c
@@ -38,7 +38,7 @@
38 38
39#include "power.h" 39#include "power.h"
40 40
41#ifdef CONFIG_DEBUG_RODATA 41#ifdef CONFIG_STRICT_KERNEL_RWX
42static bool hibernate_restore_protection; 42static bool hibernate_restore_protection;
43static bool hibernate_restore_protection_active; 43static bool hibernate_restore_protection_active;
44 44
@@ -73,7 +73,7 @@ static inline void hibernate_restore_protection_begin(void) {}
73static inline void hibernate_restore_protection_end(void) {} 73static inline void hibernate_restore_protection_end(void) {}
74static inline void hibernate_restore_protect_page(void *page_address) {} 74static inline void hibernate_restore_protect_page(void *page_address) {}
75static inline void hibernate_restore_unprotect_page(void *page_address) {} 75static inline void hibernate_restore_unprotect_page(void *page_address) {}
76#endif /* CONFIG_DEBUG_RODATA */ 76#endif /* CONFIG_STRICT_KERNEL_RWX */
77 77
78static int swsusp_page_is_free(struct page *); 78static int swsusp_page_is_free(struct page *);
79static void swsusp_set_page_forbidden(struct page *); 79static void swsusp_set_page_forbidden(struct page *);