]> git.baikalelectronics.ru Git - kernel.git/commit
signal handling: don't use BUG_ON() for debugging
authorLinus Torvalds <torvalds@linux-foundation.org>
Wed, 6 Jul 2022 19:20:59 +0000 (12:20 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 21 Jul 2022 18:59:27 +0000 (20:59 +0200)
commit505f665df90a9ed26e93796634b240d680670769
treea7fcf3a9050c44fe8e85c80861be9b6514e8bd22
parente3553d11df42741ab0e5e716729630b53f5f1fc2
signal handling: don't use BUG_ON() for debugging

[ Upstream commit f12e3c91b836133068f7880ac038f777e99f2608 ]

These are indeed "should not happen" situations, but it turns out recent
changes made the 'task_is_stopped_or_trace()' case trigger (fix for that
exists, is pending more testing), and the BUG_ON() makes it
unnecessarily hard to actually debug for no good reason.

It's been that way for a long time, but let's make it clear: BUG_ON() is
not good for debugging, and should never be used in situations where you
could just say "this shouldn't happen, but we can continue".

Use WARN_ON_ONCE() instead to make sure it gets logged, and then just
continue running.  Instead of making the system basically unusuable
because you crashed the machine while potentially holding some very core
locks (eg this function is commonly called while holding 'tasklist_lock'
for writing).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/signal.c