Skip to content

Commit c2e59d1

Browse files
committed
csky: Fixup perf probe -x hungup
case: # perf probe -x /lib/libc-2.28.9000.so memcpy # perf record -e probe_libc:memcpy -aR sleep 1 System hangup and cpu get in trap_c loop, because our hardware singlestep state could still get interrupt signal. When we get in uprobe_xol singlestep slot, we should disable irq in pt_regs->psr. And is_swbp_insn() need a csky arch implementation with a low 16bit mask. Signed-off-by: Guo Ren <[email protected]> Cc: Steven Rostedt (VMware) <[email protected]>
1 parent bd11aab commit c2e59d1

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

arch/csky/kernel/probes/uprobes.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111

1212
#define UPROBE_TRAP_NR UINT_MAX
1313

14+
bool is_swbp_insn(uprobe_opcode_t *insn)
15+
{
16+
return (*insn & 0xffff) == UPROBE_SWBP_INSN;
17+
}
18+
1419
unsigned long uprobe_get_swbp_addr(struct pt_regs *regs)
1520
{
1621
return instruction_pointer(regs);

arch/csky/kernel/ptrace.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ static void singlestep_disable(struct task_struct *tsk)
4141

4242
regs = task_pt_regs(tsk);
4343
regs->sr = (regs->sr & TRACE_MODE_MASK) | TRACE_MODE_RUN;
44+
45+
/* Enable irq */
46+
regs->sr |= BIT(6);
4447
}
4548

4649
static void singlestep_enable(struct task_struct *tsk)
@@ -49,6 +52,9 @@ static void singlestep_enable(struct task_struct *tsk)
4952

5053
regs = task_pt_regs(tsk);
5154
regs->sr = (regs->sr & TRACE_MODE_MASK) | TRACE_MODE_SI;
55+
56+
/* Disable irq */
57+
regs->sr &= ~BIT(6);
5258
}
5359

5460
/*

0 commit comments

Comments
 (0)