linux-stable/arch
Nam Cao b0fd19e01b riscv: force PAGE_SIZE linear mapping if debug_pagealloc is enabled
commit c67ddf59ac upstream.

debug_pagealloc is a debug feature which clears the valid bit in page table
entry for freed pages to detect illegal accesses to freed memory.

For this feature to work, virtual mapping must have PAGE_SIZE resolution.
(No, we cannot map with huge pages and split them only when needed; because
pages can be allocated/freed in atomic context and page splitting cannot be
done in atomic context)

Force linear mapping to use small pages if debug_pagealloc is enabled.

Note that it is not necessary to force the entire linear mapping, but only
those that are given to memory allocator. Some parts of memory can keep
using huge page mapping (for example, kernel's executable code). But these
parts are minority, so keep it simple. This is just a debug feature, some
extra overhead should be acceptable.

Fixes: 5fde3db5eb ("riscv: add ARCH_SUPPORTS_DEBUG_PAGEALLOC support")
Signed-off-by: Nam Cao <namcao@linutronix.de>
Cc: stable@vger.kernel.org
Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Link: https://lore.kernel.org/r/2e391fa6c6f9b3fcf1b41cefbace02ee4ab4bf59.1715750938.git.namcao@linutronix.de
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-06-21 14:40:35 +02:00
..
alpha
arc ARC: [plat-hsdk]: Remove misplaced interrupt-cells property 2024-04-16 10:45:57 -07:00
arm ARM: dts: samsung: exynos4412-origen: fix keypad no-autorepeat 2024-06-16 13:51:11 +02:00
arm64 KVM: arm64: AArch32: Fix spurious trapping of conditional instructions 2024-06-16 13:51:02 +02:00
csky
hexagon
loongarch LoongArch: Fix entry point in kernel image header 2024-06-16 13:51:03 +02:00
m68k m68k: Move ARCH_HAS_CPU_CACHE_ALIASING 2024-05-30 09:44:34 +02:00
microblaze microblaze: Remove early printk call from cpuinfo-static.c 2024-06-12 11:39:14 +02:00
mips Fix for syscall_get_nr() to make it work even if tracing is disabled 2024-04-12 08:46:58 -07:00
nios2 nios2: Only use built-in devicetree blob if configured to do so 2024-04-03 14:35:53 -05:00
openrisc openrisc: traps: Don't send signals to kernel mode threads 2024-05-30 09:44:21 +02:00
parisc parisc: Try to fix random segmentation faults in package builds 2024-06-21 14:40:28 +02:00
powerpc powerpc/uaccess: Fix build errors seen with GCC 13/14 2024-06-21 14:40:15 +02:00
riscv riscv: force PAGE_SIZE linear mapping if debug_pagealloc is enabled 2024-06-21 14:40:35 +02:00
s390 s390/cpacf: Make use of invalid opcode produce a link error 2024-06-16 13:51:12 +02:00
sh Revert "sh: Handle calling csum_partial with misaligned data" 2024-05-30 09:44:29 +02:00
sparc sparc: move struct termio to asm/termios.h 2024-06-16 13:51:10 +02:00
um um: Fix the declaration of kasan_map_memory 2024-06-12 11:39:32 +02:00
x86 x86/amd_nb: Check for invalid SMN reads 2024-06-21 14:40:30 +02:00
xtensa Xtensa fixes for v6.9: 2024-05-02 10:41:28 -07:00
.gitignore
Kconfig cpu: Re-enable CPU mitigations by default for !X86 architectures 2024-04-25 15:47:35 +02:00