int arch_prepare_kprobe(struct kprobe *p)
{ if (!can_probe((unsignedlong)p->addr)) return -EINVAL; /* Make sure the probe isn't going on a difficult instruction */ if (probe_is_prohibited_opcode(p->addr)) return -EINVAL;
p->ainsn.insn = get_insn_slot(); if (!p->ainsn.insn) return -ENOMEM;
copy_instruction(p); return0;
}
NOKPROBE_SYMBOL(arch_prepare_kprobe);
/* Set up the PER control registers %cr9-%cr11 */
per_kprobe.control.val = PER_EVENT_IFETCH;
per_kprobe.start.val = ip;
per_kprobe.end.val = ip;
/* Save control regs and psw mask */
__local_ctl_store(9, 11, kcb->kprobe_saved_ctl);
kcb->kprobe_saved_imask = regs->psw.mask &
(PSW_MASK_PER | PSW_MASK_IO | PSW_MASK_EXT);
/* Set PER control regs, turns on single step for the given address */
__local_ctl_load(9, 11, per_kprobe.regs);
regs->psw.mask |= PSW_MASK_PER;
regs->psw.mask &= ~(PSW_MASK_IO | PSW_MASK_EXT);
regs->psw.addr = ip;
}
NOKPROBE_SYMBOL(enable_singlestep);
staticvoid disable_singlestep(struct kprobe_ctlblk *kcb, struct pt_regs *regs, unsignedlong ip)
{ /* Restore control regs and psw mask, set new psw address */
__local_ctl_load(9, 11, kcb->kprobe_saved_ctl);
regs->psw.mask &= ~PSW_MASK_PER;
regs->psw.mask |= kcb->kprobe_saved_imask;
regs->psw.addr = ip;
}
NOKPROBE_SYMBOL(disable_singlestep);
switch(kcb->kprobe_status) { case KPROBE_HIT_SS: case KPROBE_REENTER: /* *Weareherebecausetheinstructionbeingsingle *steppedcausedapagefault.Weresetthecurrent *kprobeandthenippointsbacktotheprobeaddress *andallowthepagefaulthandlertocontinueasa *normalpagefault.
*/
disable_singlestep(kcb, regs, (unsignedlong) p->addr);
pop_kprobe(kcb);
preempt_enable_no_resched(); break; case KPROBE_HIT_ACTIVE: case KPROBE_HIT_SSDONE: /* *Incasetheuser-specifiedfaulthandlerreturned *zero,trytofixup.
*/ if (fixup_exception(regs)) return1; /* *fixup_exception()couldnothandleit, *Letdo_page_fault()fixit.
*/ break; default: break;
} return0;
}
NOKPROBE_SYMBOL(kprobe_trap_handler);
int kprobe_fault_handler(struct pt_regs *regs, int trapnr)
{ int ret;
if (regs->psw.mask & (PSW_MASK_IO | PSW_MASK_EXT))
local_irq_disable();
ret = kprobe_trap_handler(regs, trapnr); if (regs->psw.mask & (PSW_MASK_IO | PSW_MASK_EXT))
local_irq_restore(regs->psw.mask & ~PSW_MASK_PER); return ret;
}
NOKPROBE_SYMBOL(kprobe_fault_handler);
/* *Wrapperroutinetoforhandlingexceptions.
*/ int kprobe_exceptions_notify(struct notifier_block *self, unsignedlong val, void *data)
{ struct die_args *args = (struct die_args *) data; struct pt_regs *regs = args->regs; int ret = NOTIFY_DONE;
if (regs->psw.mask & (PSW_MASK_IO | PSW_MASK_EXT))
local_irq_disable();
switch (val) { case DIE_BPT: if (kprobe_handler(regs))
ret = NOTIFY_STOP; break; case DIE_SSTEP: if (post_kprobe_handler(regs))
ret = NOTIFY_STOP; break; case DIE_TRAP: if (!preemptible() && kprobe_running() &&
kprobe_trap_handler(regs, args->trapnr))
ret = NOTIFY_STOP; break; default: break;
}
if (regs->psw.mask & (PSW_MASK_IO | PSW_MASK_EXT))
local_irq_restore(regs->psw.mask & ~PSW_MASK_PER);
int __init arch_populate_kprobe_blacklist(void)
{ return kprobe_add_area_blacklist((unsignedlong)__irqentry_text_start,
(unsignedlong)__irqentry_text_end);
}
int arch_trampoline_kprobe(struct kprobe *p)
{ return0;
}
NOKPROBE_SYMBOL(arch_trampoline_kprobe);
Messung V0.5 in Prozent
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.12Bemerkung:
(vorverarbeitet am 2026-09-30)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.