Messages in this thread | | | From | Doug Anderson <> | Date | Mon, 28 Sep 2020 15:44:12 -0700 | Subject | Re: [PATCH v3 2/3] kgdb: Add NOKPROBE labels on the trap handler functions |
| |
Hi,
On Sun, Sep 27, 2020 at 2:16 PM Daniel Thompson <daniel.thompson@linaro.org> wrote: > > Currently kgdb honours the kprobe blocklist but doesn't place its own > trap handling code on the list. Add labels to discourage attempting to > use kgdb to debug itself. > > Not every functions that executes from the trap handler needs to be > marked up: relatively early in the trap handler execution (just after > we bring the other CPUs to a halt) all breakpoints are replaced with > the original opcodes. This patch marks up code in the debug_core that > executes between trap entry and the breakpoints being deactivated > and, also, code that executes between breakpoint activation and trap > exit. > > To be clear these changes are not sufficient to make recursive trapping > impossible since cover all the library calls made during kgdb's > entry/exit logic. However going much further whilst we are sharing the > kprobe blocklist risks reducing the capabilities of kprobe and this > would be a bad trade off (especially so given kgdb's users are currently > conditioned to avoid recursive traps). > > Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org> > --- > kernel/debug/debug_core.c | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+)
I didn't go on any more hunts for missing functions since this seems fine to me. It's mostly just trying to make it a little harder for someone to shoot themselves in the foot, after all. ;-)
Reviewed-by: Douglas Anderson <dianders@chromium.org>
-Doug
| |