This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
kprobe fault handling
- From: Martin Hunt <hunt at redhat dot com>
- To: "systemtap at sources dot redhat dot com" <systemtap at sources dot redhat dot com>
- Date: Mon, 06 Feb 2006 11:50:23 -0800
- Subject: kprobe fault handling
- Organization: Red Hat Inc
I've been trying to understand how kprobes fault handling is supposed to
work and why it isn't doing what I thought it did.
When page faults happen, do_page_fault() almost immediately calls
notify_die(DIE_PAGE_FAULT,...) This calls the notifier chain which calls
kprobe_exceptions_notify(). This calls kprobe_fault_handler().
kprobe_fault_handler() checkes to see if there is a specific fault
fandler for that kprobe, and if there is, it calls it. Question: What
do we imagine a probe-specific page fault handler would do? Why is it
useful?
Then there is this code, which I don't understand
if (kcb->kprobe_status & KPROBE_HIT_SS) {
resume_execution(cur, regs, kcb);
regs->eflags |= kcb->kprobe_old_eflags;
reset_current_kprobe();
preempt_enable_no_resched();
}
And that's it. kprobe_fault_handler returns 0. No call to
fixup_exceptions()! So do_page_fault() will have to do the fixups, but
first it will print nasty might_sleep warnings and maybe actually sleep!
I could have sworn this was not the case previously but it has been a
very long time since I have looked at the code at this level. Anyway,
this MUST be fixed.
Martin