• Daniel Thompson's avatar
    kgdb: Add NOKPROBE labels on the trap handler functions · 4c4197ed
    Daniel Thompson authored
    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 they do not include 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).
    Reviewed-by: default avatarDouglas Anderson <dianders@chromium.org>
    Link: https://lore.kernel.org/r/20200927211531.1380577-3-daniel.thompson@linaro.orgSigned-off-by: default avatarDaniel Thompson <daniel.thompson@linaro.org>
    4c4197ed
debug_core.c 29.1 KB