This is the mail archive of the systemtap@sources.redhat.com mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

kprobe_handler should check pre_handler function


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

Attachment: kprobe_post_handler.tar.gz
Description: Unix tar archive


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]