Skip to content

Commit 58b1294

Browse files
seehearfeelpalmer-dabbelt
authored andcommitted
riscv: uprobes: Restore thread.bad_cause
thread.bad_cause is saved in arch_uprobe_pre_xol(), it should be restored in arch_uprobe_{post,abort}_xol() accordingly, otherwise the save operation is meaningless, this change is similar with x86 and powerpc. Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn> Acked-by: Oleg Nesterov <oleg@redhat.com> Reviewed-by: Guo Ren <guoren@kernel.org> Fixes: 7478408 ("riscv: Add uprobes supported") Link: https://lore.kernel.org/r/1682214146-3756-1-git-send-email-yangtiezhu@loongson.cn Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
1 parent 648321f commit 58b1294

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

arch/riscv/kernel/probes/uprobes.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ int arch_uprobe_post_xol(struct arch_uprobe *auprobe, struct pt_regs *regs)
6767
struct uprobe_task *utask = current->utask;
6868

6969
WARN_ON_ONCE(current->thread.bad_cause != UPROBE_TRAP_NR);
70+
current->thread.bad_cause = utask->autask.saved_cause;
7071

7172
instruction_pointer_set(regs, utask->vaddr + auprobe->insn_size);
7273

@@ -102,6 +103,7 @@ void arch_uprobe_abort_xol(struct arch_uprobe *auprobe, struct pt_regs *regs)
102103
{
103104
struct uprobe_task *utask = current->utask;
104105

106+
current->thread.bad_cause = utask->autask.saved_cause;
105107
/*
106108
* Task has received a fatal signal, so reset back to probbed
107109
* address.

0 commit comments

Comments
 (0)