linux-stable/arch
Nam Cao c72f348d64 riscv: fix overlap of allocated page and PTR_ERR
commit 994af1825a upstream.

On riscv32, it is possible for the last page in virtual address space
(0xfffff000) to be allocated. This page overlaps with PTR_ERR, so that
shouldn't happen.

There is already some code to ensure memblock won't allocate the last page.
However, buddy allocator is left unchecked.

Fix this by reserving physical memory that would be mapped at virtual
addresses greater than 0xfffff000.

Reported-by: Björn Töpel <bjorn@kernel.org>
Closes: https://lore.kernel.org/linux-riscv/878r1ibpdn.fsf@all.your.base.are.belong.to.us
Fixes: 76d2a0493a ("RISC-V: Init and Halt Code")
Signed-off-by: Nam Cao <namcao@linutronix.de>
Cc: <stable@vger.kernel.org>
Tested-by: Björn Töpel <bjorn@rivosinc.com>
Reviewed-by: Björn Töpel <bjorn@rivosinc.com>
Reviewed-by: Mike Rapoport (IBM) <rppt@kernel.org>
Link: https://lore.kernel.org/r/20240425115201.3044202-1-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:31 +02:00
..
alpha Kbuild updates for v6.9 2024-03-21 14:41:00 -07:00
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 hexagon: vmlinux.lds.S: handle attributes section 2024-03-26 11:07:23 -07:00
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: fix overlap of allocated page and PTR_ERR 2024-06-21 14:40:31 +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