Skip to content

Commit

Permalink
csky: uprobes: Restore thread.trap_no
Browse files Browse the repository at this point in the history
thread.trap_no 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>
Signed-off-by: Guo Ren <guoren@kernel.org>
  • Loading branch information
Tiezhu Yang authored and Guo Ren committed Jun 18, 2023
1 parent ac9a786 commit dd64621
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions arch/csky/kernel/probes/uprobes.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ int arch_uprobe_post_xol(struct arch_uprobe *auprobe, struct pt_regs *regs)
struct uprobe_task *utask = current->utask;

WARN_ON_ONCE(current->thread.trap_no != UPROBE_TRAP_NR);
current->thread.trap_no = utask->autask.saved_trap_no;

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

Expand Down Expand Up @@ -101,6 +102,8 @@ void arch_uprobe_abort_xol(struct arch_uprobe *auprobe, struct pt_regs *regs)
{
struct uprobe_task *utask = current->utask;

current->thread.trap_no = utask->autask.saved_trap_no;

/*
* Task has received a fatal signal, so reset back to probed
* address.
Expand Down

0 comments on commit dd64621

Please sign in to comment.