x86_64 kprobes wart removal
Jim Keniston
jkenisto@us.ibm.com
Thu Apr 7 22:01:00 GMT 2005
This email is for x86_64 kprobes wonks. Remember get_insn_slot() and
free_insn_slot()? These functions are a constant headache because they
can sleep. That's because get_insn_slot() occasionally has to allocate
a readable, writable, executable page to hold the instruction-copy for a
new kprobe. That's because x86_64 won't single-step (or otherwise
execute) an instruction on a page that isn't mapped executable.
I propose the following alternative:
- Allocate one executable page at the beginning of time. [See note 1.]
- Store the instruction copy in the kprobe object, as in other
arhcitectures.
- When it comes time to single-step an instruction, just copy the
instruction from the kprobe object to the executable page.
- In resume_execution, adjust copy_rip accordingly.
Note 1: If we go to per-CPU locking, we may need to allocate enough
space for NR_CPUS instructions. Also, we still want to use Roland's
trick of allocating the memory close to where the modules live.
I don't have a patch yet, but does that sound like the right approach?
I wish I'd thought of this a year ago. :-}
Jim
More information about the Systemtap
mailing list