[RFC PATCH 03/12] riscv: after saving expected landing pad (elp), clear elp state
Deepak Gupta
debug at rivosinc.com
Mon Apr 8 23:10:34 PDT 2024
On trap entry, save expected landing pad state and subsequently clear it
in sstatus so that if there are traps later on in kernel and sret happens
back to same mode, cpu will start faulting.
Signed-off-by: Deepak Gupta <debug at rivosinc.com>
---
arch/riscv/kernel/entry.S | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/riscv/kernel/entry.S b/arch/riscv/kernel/entry.S
index 68a24cf9481a..be07355b9eff 100644
--- a/arch/riscv/kernel/entry.S
+++ b/arch/riscv/kernel/entry.S
@@ -56,7 +56,7 @@ SYM_CODE_START(handle_exception)
* Disable the FPU/Vector to detect illegal usage of floating point
* or vector in kernel space.
*/
- li t0, SR_SUM | SR_FS_VS
+ li t0, SR_SUM | SR_FS_VS | SR_ELP
REG_L s0, TASK_TI_USER_SP(tp)
csrrc s1, CSR_STATUS, t0
--
2.43.2
More information about the linux-riscv
mailing list