kprobe_handler should check pre_handler function

William Cohen wcohen@redhat.com
Thu Mar 24 22:20:00 GMT 2005


I found kprobes expects there to be a pre_handler function in the 
structure. I was writing a probe that only needed a post_handler 
function, no pre_handler function. The probe was tracking the 
destinations of indirect calls and jumps, the probe needs to fire after 
the instruction single steps to get the target address. The probe 
crashed the machine because arch/i386/kernel/kprobe.c:kprobe_handler() 
blindly calls p->pre_handler().  There should be a check to verify that 
the pointer is non-null. There are cases where the pre_handler is not 
needed and it would make sense to set it to NULL. Thus, a check should 
be done for pre_handler like post_handler and fault_handler.

-Will
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kprobe_post_handler.tar.gz
Type: application/x-tar
Size: 1447 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/systemtap/attachments/20050324/fc1b1c16/attachment.tar>


More information about the Systemtap mailing list