mbox series

[00/10] Rework debug exception handling code

Message ID 20190301132809.24653-1-will.deacon@arm.com (mailing list archive)
Headers show
Series Rework debug exception handling code | expand

Message

Will Deacon March 1, 2019, 1:27 p.m. UTC
Hi all,

Our debug exception handling code is a bit of a horror show. Userspace
can trigger kprobe logic to run (which ends up just returning back to
the brk instruction instead of delivering a SIGTRAP) and can also enter
KGDB if it is enabled (which causes a kernel panic due to a NULL
dereference).

These patch fix those problems and tidy up the code so that they're less
likely to happen again in future.

Will

--->8

Will Deacon (10):
  arm64: debug: Don't propagate UNKNOWN FAR into si_code for debug
    signals
  arm64: debug: Ensure debug handlers check triggering exception level
  arm64: debug: Remove unused return value from do_debug_exception()
  arm64: debug: Rename addr parameter for non-watchpoint exception hooks
  arm64: debug: Remove meaningless comment
  arm64: debug: Separate debug hooks based on target exception level
  arm64: kprobes: Avoid calling kprobes debug handlers explicitly
  arm64: debug: Remove redundant user_mode(regs) checks from debug
    handlers
  arm64: probes: Move magic BRK values into brk-imm.h
  arm64: debug: Clean up brk_handler()

 arch/arm64/include/asm/brk-imm.h        |   4 ++
 arch/arm64/include/asm/debug-monitors.h |  24 +++----
 arch/arm64/include/asm/esr.h            |   4 +-
 arch/arm64/include/asm/kprobes.h        |   2 -
 arch/arm64/kernel/debug-monitors.c      | 111 ++++++++++++++++++--------------
 arch/arm64/kernel/kgdb.c                |  28 ++++----
 arch/arm64/kernel/probes/kprobes.c      |  16 ++++-
 arch/arm64/kernel/probes/uprobes.c      |  19 ++----
 arch/arm64/kernel/traps.c               |  21 ++----
 arch/arm64/mm/fault.c                   |  19 ++----
 10 files changed, 127 insertions(+), 121 deletions(-)

Comments

Catalin Marinas March 1, 2019, 4:24 p.m. UTC | #1
On Fri, Mar 01, 2019 at 01:27:59PM +0000, Will Deacon wrote:
> Will Deacon (10):
>   arm64: debug: Don't propagate UNKNOWN FAR into si_code for debug
>     signals
>   arm64: debug: Ensure debug handlers check triggering exception level

I queued the first two patches in this series for 5.1. Thanks.