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

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'riscv-for-linus-5.13-mw1' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux

Pull RISC-V fixes from Palmer Dabbelt:

- A fix to avoid over-allocating the kernel's mapping on !MMU systems,
which could lead to up to 2MiB of lost memory

- The SiFive address extension errata only manifest on rv64, they are
now disabled on rv32 where they are unnecessary

- A pair of late-landing cleanups

* tag 'riscv-for-linus-5.13-mw1' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux:
riscv: remove unused handle_exception symbol
riscv: Consistify protect_kernel_linear_mapping_text_rodata() use
riscv: enable SiFive errata CIP-453 and CIP-1200 Kconfig only if CONFIG_64BIT=y
riscv: Only extend kernel reservation if mapped read-only

+16 -10
+2 -2
arch/riscv/Kconfig.erratas
··· 21 21 22 22 config ERRATA_SIFIVE_CIP_453 23 23 bool "Apply SiFive errata CIP-453" 24 - depends on ERRATA_SIFIVE 24 + depends on ERRATA_SIFIVE && 64BIT 25 25 default y 26 26 help 27 27 This will apply the SiFive CIP-453 errata to add sign extension ··· 32 32 33 33 config ERRATA_SIFIVE_CIP_1200 34 34 bool "Apply SiFive errata CIP-1200" 35 - depends on ERRATA_SIFIVE 35 + depends on ERRATA_SIFIVE && 64BIT 36 36 default y 37 37 help 38 38 This will apply the SiFive CIP-1200 errata to repalce all
+6 -1
arch/riscv/include/asm/set_memory.h
··· 17 17 int set_memory_nx(unsigned long addr, int numpages); 18 18 int set_memory_rw_nx(unsigned long addr, int numpages); 19 19 void protect_kernel_text_data(void); 20 - void protect_kernel_linear_mapping_text_rodata(void); 21 20 #else 22 21 static inline int set_memory_ro(unsigned long addr, int numpages) { return 0; } 23 22 static inline int set_memory_rw(unsigned long addr, int numpages) { return 0; } ··· 24 25 static inline int set_memory_nx(unsigned long addr, int numpages) { return 0; } 25 26 static inline void protect_kernel_text_data(void) {} 26 27 static inline int set_memory_rw_nx(unsigned long addr, int numpages) { return 0; } 28 + #endif 29 + 30 + #if defined(CONFIG_64BIT) && defined(CONFIG_STRICT_KERNEL_RWX) 31 + void protect_kernel_linear_mapping_text_rodata(void); 32 + #else 33 + static inline void protect_kernel_linear_mapping_text_rodata(void) {} 27 34 #endif 28 35 29 36 int set_direct_map_invalid_noflush(struct page *page);
-2
arch/riscv/kernel/setup.c
··· 293 293 294 294 if (IS_ENABLED(CONFIG_STRICT_KERNEL_RWX)) { 295 295 protect_kernel_text_data(); 296 - #if defined(CONFIG_64BIT) && defined(CONFIG_MMU) && !defined(CONFIG_XIP_KERNEL) 297 296 protect_kernel_linear_mapping_text_rodata(); 298 - #endif 299 297 } 300 298 301 299 #ifdef CONFIG_SWIOTLB
-2
arch/riscv/kernel/traps.c
··· 25 25 26 26 int show_unhandled_signals = 1; 27 27 28 - extern asmlinkage void handle_exception(void); 29 - 30 28 static DEFINE_SPINLOCK(die_lock); 31 29 32 30 void die(struct pt_regs *regs, const char *str)
+8 -3
arch/riscv/mm/init.c
··· 135 135 136 136 /* 137 137 * Reserve from the start of the kernel to the end of the kernel 138 - * and make sure we align the reservation on PMD_SIZE since we will 138 + */ 139 + #if defined(CONFIG_64BIT) && defined(CONFIG_STRICT_KERNEL_RWX) 140 + /* 141 + * Make sure we align the reservation on PMD_SIZE since we will 139 142 * map the kernel in the linear mapping as read-only: we do not want 140 143 * any allocation to happen between _end and the next pmd aligned page. 141 144 */ 142 - memblock_reserve(vmlinux_start, (vmlinux_end - vmlinux_start + PMD_SIZE - 1) & PMD_MASK); 145 + vmlinux_end = (vmlinux_end + PMD_SIZE - 1) & PMD_MASK; 146 + #endif 147 + memblock_reserve(vmlinux_start, vmlinux_end - vmlinux_start); 143 148 144 149 /* 145 150 * memblock allocator is not aware of the fact that last 4K bytes of ··· 645 640 #endif 646 641 } 647 642 648 - #if defined(CONFIG_64BIT) && !defined(CONFIG_XIP_KERNEL) 643 + #if defined(CONFIG_64BIT) && defined(CONFIG_STRICT_KERNEL_RWX) 649 644 void protect_kernel_linear_mapping_text_rodata(void) 650 645 { 651 646 unsigned long text_start = (unsigned long)lm_alias(_start);