linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 0/4] kgdb: Honour the kprobe blacklist when setting breakpoints
@ 2020-06-05 13:21 Daniel Thompson
  2020-06-05 13:21 ` [RFC PATCH 1/4] " Daniel Thompson
                   ` (4 more replies)
  0 siblings, 5 replies; 14+ messages in thread
From: Daniel Thompson @ 2020-06-05 13:21 UTC (permalink / raw)
  To: Jason Wessel, Douglas Anderson
  Cc: Daniel Thompson, Peter Zijlstra, sumit.garg, pmladek,
	sergey.senozhatsky, will, kgdb-bugreport, linux-kernel, patches

kgdb has traditionally adopted a no safety rails approach to breakpoint
placement. If the debugger is commanded to place a breakpoint at an
address then it will do so even if that breakpoint results in kgdb
becoming inoperable.

A stop-the-world debugger with memory peek/poke does intrinsically
provide its operator with the means to hose their system in all manner
of exciting ways (not least because stopping-the-world is already a DoS
attack ;-) ) but the current no safety rail approach is not easy to
defend, especially given kprobes provides us with plenty of machinery to
mark parts of the kernel where breakpointing is discouraged.

This patchset introduces some safety rails by using the existing
kprobes infrastructure. It does not cover all locations where
breakpoints can cause trouble but it will definitely block off several
avenues, including the architecture specific parts that are handled by
arch_within_kprobe_blacklist().

This patch is an RFC because:

1. My workstation is still chugging through the compile testing.

2. Patch 4 needs more runtime testing.

3. The code to extract the kprobe blacklist code (patch 4 again) needs
   more review especially for its impact on arch specific code.

To be clear I do plan to do the detailed review of the kprobe blacklist
stuff but would like to check the direction of travel first since the
change is already surprisingly big and maybe there's a better way to
organise things.


Daniel.


Daniel Thompson (4):
  kgdb: Honour the kprobe blacklist when setting breakpoints
  kgdb: Use the kprobe blacklist to limit single stepping
  kgdb: Add NOKPROBE labels on the trap handler functions
  kprobes: Allow the kprobes blacklist to be compiled independently

 arch/Kconfig                            |   6 +-
 arch/arm/probes/kprobes/Makefile        |   1 +
 arch/arm/probes/kprobes/blacklist.c     |  37 ++++
 arch/arm/probes/kprobes/core.c          |  10 -
 arch/powerpc/kernel/Makefile            |   1 +
 arch/powerpc/kernel/kprobes-blacklist.c |  34 ++++
 arch/powerpc/kernel/kprobes.c           |   8 -
 include/asm-generic/kprobes.h           |   2 +-
 include/asm-generic/vmlinux.lds.h       |   2 +-
 include/linux/kgdb.h                    |   1 +
 include/linux/kprobes.h                 |  29 ++-
 kernel/Makefile                         |   1 +
 kernel/debug/debug_core.c               |  31 +++
 kernel/debug/gdbstub.c                  |  10 +-
 kernel/debug/kdb/kdb_bp.c               |  17 +-
 kernel/debug/kdb/kdb_main.c             |  10 +-
 kernel/kprobes.c                        | 204 +------------------
 kernel/kprobes_blacklist.c              | 260 ++++++++++++++++++++++++
 lib/Kconfig.kgdb                        |   1 +
 19 files changed, 427 insertions(+), 238 deletions(-)
 create mode 100644 arch/arm/probes/kprobes/blacklist.c
 create mode 100644 arch/powerpc/kernel/kprobes-blacklist.c
 create mode 100644 kernel/kprobes_blacklist.c

--
2.25.4


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2020-06-12 11:05 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-05 13:21 [RFC PATCH 0/4] kgdb: Honour the kprobe blacklist when setting breakpoints Daniel Thompson
2020-06-05 13:21 ` [RFC PATCH 1/4] " Daniel Thompson
2020-06-05 13:21 ` [RFC PATCH 2/4] kgdb: Use the kprobe blacklist to limit single stepping Daniel Thompson
2020-06-05 13:21 ` [RFC PATCH 3/4] kgdb: Add NOKPROBE labels on the trap handler functions Daniel Thompson
2020-06-11 12:43   ` Masami Hiramatsu
2020-06-05 13:21 ` [RFC PATCH 4/4] kprobes: Allow the kprobes blacklist to be compiled independently Daniel Thompson
2020-06-05 14:29 ` [RFC PATCH 0/4] kgdb: Honour the kprobe blacklist when setting breakpoints Peter Zijlstra
2020-06-05 14:44   ` Peter Zijlstra
2020-06-08 13:50     ` Daniel Thompson
2020-06-08 12:43   ` Daniel Thompson
2020-06-11 12:42   ` Masami Hiramatsu
2020-06-11 14:32     ` Daniel Thompson
2020-06-12 10:13       ` Masami Hiramatsu
2020-06-12 11:04         ` Daniel Thompson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).