Skip to content

RFC Hardware Breakpoint interfaces

K.Prasad lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest9 patches 13 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/9Introducing generic hardware breakpoint handler interfacesinclude/asm-generic/hw_breakpoint.h kernel/hw_breakpoint.c+967 -02 replies
2/9x86 architecture implementation of Hardware Breakpoint interfacesarch/x86/kernel/Makefile arch/x86/kernel/hw_breakpoint.c include/asm-x86/hw_breakpoint.h+806 -14 replies
3/9Modifying generic debug exception to use virtual debug registersarch/x86/kernel/traps_32.c arch/x86/kernel/traps_64.c+54 -770 replies
4/9Modify kprobe exception handler to recognise single-stepping by HW Breakpoint handlerarch/x86/kernel/kprobes.c include/asm-x86/kprobes.h+24 -20 replies
5/9Use wrapper routines around debug registers in processor related functionsarch/x86/kernel/smpboot.c arch/x86/power/cpu_32.c arch/x86/power/cpu_64.c +2 more+41 -320 replies
6/9Use virtual debug registers in process/thread handling codearch/x86/kernel/process_32.c arch/x86/kernel/process_64.c+79 -542 replies
7/9Modify signal handling code to refrain from re-enabling HW Breakpointsarch/x86/kernel/signal_32.c arch/x86/kernel/signal_64.c+0 -170 replies
8/9Modify Ptrace to use wrapper routines to access breakpoint registersarch/x86/kernel/ptrace.c+4 -970 replies
9/9Cleanup HW Breakpoint registers before kexecarch/x86/kernel/machine_kexec_32.c arch/x86/kernel/machine_kexec_64.c+4 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC Patch 0/9] Hardware Breakpoint interfaces

Hi All,
In the ensuing mails, please find the patches that provide
interfaces to use Hardware Breakpoint (or Hardware watchpoint registers) for addresses in kernel- and user-space.

This work is primarily based on the patches that were discussed earlier on Linux Kernel Mailing List (http://lkml.org/lkml/2007/3/2/221) through a discussion initiated by Alan Stern and carried forward with extensive help from Roland McGrath (copied). They now ported to the most recent kernel version (2.6.27-rc9) along with changes to the invocation of '@triggered' function (presently split into pre_ and post_handler routines).

These patches add a new feature to the kernel i.e. use HW breakpoint registers to watch kernel-space data (for read/write operations) and kernel instructions for execute operations. The interfaces introduced through these patches for handling HW Breakpoint registers, namely (un)register_<kernel/user>_hw_breakpoint() are intended to serve as core-routines that will interact with the hardware registers directly, while the users of breakpoint registers will do so through these interfaces. Given the large number of such users in the kernel (such as KGDB, KVM for kernel-space), not all of them have been modified to use the proposed interfaces - atleast in this iteration of patches.

The patches are marked as [RFC], meaning that there is plenty of 'work-in-progress' and here is a near-exhaustive list of them:

- Enable KGDB and KVM to use the register_kernel_hw_breakpoint() interface for their HW Breakpoint usage, in the absence of which they will be broken during simultaneous use.
- Stress test the patches to study the behaviour during multiple requests from various sources/requests beyond available number of registers.
- Support multiple handlers for a given breakpoint in kernel- or user-space address.
- Provide complete breakpoint functionality in x86 i.e. include breakpoints on I/O operations.
- Addition of Documentation/hw_bkpt.txt and samples/hw_breakpoint/*.c files for better readability.
- Code re-arrangement to avoid the #include of kernel/hw_breakpoint.c in arch/x86/kernel/hw_breakpoint.c

Thanks,
K.Prasad