Re: [Kgdb-bugreport] [PATCH v6 4/4] kdb: Switch to use safer dbg_io_ops over console APIs

2020-06-05 Thread Petr Mladek
On Thu 2020-06-04 15:31:19, Sumit Garg wrote: > In kgdb context, calling console handlers aren't safe due to locks used > in those handlers which could in turn lead to a deadlock. Although, using > oops_in_progress increases the chance to bypass locks in most console > handlers but it might not be

[Kgdb-bugreport] [RFC PATCH 0/4] kgdb: Honour the kprobe blacklist when setting breakpoints

2020-06-05 Thread Daniel Thompson
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 pro

[Kgdb-bugreport] [RFC PATCH 1/4] kgdb: Honour the kprobe blacklist when setting breakpoints

2020-06-05 Thread Daniel Thompson
Currently kgdb has absolutely no safety rails in place to discourage or prevent a user from placing a breakpoint in dangerous places such as the debugger's own trap entry/exit and other places where it is not safe to take synchronous traps. Modify the default implementation of kgdb_validate_break_

[Kgdb-bugreport] [RFC PATCH 3/4] kgdb: Add NOKPROBE labels on the trap handler functions

2020-06-05 Thread Daniel Thompson
Currently kgdb honours the kprobe blacklist but doesn't place its own trap handling code on the list. Add macros to discourage attempting to use kgdb to debug itself. These changes do not make it impossible to provoke recursive trapping since they do not cover all the calls that can be made on kgd

[Kgdb-bugreport] [RFC PATCH 4/4] kprobes: Allow the kprobes blacklist to be compiled independently

2020-06-05 Thread Daniel Thompson
IMPORTANT: As menitoned in the covering letter, this series in an RFC and this patch, in particular, is acknowledged as needing more work. In particular I haven't trimmed uneccessary #includes after splitting out the code and may also have missed some places where an an architecture over

[Kgdb-bugreport] [RFC PATCH 2/4] kgdb: Use the kprobe blacklist to limit single stepping

2020-06-05 Thread Daniel Thompson
If we are running in a part of the kernel that dislikes breakpoint debugging then it is very unlikely to be safe to single step. Add some safety rails to prevent stepping through anything on the kprobe blacklist. As part of this kdb_ss() will no longer set the DOING_SS flags when it requests a ste

Re: [Kgdb-bugreport] [RFC PATCH 0/4] kgdb: Honour the kprobe blacklist when setting breakpoints

2020-06-05 Thread Peter Zijlstra
On Fri, Jun 05, 2020 at 02:21:26PM +0100, Daniel Thompson wrote: > 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

Re: [Kgdb-bugreport] [RFC PATCH 0/4] kgdb: Honour the kprobe blacklist when setting breakpoints

2020-06-05 Thread Peter Zijlstra
On Fri, Jun 05, 2020 at 04:29:53PM +0200, Peter Zijlstra wrote: > On Fri, Jun 05, 2020 at 02:21:26PM +0100, Daniel Thompson wrote: > > 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