diff options
author | Palmer Dabbelt <palmerdabbelt@google.com> | 2021-07-01 06:50:32 +0200 |
---|---|---|
committer | Palmer Dabbelt <palmerdabbelt@google.com> | 2021-07-01 06:50:32 +0200 |
commit | 01112e5e20f5298a81639806cd0a3c587aade467 (patch) | |
tree | b453c32b2e3a8905da331a81ad234c17b62cb9dc /arch/riscv/kernel | |
parent | riscv: Enable KFENCE for riscv64 (diff) | |
parent | riscv: Map the kernel with correct permissions the first time (diff) | |
download | linux-01112e5e20f5298a81639806cd0a3c587aade467.tar.xz linux-01112e5e20f5298a81639806cd0a3c587aade467.zip |
Merge branch 'riscv-wx-mappings' into for-next
This contains both the short-term fix for the W+X boot mappings and the
larger cleanup.
* riscv-wx-mappings:
riscv: Map the kernel with correct permissions the first time
riscv: Introduce set_kernel_memory helper
riscv: Simplify xip and !xip kernel address conversion macros
riscv: Remove CONFIG_PHYS_RAM_BASE_FIXED
riscv: mm: Fix W+X mappings at boot
Diffstat (limited to 'arch/riscv/kernel')
-rw-r--r-- | arch/riscv/kernel/setup.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c index 5c6d2a1fdbc7..b0c6f372a9ec 100644 --- a/arch/riscv/kernel/setup.c +++ b/arch/riscv/kernel/setup.c @@ -289,11 +289,6 @@ void __init setup_arch(char **cmdline_p) init_resources(); sbi_init(); - if (IS_ENABLED(CONFIG_STRICT_KERNEL_RWX)) { - protect_kernel_text_data(); - protect_kernel_linear_mapping_text_rodata(); - } - #ifdef CONFIG_KASAN kasan_init(); #endif @@ -328,11 +323,10 @@ subsys_initcall(topology_init); void free_initmem(void) { - unsigned long init_begin = (unsigned long)__init_begin; - unsigned long init_end = (unsigned long)__init_end; - if (IS_ENABLED(CONFIG_STRICT_KERNEL_RWX)) - set_memory_rw_nx(init_begin, (init_end - init_begin) >> PAGE_SHIFT); + set_kernel_memory(lm_alias(__init_begin), lm_alias(__init_end), + IS_ENABLED(CONFIG_64BIT) ? + set_memory_rw : set_memory_rw_nx); free_initmem_default(POISON_FREE_INITMEM); } |