static int post_kp_core_handler(struct kp_core_ctlblk *kcb,
struct pt_regs *regs)
{
+ bool put_curr = false;
struct kp_core *cur = kp_core_running();
struct restore_data *restore = current_restore_td();
if (is_ss_setup(restore)) {
regs->pc = restore->restore_addr;
restore->restore_addr = 0;
- kp_core_put(cur);
+ put_curr = true;
} else {
WARN_ON(1);
}
kp_core_running_set(NULL);
}
+ if (put_curr) {
+ switch_to_bits_reset(current_kctx, SWITCH_TO_KP);
+ kp_core_put(cur);
+ }
+
return 1;
}
struct kp_core *p, *cur;
struct kp_core_ctlblk *kcb;
unsigned long addr = regs->pc;
- struct restore_data *restore = current_restore_td();
+ struct kctx *ctx = current_kctx;
+ struct restore_data *restore;
+
+ if (regs->pc == sched_addr)
+ switch_to_bits_set(ctx, SWITCH_TO_KP);
kcb = kp_core_ctlblk();
cur = kp_core_running();
+ restore = current_restore_td();
rcu_read_lock();
p = kp_core_by_addr(addr);
if (p) {
if (cur && reenter_kp_core(p, regs, kcb)) {
- if (!is_ss_setup(restore))
+ if (!is_ss_setup(restore)) {
+ switch_to_bits_reset(ctx, SWITCH_TO_KP);
kp_core_put(p);
+ }
return DBG_HANDLED;
} else if (!p->ainsn.check_condn ||
nop_singlestep_skip(regs);
}
- if (!is_ss_setup(restore))
+ if (!is_ss_setup(restore)) {
+ switch_to_bits_reset(ctx, SWITCH_TO_KP);
kp_core_put(p);
+ }
} else if (*(kprobe_opcode_t *)addr != BRK64_OPCODE_BP) {
/*
* The breakpoint instruction was removed right