diff options
33 files changed, 90 insertions, 109 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 3010576c9fca..141acfebe6ef 100644 --- a/Documentation/security/self-protection.txt +++ b/Documentation/security/self-protection.txt | |||
@@ -51,11 +51,17 @@ kernel, they are implemented in a way where the memory is temporarily | |||
51 | made writable during the update, and then returned to the original | 51 | made writable during the update, and then returned to the original |
52 | permissions.) | 52 | permissions.) |
53 | 53 | ||
54 | In support of this are (the poorly named) CONFIG_DEBUG_RODATA and | 54 | In support of this are CONFIG_STRICT_KERNEL_RWX and |
55 | CONFIG_DEBUG_SET_MODULE_RONX, which seek to make sure that code is not | 55 | CONFIG_STRICT_MODULE_RWX, which seek to make sure that code is not |
56 | writable, data is not executable, and read-only data is neither writable | 56 | writable, data is not executable, and read-only data is neither writable |
57 | nor executable. | 57 | nor executable. |
58 | 58 | ||
59 | Most architectures have these options on by default and not user selectable. | ||
60 | For some architectures like arm that wish to have these be selectable, | ||
61 | the architecture Kconfig can select ARCH_OPTIONAL_KERNEL_RWX to enable | ||
62 | a Kconfig prompt. CONFIG_ARCH_OPTIONAL_KERNEL_RWX_DEFAULT determines | ||
63 | the default setting when ARCH_OPTIONAL_KERNEL_RWX is enabled. | ||
64 | |||
59 | #### Function pointers and sensitive variables must not be writable | 65 | #### Function pointers and sensitive variables must not be writable |
60 | 66 | ||
61 | Vast areas of kernel memory contain function pointers that are looked | 67 | Vast areas of kernel memory contain function pointers that are looked |
diff --git a/arch/Kconfig b/arch/Kconfig index 99839c23d453..33f5a555c32a 100644 --- a/arch/Kconfig +++ b/arch/Kconfig | |||
@@ -781,4 +781,38 @@ config VMAP_STACK | |||
781 | the stack to map directly to the KASAN shadow map using a formula | 781 | the stack to map directly to the KASAN shadow map using a formula |
782 | that is incorrect if the stack is in vmalloc space. | 782 | that is incorrect if the stack is in vmalloc space. |
783 | 783 | ||
784 | config ARCH_OPTIONAL_KERNEL_RWX | ||
785 | def_bool n | ||
786 | |||
787 | config ARCH_OPTIONAL_KERNEL_RWX_DEFAULT | ||
788 | def_bool n | ||
789 | |||
790 | config ARCH_HAS_STRICT_KERNEL_RWX | ||
791 | def_bool n | ||
792 | |||
793 | config STRICT_KERNEL_RWX | ||
794 | bool "Make kernel text and rodata read-only" if ARCH_OPTIONAL_KERNEL_RWX | ||
795 | depends on ARCH_HAS_STRICT_KERNEL_RWX | ||
796 | default !ARCH_OPTIONAL_KERNEL_RWX || ARCH_OPTIONAL_KERNEL_RWX_DEFAULT | ||
797 | help | ||
798 | If this is set, kernel text and rodata memory will be made read-only, | ||
799 | and non-text memory will be made non-executable. This provides | ||
800 | protection against certain security exploits (e.g. executing the heap | ||
801 | or modifying text) | ||
802 | |||
803 | These features are considered standard security practice these days. | ||
804 | You should say Y here in almost all cases. | ||
805 | |||
806 | config ARCH_HAS_STRICT_MODULE_RWX | ||
807 | def_bool n | ||
808 | |||
809 | config STRICT_MODULE_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 | ||
812 | default !ARCH_OPTIONAL_KERNEL_RWX || ARCH_OPTIONAL_KERNEL_RWX_DEFAULT | ||
813 | help | ||
814 | If this is set, module text and rodata memory will be made read-only, | ||
815 | and non-text memory will be made non-executable. This provides | ||
816 | protection against certain security exploits (e.g. writing to text) | ||
817 | |||
784 | source "kernel/gcov/Kconfig" | 818 | source "kernel/gcov/Kconfig" |
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 186c4c214e0a..8748353ed5e0 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
@@ -4,10 +4,14 @@ config ARM | |||
4 | select ARCH_CLOCKSOURCE_DATA | 4 | select ARCH_CLOCKSOURCE_DATA |
5 | select ARCH_HAS_DEVMEM_IS_ALLOWED | 5 | select ARCH_HAS_DEVMEM_IS_ALLOWED |
6 | select ARCH_HAS_ELF_RANDOMIZE | 6 | select ARCH_HAS_ELF_RANDOMIZE |
7 | select ARCH_HAS_STRICT_KERNEL_RWX if MMU && !XIP_KERNEL | ||
8 | select ARCH_HAS_STRICT_MODULE_RWX if MMU | ||
7 | select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST | 9 | select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST |
8 | select ARCH_HAVE_CUSTOM_GPIO_H | 10 | select ARCH_HAVE_CUSTOM_GPIO_H |
9 | select ARCH_HAS_GCOV_PROFILE_ALL | 11 | select ARCH_HAS_GCOV_PROFILE_ALL |
10 | select ARCH_MIGHT_HAVE_PC_PARPORT | 12 | select ARCH_MIGHT_HAVE_PC_PARPORT |
13 | select ARCH_OPTIONAL_KERNEL_RWX if ARCH_HAS_STRICT_KERNEL_RWX | ||
14 | select ARCH_OPTIONAL_KERNEL_RWX_DEFAULT if CPU_V7 | ||
11 | select ARCH_SUPPORTS_ATOMIC_RMW | 15 | select ARCH_SUPPORTS_ATOMIC_RMW |
12 | select ARCH_USE_BUILTIN_BSWAP | 16 | select ARCH_USE_BUILTIN_BSWAP |
13 | select ARCH_USE_CMPXCHG_LOCKREF | 17 | select ARCH_USE_CMPXCHG_LOCKREF |
diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug index d83f7c369e51..426d2716f55d 100644 --- a/arch/arm/Kconfig.debug +++ b/arch/arm/Kconfig.debug | |||
@@ -1738,17 +1738,6 @@ config PID_IN_CONTEXTIDR | |||
1738 | additional instructions during context switch. Say Y here only if you | 1738 | additional instructions during context switch. Say Y here only if you |
1739 | are planning to use hardware trace tools with this kernel. | 1739 | are planning to use hardware trace tools with this kernel. |
1740 | 1740 | ||
1741 | config DEBUG_SET_MODULE_RONX | ||
1742 | bool "Set loadable kernel module data as NX and text as RO" | ||
1743 | depends on MODULES && MMU | ||
1744 | ---help--- | ||
1745 | This option helps catch unintended modifications to loadable | ||
1746 | kernel module's text and read-only data. It also prevents execution | ||
1747 | of module data. Such protection may interfere with run-time code | ||
1748 | patching and dynamic kernel tracing - and they might also protect | ||
1749 | against certain classes of kernel exploits. | ||
1750 | If in doubt, say "N". | ||
1751 | |||
1752 | source "drivers/hwtracing/coresight/Kconfig" | 1741 | source "drivers/hwtracing/coresight/Kconfig" |
1753 | 1742 | ||
1754 | endmenu | 1743 | endmenu |
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 |
26 | CONFIG_ARCH_ASPEED=y | 26 | CONFIG_ARCH_ASPEED=y |
27 | CONFIG_MACH_ASPEED_G4=y | 27 | CONFIG_MACH_ASPEED_G4=y |
28 | CONFIG_DEBUG_RODATA=y | ||
29 | CONFIG_AEABI=y | 28 | CONFIG_AEABI=y |
30 | CONFIG_UACCESS_WITH_MEMCPY=y | 29 | CONFIG_UACCESS_WITH_MEMCPY=y |
31 | CONFIG_SECCOMP=y | 30 | CONFIG_SECCOMP=y |
@@ -79,7 +78,8 @@ CONFIG_DEBUG_LL_UART_8250=y | |||
79 | CONFIG_DEBUG_UART_PHYS=0x1e784000 | 78 | CONFIG_DEBUG_UART_PHYS=0x1e784000 |
80 | CONFIG_DEBUG_UART_VIRT=0xe8784000 | 79 | CONFIG_DEBUG_UART_VIRT=0xe8784000 |
81 | CONFIG_EARLY_PRINTK=y | 80 | CONFIG_EARLY_PRINTK=y |
82 | CONFIG_DEBUG_SET_MODULE_RONX=y | 81 | CONFIG_STRICT_MODULE_RWX=y |
82 | CONFIG_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 |
27 | CONFIG_ARCH_ASPEED=y | 27 | CONFIG_ARCH_ASPEED=y |
28 | CONFIG_MACH_ASPEED_G5=y | 28 | CONFIG_MACH_ASPEED_G5=y |
29 | CONFIG_DEBUG_RODATA=y | ||
30 | CONFIG_AEABI=y | 29 | CONFIG_AEABI=y |
31 | CONFIG_UACCESS_WITH_MEMCPY=y | 30 | CONFIG_UACCESS_WITH_MEMCPY=y |
32 | CONFIG_SECCOMP=y | 31 | CONFIG_SECCOMP=y |
@@ -81,7 +80,8 @@ CONFIG_DEBUG_LL_UART_8250=y | |||
81 | CONFIG_DEBUG_UART_PHYS=0x1e784000 | 80 | CONFIG_DEBUG_UART_PHYS=0x1e784000 |
82 | CONFIG_DEBUG_UART_VIRT=0xe8784000 | 81 | CONFIG_DEBUG_UART_VIRT=0xe8784000 |
83 | CONFIG_EARLY_PRINTK=y | 82 | CONFIG_EARLY_PRINTK=y |
84 | CONFIG_DEBUG_SET_MODULE_RONX=y | 83 | CONFIG_STRICT_MODULE_RWX=y |
84 | CONFIG_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; } | |||
490 | static inline int set_memory_nx(unsigned long addr, int numpages) { return 0; } | 490 | static 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 |
494 | void set_kernel_text_rw(void); | 494 | void set_kernel_text_rw(void); |
495 | void set_kernel_text_ro(void); | 495 | void 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 f68e8ec29447..35e3a56e5d86 100644 --- a/arch/arm/mm/Kconfig +++ b/arch/arm/mm/Kconfig | |||
@@ -1051,21 +1051,9 @@ config ARCH_SUPPORTS_BIG_ENDIAN | |||
1051 | This option specifies the architecture can support big endian | 1051 | This option specifies the architecture can support big endian |
1052 | operation. | 1052 | operation. |
1053 | 1053 | ||
1054 | config DEBUG_RODATA | ||
1055 | bool "Make kernel text and rodata read-only" | ||
1056 | depends on MMU && !XIP_KERNEL | ||
1057 | default y if CPU_V7 | ||
1058 | help | ||
1059 | If this is set, kernel text and rodata memory will be made | ||
1060 | read-only, and non-text kernel memory will be made non-executable. | ||
1061 | The tradeoff is that each region is padded to section-size (1MiB) | ||
1062 | boundaries (because their permissions are different and splitting | ||
1063 | the 1M pages into 4K ones causes TLB performance problems), which | ||
1064 | can waste memory. | ||
1065 | |||
1066 | config DEBUG_ALIGN_RODATA | 1054 | config DEBUG_ALIGN_RODATA |
1067 | bool "Make rodata strictly non-executable" | 1055 | bool "Make rodata strictly non-executable" |
1068 | depends on DEBUG_RODATA | 1056 | depends on STRICT_KERNEL_RWX |
1069 | default y | 1057 | default y |
1070 | help | 1058 | help |
1071 | 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 |
576 | struct section_perm { | 576 | struct 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 |
743 | static inline void fix_kernmem_perms(void) { } | 743 | static inline void fix_kernmem_perms(void) { } |
744 | #endif /* CONFIG_DEBUG_RODATA */ | 744 | #endif /* CONFIG_STRICT_KERNEL_RWX */ |
745 | 745 | ||
746 | void free_tcmmem(void) | 746 | void free_tcmmem(void) |
747 | { | 747 | { |
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index f7dfd6d58659..3bebdaf1d009 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig | |||
@@ -13,6 +13,8 @@ config ARM64 | |||
13 | select ARCH_HAS_GIGANTIC_PAGE | 13 | select ARCH_HAS_GIGANTIC_PAGE |
14 | select ARCH_HAS_KCOV | 14 | select ARCH_HAS_KCOV |
15 | select ARCH_HAS_SG_CHAIN | 15 | select ARCH_HAS_SG_CHAIN |
16 | select ARCH_HAS_STRICT_KERNEL_RWX | ||
17 | select ARCH_HAS_STRICT_MODULE_RWX | ||
16 | select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST | 18 | select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST |
17 | select ARCH_USE_CMPXCHG_LOCKREF | 19 | select ARCH_USE_CMPXCHG_LOCKREF |
18 | select ARCH_SUPPORTS_ATOMIC_RMW | 20 | select ARCH_SUPPORTS_ATOMIC_RMW |
@@ -123,9 +125,6 @@ config ARCH_PHYS_ADDR_T_64BIT | |||
123 | config MMU | 125 | config MMU |
124 | def_bool y | 126 | def_bool y |
125 | 127 | ||
126 | config DEBUG_RODATA | ||
127 | def_bool y | ||
128 | |||
129 | config ARM64_PAGE_SHIFT | 128 | config ARM64_PAGE_SHIFT |
130 | int | 129 | int |
131 | default 16 if ARM64_64K_PAGES | 130 | default 16 if ARM64_64K_PAGES |
diff --git a/arch/arm64/Kconfig.debug b/arch/arm64/Kconfig.debug index d1ebd46872fd..560a8d85a4f8 100644 --- a/arch/arm64/Kconfig.debug +++ b/arch/arm64/Kconfig.debug | |||
@@ -71,19 +71,8 @@ config DEBUG_WX | |||
71 | 71 | ||
72 | If in doubt, say "Y". | 72 | If in doubt, say "Y". |
73 | 73 | ||
74 | config DEBUG_SET_MODULE_RONX | ||
75 | bool "Set loadable kernel module data as NX and text as RO" | ||
76 | depends on MODULES | ||
77 | default y | ||
78 | help | ||
79 | Is this is set, kernel module text and rodata will be made read-only. | ||
80 | This is to help catch accidental or malicious attempts to change the | ||
81 | kernel's executable code. | ||
82 | |||
83 | If in doubt, say Y. | ||
84 | |||
85 | config DEBUG_ALIGN_RODATA | 74 | config DEBUG_ALIGN_RODATA |
86 | depends on DEBUG_RODATA | 75 | depends on STRICT_KERNEL_RWX |
87 | bool "Align linker sections up to SECTION_SIZE" | 76 | bool "Align linker sections up to SECTION_SIZE" |
88 | help | 77 | help |
89 | 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/Kconfig b/arch/parisc/Kconfig index 3a71f38cdc05..ad294b3fb90b 100644 --- a/arch/parisc/Kconfig +++ b/arch/parisc/Kconfig | |||
@@ -8,6 +8,7 @@ config PARISC | |||
8 | select HAVE_SYSCALL_TRACEPOINTS | 8 | select HAVE_SYSCALL_TRACEPOINTS |
9 | select ARCH_WANT_FRAME_POINTERS | 9 | select ARCH_WANT_FRAME_POINTERS |
10 | select ARCH_HAS_ELF_RANDOMIZE | 10 | select ARCH_HAS_ELF_RANDOMIZE |
11 | select ARCH_HAS_STRICT_KERNEL_RWX | ||
11 | select RTC_CLASS | 12 | select RTC_CLASS |
12 | select RTC_DRV_GENERIC | 13 | select RTC_DRV_GENERIC |
13 | select INIT_ALL_POSSIBLE | 14 | select INIT_ALL_POSSIBLE |
diff --git a/arch/parisc/Kconfig.debug b/arch/parisc/Kconfig.debug index 68b7cbd0810a..0d856b94c9b1 100644 --- a/arch/parisc/Kconfig.debug +++ b/arch/parisc/Kconfig.debug | |||
@@ -5,15 +5,4 @@ source "lib/Kconfig.debug" | |||
5 | config TRACE_IRQFLAGS_SUPPORT | 5 | config TRACE_IRQFLAGS_SUPPORT |
6 | def_bool y | 6 | def_bool y |
7 | 7 | ||
8 | config DEBUG_RODATA | ||
9 | bool "Write protect kernel read-only data structures" | ||
10 | depends on DEBUG_KERNEL | ||
11 | default y | ||
12 | help | ||
13 | Mark the kernel read-only data as write-protected in the pagetables, | ||
14 | in order to catch accidental (and incorrect) writes to such const | ||
15 | data. This option may have a slight performance impact because a | ||
16 | portion of the kernel code won't be covered by a TLB anymore. | ||
17 | If in doubt, say "N". | ||
18 | |||
19 | endmenu | 8 | endmenu |
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 | |||
182 | CONFIG_DEBUG_KERNEL=y | 182 | CONFIG_DEBUG_KERNEL=y |
183 | CONFIG_DEBUG_MUTEXES=y | 183 | CONFIG_DEBUG_MUTEXES=y |
184 | # CONFIG_RCU_CPU_STALL_DETECTOR is not set | 184 | # CONFIG_RCU_CPU_STALL_DETECTOR is not set |
185 | CONFIG_DEBUG_RODATA=y | ||
186 | CONFIG_CRYPTO_NULL=m | 185 | CONFIG_CRYPTO_NULL=m |
187 | CONFIG_CRYPTO_TEST=m | 186 | CONFIG_CRYPTO_TEST=m |
188 | CONFIG_CRYPTO_HMAC=y | 187 | CONFIG_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 | |||
166 | CONFIG_DEBUG_MUTEXES=y | 166 | CONFIG_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 |
169 | CONFIG_DEBUG_RODATA=y | ||
170 | CONFIG_CRYPTO_NULL=m | 169 | CONFIG_CRYPTO_NULL=m |
171 | CONFIG_CRYPTO_TEST=m | 170 | CONFIG_CRYPTO_TEST=m |
172 | CONFIG_CRYPTO_MD5=m | 171 | CONFIG_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 |
549 | void mark_rodata_ro(void) | 549 | void 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/arch/s390/Kconfig b/arch/s390/Kconfig index c6722112527d..53bb0e3e0db3 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig | |||
@@ -62,9 +62,6 @@ config PCI_QUIRKS | |||
62 | config ARCH_SUPPORTS_UPROBES | 62 | config ARCH_SUPPORTS_UPROBES |
63 | def_bool y | 63 | def_bool y |
64 | 64 | ||
65 | config DEBUG_RODATA | ||
66 | def_bool y | ||
67 | |||
68 | config S390 | 65 | config S390 |
69 | def_bool y | 66 | def_bool y |
70 | select ARCH_HAS_DEVMEM_IS_ALLOWED | 67 | select ARCH_HAS_DEVMEM_IS_ALLOWED |
@@ -73,6 +70,8 @@ config S390 | |||
73 | select ARCH_HAS_GIGANTIC_PAGE | 70 | select ARCH_HAS_GIGANTIC_PAGE |
74 | select ARCH_HAS_KCOV | 71 | select ARCH_HAS_KCOV |
75 | select ARCH_HAS_SG_CHAIN | 72 | select ARCH_HAS_SG_CHAIN |
73 | select ARCH_HAS_STRICT_KERNEL_RWX | ||
74 | select ARCH_HAS_STRICT_MODULE_RWX | ||
76 | select ARCH_HAS_UBSAN_SANITIZE_ALL | 75 | select ARCH_HAS_UBSAN_SANITIZE_ALL |
77 | select ARCH_HAVE_NMI_SAFE_CMPXCHG | 76 | select ARCH_HAVE_NMI_SAFE_CMPXCHG |
78 | select ARCH_INLINE_READ_LOCK | 77 | select ARCH_INLINE_READ_LOCK |
diff --git a/arch/s390/Kconfig.debug b/arch/s390/Kconfig.debug index 26c5d5beb4be..57f8ea9c49e3 100644 --- a/arch/s390/Kconfig.debug +++ b/arch/s390/Kconfig.debug | |||
@@ -17,7 +17,4 @@ config S390_PTDUMP | |||
17 | kernel. | 17 | kernel. |
18 | If in doubt, say "N" | 18 | If in doubt, say "N" |
19 | 19 | ||
20 | config DEBUG_SET_MODULE_RONX | ||
21 | def_bool y | ||
22 | depends on MODULES | ||
23 | endmenu | 20 | endmenu |
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index f8fbfc5a98ba..4ca8c41623f4 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
@@ -54,6 +54,8 @@ config X86 | |||
54 | select ARCH_HAS_MMIO_FLUSH | 54 | select ARCH_HAS_MMIO_FLUSH |
55 | select ARCH_HAS_PMEM_API if X86_64 | 55 | select ARCH_HAS_PMEM_API if X86_64 |
56 | select ARCH_HAS_SG_CHAIN | 56 | select ARCH_HAS_SG_CHAIN |
57 | select ARCH_HAS_STRICT_KERNEL_RWX | ||
58 | select ARCH_HAS_STRICT_MODULE_RWX | ||
57 | select ARCH_HAS_UBSAN_SANITIZE_ALL | 59 | select ARCH_HAS_UBSAN_SANITIZE_ALL |
58 | select ARCH_HAVE_NMI_SAFE_CMPXCHG | 60 | select ARCH_HAVE_NMI_SAFE_CMPXCHG |
59 | select ARCH_MIGHT_HAVE_ACPI_PDC if ACPI | 61 | select ARCH_MIGHT_HAVE_ACPI_PDC if ACPI |
@@ -309,9 +311,6 @@ config ARCH_SUPPORTS_UPROBES | |||
309 | config FIX_EARLYCON_MEM | 311 | config FIX_EARLYCON_MEM |
310 | def_bool y | 312 | def_bool y |
311 | 313 | ||
312 | config DEBUG_RODATA | ||
313 | def_bool y | ||
314 | |||
315 | config PGTABLE_LEVELS | 314 | config PGTABLE_LEVELS |
316 | int | 315 | int |
317 | default 4 if X86_64 | 316 | default 4 if X86_64 |
diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug index 783099f2ac72..c4cba00dbdee 100644 --- a/arch/x86/Kconfig.debug +++ b/arch/x86/Kconfig.debug | |||
@@ -109,17 +109,6 @@ config DEBUG_WX | |||
109 | 109 | ||
110 | If in doubt, say "Y". | 110 | If in doubt, say "Y". |
111 | 111 | ||
112 | config DEBUG_SET_MODULE_RONX | ||
113 | bool "Set loadable kernel module data as NX and text as RO" | ||
114 | depends on MODULES | ||
115 | ---help--- | ||
116 | This option helps catch unintended modifications to loadable | ||
117 | kernel module's text and read-only data. It also prevents execution | ||
118 | of module data. Such protection may interfere with run-time code | ||
119 | patching and dynamic kernel tracing - and they might also protect | ||
120 | against certain classes of kernel exploits. | ||
121 | If in doubt, say "N". | ||
122 | |||
123 | config DOUBLEFAULT | 112 | config DOUBLEFAULT |
124 | default y | 113 | default y |
125 | bool "Enable doublefault exception handler" if EXPERT | 114 | bool "Enable doublefault exception handler" if EXPERT |
diff --git a/include/linux/filter.h b/include/linux/filter.h index e4eb2546339a..c2d282764d5d 100644 --- a/include/linux/filter.h +++ b/include/linux/filter.h | |||
@@ -545,7 +545,7 @@ static inline bool bpf_prog_was_classic(const struct bpf_prog *prog) | |||
545 | 545 | ||
546 | #define bpf_classic_proglen(fprog) (fprog->len * sizeof(fprog->filter[0])) | 546 | #define bpf_classic_proglen(fprog) (fprog->len * sizeof(fprog->filter[0])) |
547 | 547 | ||
548 | #ifdef CONFIG_DEBUG_SET_MODULE_RONX | 548 | #ifdef CONFIG_STRICT_MODULE_RWX |
549 | static inline void bpf_prog_lock_ro(struct bpf_prog *fp) | 549 | static inline void bpf_prog_lock_ro(struct bpf_prog *fp) |
550 | { | 550 | { |
551 | set_memory_ro((unsigned long)fp, fp->pages); | 551 | set_memory_ro((unsigned long)fp, fp->pages); |
@@ -563,7 +563,7 @@ static inline void bpf_prog_lock_ro(struct bpf_prog *fp) | |||
563 | static inline void bpf_prog_unlock_ro(struct bpf_prog *fp) | 563 | static inline void bpf_prog_unlock_ro(struct bpf_prog *fp) |
564 | { | 564 | { |
565 | } | 565 | } |
566 | #endif /* CONFIG_DEBUG_SET_MODULE_RONX */ | 566 | #endif /* CONFIG_STRICT_MODULE_RWX */ |
567 | 567 | ||
568 | int sk_filter_trim_cap(struct sock *sk, struct sk_buff *skb, unsigned int cap); | 568 | int sk_filter_trim_cap(struct sock *sk, struct sk_buff *skb, unsigned int cap); |
569 | static inline int sk_filter(struct sock *sk, struct sk_buff *skb) | 569 | static 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); | |||
126 | void __init load_default_modules(void); | 126 | void __init load_default_modules(void); |
127 | int __init init_rootfs(void); | 127 | int __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) |
130 | extern bool rodata_enabled; | 130 | extern bool rodata_enabled; |
131 | #endif | 131 | #endif |
132 | #ifdef CONFIG_DEBUG_RODATA | 132 | #ifdef CONFIG_STRICT_KERNEL_RWX |
133 | void mark_rodata_ro(void); | 133 | void mark_rodata_ro(void); |
134 | #endif | 134 | #endif |
135 | 135 | ||
diff --git a/include/linux/module.h b/include/linux/module.h index 5cddadff2c25..f4f542ed3d92 100644 --- a/include/linux/module.h +++ b/include/linux/module.h | |||
@@ -763,7 +763,7 @@ extern int module_sysfs_initialized; | |||
763 | 763 | ||
764 | #define __MODULE_STRING(x) __stringify(x) | 764 | #define __MODULE_STRING(x) __stringify(x) |
765 | 765 | ||
766 | #ifdef CONFIG_DEBUG_SET_MODULE_RONX | 766 | #ifdef CONFIG_STRICT_MODULE_RWX |
767 | extern void set_all_modules_text_rw(void); | 767 | extern void set_all_modules_text_rw(void); |
768 | extern void set_all_modules_text_ro(void); | 768 | extern void set_all_modules_text_ro(void); |
769 | extern void module_enable_ro(const struct module *mod, bool after_init); | 769 | extern void module_enable_ro(const struct module *mod, bool after_init); |
diff --git a/init/main.c b/init/main.c index 6d98664e843b..c8a00f0f10ff 100644 --- a/init/main.c +++ b/init/main.c | |||
@@ -924,7 +924,7 @@ static int try_to_run_init_process(const char *init_filename) | |||
924 | 924 | ||
925 | static noinline void __init kernel_init_freeable(void); | 925 | static noinline void __init kernel_init_freeable(void); |
926 | 926 | ||
927 | #if defined(CONFIG_DEBUG_RODATA) || defined(CONFIG_DEBUG_SET_MODULE_RONX) | 927 | #if defined(CONFIG_STRICT_KERNEL_RWX) || defined(CONFIG_STRICT_MODULE_RWX) |
928 | bool rodata_enabled __ro_after_init = true; | 928 | bool rodata_enabled __ro_after_init = true; |
929 | static int __init set_debug_rodata(char *str) | 929 | static int __init set_debug_rodata(char *str) |
930 | { | 930 | { |
@@ -933,7 +933,7 @@ static int __init set_debug_rodata(char *str) | |||
933 | __setup("rodata=", set_debug_rodata); | 933 | __setup("rodata=", set_debug_rodata); |
934 | #endif | 934 | #endif |
935 | 935 | ||
936 | #ifdef CONFIG_DEBUG_RODATA | 936 | #ifdef CONFIG_STRICT_KERNEL_RWX |
937 | static void mark_readonly(void) | 937 | static void mark_readonly(void) |
938 | { | 938 | { |
939 | if (rodata_enabled) | 939 | 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 | |||
11 | CONFIG_BLK_DEV_RAM=y | 11 | CONFIG_BLK_DEV_RAM=y |
12 | CONFIG_BLK_DEV_RAM_SIZE=8192 | 12 | CONFIG_BLK_DEV_RAM_SIZE=8192 |
13 | CONFIG_COMPACTION=y | 13 | CONFIG_COMPACTION=y |
14 | CONFIG_DEBUG_RODATA=y | 14 | CONFIG_STRICT_KERNEL_RWX=y |
15 | CONFIG_DM_CRYPT=y | 15 | CONFIG_DM_CRYPT=y |
16 | CONFIG_DM_UEVENT=y | 16 | CONFIG_DM_UEVENT=y |
17 | CONFIG_DM_VERITY=y | 17 | CONFIG_DM_VERITY=y |
diff --git a/kernel/module.c b/kernel/module.c index 1a17ec0c8ae7..a3889169a3ae 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -76,9 +76,9 @@ | |||
76 | /* | 76 | /* |
77 | * Modules' sections will be aligned on page boundaries | 77 | * Modules' sections will be aligned on page boundaries |
78 | * to ensure complete separation of code and data, but | 78 | * to ensure complete separation of code and data, but |
79 | * only when CONFIG_DEBUG_SET_MODULE_RONX=y | 79 | * only when CONFIG_STRICT_MODULE_RWX=y |
80 | */ | 80 | */ |
81 | #ifdef CONFIG_DEBUG_SET_MODULE_RONX | 81 | #ifdef CONFIG_STRICT_MODULE_RWX |
82 | # define debug_align(X) ALIGN(X, PAGE_SIZE) | 82 | # define debug_align(X) ALIGN(X, PAGE_SIZE) |
83 | #else | 83 | #else |
84 | # define debug_align(X) (X) | 84 | # define debug_align(X) (X) |
@@ -1846,7 +1846,7 @@ static void mod_sysfs_teardown(struct module *mod) | |||
1846 | mod_sysfs_fini(mod); | 1846 | mod_sysfs_fini(mod); |
1847 | } | 1847 | } |
1848 | 1848 | ||
1849 | #ifdef CONFIG_DEBUG_SET_MODULE_RONX | 1849 | #ifdef CONFIG_STRICT_MODULE_RWX |
1850 | /* | 1850 | /* |
1851 | * LKM RO/NX protection: protect module's text/ro-data | 1851 | * LKM RO/NX protection: protect module's text/ro-data |
1852 | * from modification and any data from execution. | 1852 | * 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); | |||
61 | extern int hibernation_restore(int platform_mode); | 61 | extern int hibernation_restore(int platform_mode); |
62 | extern int hibernation_platform_enter(void); | 62 | extern 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 */ |
66 | extern void enable_restore_image_protection(void); | 66 | extern void enable_restore_image_protection(void); |
67 | #else | 67 | #else |
68 | static inline void enable_restore_image_protection(void) {} | 68 | static 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 |
42 | static bool hibernate_restore_protection; | 42 | static bool hibernate_restore_protection; |
43 | static bool hibernate_restore_protection_active; | 43 | static bool hibernate_restore_protection_active; |
44 | 44 | ||
@@ -73,7 +73,7 @@ static inline void hibernate_restore_protection_begin(void) {} | |||
73 | static inline void hibernate_restore_protection_end(void) {} | 73 | static inline void hibernate_restore_protection_end(void) {} |
74 | static inline void hibernate_restore_protect_page(void *page_address) {} | 74 | static inline void hibernate_restore_protect_page(void *page_address) {} |
75 | static inline void hibernate_restore_unprotect_page(void *page_address) {} | 75 | static inline void hibernate_restore_unprotect_page(void *page_address) {} |
76 | #endif /* CONFIG_DEBUG_RODATA */ | 76 | #endif /* CONFIG_STRICT_KERNEL_RWX */ |
77 | 77 | ||
78 | static int swsusp_page_is_free(struct page *); | 78 | static int swsusp_page_is_free(struct page *); |
79 | static void swsusp_set_page_forbidden(struct page *); | 79 | static void swsusp_set_page_forbidden(struct page *); |