File tree Expand file tree Collapse file tree 2 files changed +7
-18
lines changed Expand file tree Collapse file tree 2 files changed +7
-18
lines changed Original file line number Diff line number Diff line change @@ -168,12 +168,8 @@ extern initcall_entry_t __initcall_end[];
168
168
169
169
extern struct file_system_type rootfs_fs_type ;
170
170
171
- #if defined(CONFIG_STRICT_KERNEL_RWX ) || defined(CONFIG_STRICT_MODULE_RWX )
172
171
extern bool rodata_enabled ;
173
- #endif
174
- #ifdef CONFIG_STRICT_KERNEL_RWX
175
172
void mark_rodata_ro (void );
176
- #endif
177
173
178
174
extern void (* late_time_init )(void );
179
175
Original file line number Diff line number Diff line change @@ -1396,10 +1396,9 @@ static int __init set_debug_rodata(char *str)
1396
1396
early_param ("rodata" , set_debug_rodata );
1397
1397
#endif
1398
1398
1399
- #ifdef CONFIG_STRICT_KERNEL_RWX
1400
1399
static void mark_readonly (void )
1401
1400
{
1402
- if (rodata_enabled ) {
1401
+ if (IS_ENABLED ( CONFIG_STRICT_KERNEL_RWX ) && rodata_enabled ) {
1403
1402
/*
1404
1403
* load_module() results in W+X mappings, which are cleaned
1405
1404
* up with call_rcu(). Let's make sure that queued work is
@@ -1409,20 +1408,14 @@ static void mark_readonly(void)
1409
1408
rcu_barrier ();
1410
1409
mark_rodata_ro ();
1411
1410
rodata_test ();
1412
- } else
1411
+ } else if ( IS_ENABLED ( CONFIG_STRICT_KERNEL_RWX )) {
1413
1412
pr_info ("Kernel memory protection disabled.\n" );
1413
+ } else if (IS_ENABLED (CONFIG_ARCH_HAS_STRICT_KERNEL_RWX )) {
1414
+ pr_warn ("Kernel memory protection not selected by kernel config.\n" );
1415
+ } else {
1416
+ pr_warn ("This architecture does not have kernel memory protection.\n" );
1417
+ }
1414
1418
}
1415
- #elif defined(CONFIG_ARCH_HAS_STRICT_KERNEL_RWX )
1416
- static inline void mark_readonly (void )
1417
- {
1418
- pr_warn ("Kernel memory protection not selected by kernel config.\n" );
1419
- }
1420
- #else
1421
- static inline void mark_readonly (void )
1422
- {
1423
- pr_warn ("This architecture does not have kernel memory protection.\n" );
1424
- }
1425
- #endif
1426
1419
1427
1420
void __weak free_initmem (void )
1428
1421
{
You can’t perform that action at this time.
0 commit comments