aboutsummaryrefslogtreecommitdiff
path: root/arch/riscv64/kernel/entry.S
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2024-10-30 13:34:18 +0200
committerKimplul <kimi.h.kuparinen@gmail.com>2024-11-01 10:27:36 +0200
commitf139fff6ae7063c1965fa3085bb2585d7d838d72 (patch)
tree7ee9f7c6a1ee09dba93c086cd66861474b821c97 /arch/riscv64/kernel/entry.S
parentb576c1d477bf476f277d32ecf60c312e4a97490d (diff)
downloadkmi-f139fff6ae7063c1965fa3085bb2585d7d838d72.tar.gz
kmi-f139fff6ae7063c1965fa3085bb2585d7d838d72.zip
rpc actually marks and unmarks stack regions
+ Processes won't be able to read previous stack frames etc
Diffstat (limited to 'arch/riscv64/kernel/entry.S')
-rw-r--r--arch/riscv64/kernel/entry.S4
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/riscv64/kernel/entry.S b/arch/riscv64/kernel/entry.S
index f894e0d..48851d4 100644
--- a/arch/riscv64/kernel/entry.S
+++ b/arch/riscv64/kernel/entry.S
@@ -92,6 +92,9 @@ continue_trap:
save_callee
save_caller
+ csrr t0, CSR_SEPC
+ sr t0, offsetof_exec(tp)
+
mv a0, s10
/* get actual kernel stack into sp */
mv sp, tp
@@ -117,6 +120,7 @@ handle_exception:
csrr a0, CSR_SEPC
csrr a1, CSR_STVAL
csrr a2, CSR_SCAUSE
+ sr a0, offsetof_exec(tp)
mv sp, tp
call riscv_handle_exception