riscv: misaligned: Restrict user access to kernel memory
authorSamuel Holland <samuel.holland@sifive.com>
Thu, 15 Aug 2024 00:57:03 +0000 (17:57 -0700)
committerPalmer Dabbelt <palmer@rivosinc.com>
Sun, 1 Sep 2024 00:43:38 +0000 (17:43 -0700)
commitb686ecdeacf6658e1348c1a32a08e2e72f7c0f00
treeb2c17c1d91bd7c7485b5d784032031c2d597d2fb
parent84cfab9a1805f8e300e945f26e3fdff6d125bc20
riscv: misaligned: Restrict user access to kernel memory

raw_copy_{to,from}_user() do not call access_ok(), so this code allowed
userspace to access any virtual memory address.

Cc: stable@vger.kernel.org
Fixes: 7c83232161f6 ("riscv: add support for misaligned trap handling in S-mode")
Fixes: 441381506ba7 ("riscv: misaligned: remove CONFIG_RISCV_M_MODE specific code")
Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Link: https://lore.kernel.org/r/20240815005714.1163136-1-samuel.holland@sifive.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
arch/riscv/kernel/traps_misaligned.c