Skip to content

Commit e7a40ae

Browse files
eatvectorRbb666
authored andcommitted
[lwp][rv64] restore tp register in arch_thread_signal_enter to fix user-mode memory access
1 parent 3c04664 commit e7a40ae

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

components/lwp/arch/risc-v/rv64/lwp_gcc.S

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,9 @@ arch_thread_signal_enter:
178178
/* restore user GP */
179179
LOAD gp, FRAME_OFF_GP(s3)
180180

181+
/* restore user TP */
182+
LOAD tp, FRAME_OFF_TP(s3)
183+
181184
/**
182185
* handler(signo, psi, ucontext);
183186
*/

libcpu/risc-v/common64/stackframe.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#define FRAME_OFF_SSTATUS BYTES(2)
4242
#define FRAME_OFF_SP BYTES(32)
4343
#define FRAME_OFF_GP BYTES(3)
44+
#define FRAME_OFF_TP BYTES(4)
4445

4546
/* switch frame */
4647
#define RT_HW_SWITCH_CONTEXT_SSTATUS 0

0 commit comments

Comments
 (0)