From: Douglas Anderson Date: Thu, 7 May 2020 20:08:44 +0000 (-0700) Subject: kgdb: Prevent infinite recursive entries to the debugger X-Git-Tag: v5.7.5~324 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=110f2f766db4b1ce0012331bb5ee4a2c17cc2e0e;p=users%2Fdwmw2%2Flinux.git kgdb: Prevent infinite recursive entries to the debugger [ Upstream commit 3ca676e4ca60d1834bb77535dafe24169cadacef ] If we detect that we recursively entered the debugger we should hack our I/O ops to NULL so that the panic() in the next line won't actually cause another recursion into the debugger. The first line of kgdb_panic() will check this and return. Signed-off-by: Douglas Anderson Reviewed-by: Daniel Thompson Link: https://lore.kernel.org/r/20200507130644.v4.6.I89de39f68736c9de610e6f241e68d8dbc44bc266@changeid Signed-off-by: Daniel Thompson Signed-off-by: Sasha Levin --- diff --git a/kernel/debug/debug_core.c b/kernel/debug/debug_core.c index 950dc667c8234..d47c7d6656cd3 100644 --- a/kernel/debug/debug_core.c +++ b/kernel/debug/debug_core.c @@ -532,6 +532,7 @@ static int kgdb_reenter_check(struct kgdb_state *ks) if (exception_level > 1) { dump_stack(); + kgdb_io_module_registered = false; panic("Recursive entry to debugger"); }