From: Srikar Dronamraju on 20 Mar 2010 10:30
This patchset implements Uprobes which enables you to dynamically break
into any routine in a user space application and collect information
This patchset is a rework based on suggestions from discussions on lkml
in January this year (http://lkml.org/lkml/2010/1/11/92 and
http://lkml.org/lkml/2010/1/27/19). This implementation of uprobes
doesnt depend on utrace.
When a uprobe is registered, Uprobes makes a copy of the probed
instruction, replaces the first byte(s) of the probed instruction with a
breakpoint instruction. (Uprobes uses background page replacement
mechanism and ensures that the breakpoint affects only that process.)
When a CPU hits the breakpoint instruction, Uprobes gets notified of
trap and finds the associated uprobe. It then executes the associated
handler. Uprobes single-steps its copy of the probed instruction and
resumes execution of the probed process at the instruction following the
probepoint. Instruction copies to be single-stepped are stored in a
per-process "execution out of line (XOL) area". Currently XOL area is
allocated as one page vma.
Advantages of uprobes over conventional debugging include:
2. Much better handling of multithreaded programs because of XOL.
3. No context switch between tracer, tracee.
4. Allows multiple processes to trace same tracee.
Here is the list of TODO Items.
- Provide a perf interface to uprobes. (coming in next version)
- Allowing probes across fork/exec.
- Allowing probes on per-executable/per dso.
- Allow multiple probes to share a probepoint.
- Support for other architectures.
- Return probes.
- Uprobes booster.
This patchset is based on 2.6.34-rc2.
Please do provide your valuable comments.
Thanks in advance.
Srikar Dronamraju (10):
1. X86 instruction analysis: Move Macro W to insn.h
2. mm: Move replace_page() to mm/memory.c
3. mm: Enhance replace_page() to support pagecache
4. user_bkpt: User Space Breakpoint Assistance Layer
5. user_bkpt: X86 details for User space breakpoint assistance
6. user_bkpt: Slot allocation for Execution out of line
7. uprobes: Uprobes Implementation
8. uprobes: X86 details for Uprobes
9. uprobes: Uprobes Documentation patch
10. samples: Uprobes samples
Documentation/uprobes.txt | 244 ++++++++++++
arch/Kconfig | 31 ++
arch/x86/Kconfig | 2 +
arch/x86/include/asm/insn.h | 7 +
arch/x86/include/asm/user_bkpt.h | 43 ++
arch/x86/kernel/Makefile | 3 +
arch/x86/kernel/kprobes.c | 7 -
arch/x86/kernel/uprobes.c | 87 ++++
arch/x86/kernel/user_bkpt.c | 574 +++++++++++++++++++++++++++
include/linux/mm.h | 2 +
include/linux/sched.h | 3 +
include/linux/tracehook.h | 18 +
include/linux/uprobes.h | 178 +++++++++
include/linux/user_bkpt.h | 296 ++++++++++++++
include/linux/user_bkpt_xol.h | 61 +++
kernel/Makefile | 3 +
kernel/fork.c | 3 +
kernel/uprobes.c | 798 ++++++++++++++++++++++++++++++++++++++
kernel/user_bkpt.c | 572 +++++++++++++++++++++++++++
kernel/user_bkpt_xol.c | 290 ++++++++++++++
mm/ksm.c | 59 ---
mm/memory.c | 62 +++
samples/Kconfig | 7 +
samples/uprobes/Makefile | 17 +
samples/uprobes/uprobe_example.c | 83 ++++
25 files changed, 3384 insertions(+), 66 deletions(-)
0 files changed, 0 insertions(+), 0 deletions(-)
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Prev: [PATCH 19/24] staging/dream: fix dangling pointers
Next: Prize Won!