[RFC][PATCH] Kprobes robust fault handling for i386

Frank Ch. Eigler fche@redhat.com
Wed Apr 26 19:51:00 GMT 2006


prasanna wrote:

> [...]  IIUC you are planning on setjmp/longjmp() in systemtap
> generated handlers themselves ?

That was one idea, yeah.

> This can be achieved even without the robust fault handling code.

Except I can't find any general setjmp/longjmp implementation in the
kernel.

> [...]
> 	if ((setjmp(systemtap_jmp_buffer)) != 0) {
> 		<cleanup code>
> 	}
> 	copy_from_user_inatomic(.....);

(The systemtap-emitted setjmp would likely be in the probe prologue
boilerplate, not associated with copy_from_user so closely.)

> [...]
> systemtap_faulthandler(....)
> 	regs->eip = (unsigned long) systemtap_fault_trampoline;
> 	return 1; /*kprobe handler need not do anything else */

"instruction_register(regs)" instead "regs->eip" for portability,
right?

> [...]
> systemtap_fault_trampoline(void)
> 	longjmp(systemtap_jmp_buffer);
> 	return;

That sounds simple enough (assuming the availability of longjmp).


- FChE



More information about the Systemtap mailing list