WSL2-Linux-Kernel/arch/riscv/lib
Chen Lifu 044f8ff30e riscv: lib: uaccess: fix CSR_STATUS SR_SUM bit
[ Upstream commit c08b4848f5 ]

Since commit 5d8544e2d0 ("RISC-V: Generic library routines and assembly")
and commit ebcbd75e39 ("riscv: Fix the bug in memory access fixup code"),
if __clear_user and __copy_user return from an fixup branch,
CSR_STATUS SR_SUM bit will be set, it is a vulnerability, so that
S-mode memory accesses to pages that are accessible by U-mode will success.
Disable S-mode access to U-mode memory should clear SR_SUM bit.

Fixes: 5d8544e2d0 ("RISC-V: Generic library routines and assembly")
Fixes: ebcbd75e39 ("riscv: Fix the bug in memory access fixup code")
Signed-off-by: Chen Lifu <chenlifu@huawei.com>
Reviewed-by: Ben Dooks <ben.dooks@codethink.co.uk>
Link: https://lore.kernel.org/r/20220615014714.1650349-1-chenlifu@huawei.com
Cc: stable@vger.kernel.org
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-08-31 17:16:36 +02:00
..
Makefile riscv: Add support for function error injection 2021-01-14 15:09:09 -08:00
delay.c
error-inject.c riscv: Add support for function error injection 2021-01-14 15:09:09 -08:00
memcpy.S riscv: Add KASAN support 2020-01-22 13:09:58 -08:00
memmove.S riscv: Fixed misaligned memory access. Fixed pointer comparison. 2022-04-13 20:59:09 +02:00
memset.S riscv: Add KASAN support 2020-01-22 13:09:58 -08:00
tishift.S riscv: Less inefficient gcc tishift helpers (and export their symbols) 2020-01-18 19:13:41 -08:00
uaccess.S riscv: lib: uaccess: fix CSR_STATUS SR_SUM bit 2022-08-31 17:16:36 +02:00