]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit
kdb: Make memory allocations more robust
authorSumit Garg <sumit.garg@linaro.org>
Fri, 22 Jan 2021 11:05:56 +0000 (16:35 +0530)
committerAndrea Righi <andrea.righi@canonical.com>
Mon, 15 Mar 2021 14:08:49 +0000 (15:08 +0100)
commit5c305d449ef8c58fc48fc0521735421758b8e134
tree75eecdff29c72b562a7d0de4285ee1f5d763477a
parent28db7c1f5785e3a89a10ff1fbd13653a2a66b33d
kdb: Make memory allocations more robust

commit 93f7a6d818deef69d0ba652d46bae6fbabbf365c upstream.

Currently kdb uses in_interrupt() to determine whether its library
code has been called from the kgdb trap handler or from a saner calling
context such as driver init. This approach is broken because
in_interrupt() alone isn't able to determine kgdb trap handler entry from
normal task context. This can happen during normal use of basic features
such as breakpoints and can also be trivially reproduced using:
echo g > /proc/sysrq-trigger

We can improve this by adding check for in_dbg_master() instead which
explicitly determines if we are running in debugger context.

Cc: stable@vger.kernel.org
Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
Link: https://lore.kernel.org/r/1611313556-4004-1-git-send-email-sumit.garg@linaro.org
Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
kernel/debug/kdb/kdb_private.h