Skip to content
Unverified Commit c08b4848 authored by Chen Lifu's avatar Chen Lifu Committed by Palmer Dabbelt
Browse files

riscv: lib: uaccess: fix CSR_STATUS SR_SUM bit

Since commit 5d8544e2 ("RISC-V: Generic library routines and assembly")
and commit ebcbd75e ("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: 5d8544e2 ("RISC-V: Generic library routines and assembly")
Fixes: ebcbd75e

 ("riscv: Fix the bug in memory access fixup code")
Signed-off-by: default avatarChen Lifu <chenlifu@huawei.com>
Reviewed-by: default avatarBen 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: default avatarPalmer Dabbelt <palmer@rivosinc.com>
parent 4d1044fc
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment