powerpc/kprobes: Fix handling of instruction emulation on probe re-entry
Commit22d8b3dec2
("powerpc/kprobes: Emulate instructions on kprobe handler re-entry") enabled emulating instructions on kprobe re-entry, rather than single-stepping always. However, we didn't update the single stepping code to only be run if the emulation fails. Also, we missed re-enabling preemption if the instruction emulation was successful. Fix those issues. Fixes:22d8b3dec2
("powerpc/kprobes: Emulate instructions on kprobe handler re-entry") Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
This commit is contained in:
parent
bbb075ddf7
commit
d04c02f8aa
|
@ -305,16 +305,17 @@ int kprobe_handler(struct pt_regs *regs)
|
||||||
save_previous_kprobe(kcb);
|
save_previous_kprobe(kcb);
|
||||||
set_current_kprobe(p, regs, kcb);
|
set_current_kprobe(p, regs, kcb);
|
||||||
kprobes_inc_nmissed_count(p);
|
kprobes_inc_nmissed_count(p);
|
||||||
prepare_singlestep(p, regs);
|
|
||||||
kcb->kprobe_status = KPROBE_REENTER;
|
kcb->kprobe_status = KPROBE_REENTER;
|
||||||
if (p->ainsn.boostable >= 0) {
|
if (p->ainsn.boostable >= 0) {
|
||||||
ret = try_to_emulate(p, regs);
|
ret = try_to_emulate(p, regs);
|
||||||
|
|
||||||
if (ret > 0) {
|
if (ret > 0) {
|
||||||
restore_previous_kprobe(kcb);
|
restore_previous_kprobe(kcb);
|
||||||
|
preempt_enable_no_resched();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
prepare_singlestep(p, regs);
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
if (*addr != BREAKPOINT_INSTRUCTION) {
|
if (*addr != BREAKPOINT_INSTRUCTION) {
|
||||||
|
|
Loading…
Reference in a new issue