stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Sasha Levin <sashal@kernel.org>,
	ebiederm@xmission.com, keescook@chromium.org, oleg@redhat.com,
	tglx@linutronix.de, peterz@infradead.org
Subject: [PATCH AUTOSEL 5.18 41/41] signal handling: don't use BUG_ON() for debugging
Date: Thu, 14 Jul 2022 00:22:21 -0400	[thread overview]
Message-ID: <20220714042221.281187-41-sashal@kernel.org> (raw)
In-Reply-To: <20220714042221.281187-1-sashal@kernel.org>

From: Linus Torvalds <torvalds@linux-foundation.org>

[ Upstream commit a382f8fee42ca10c9bfce0d2352d4153f931f5dc ]

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 | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/kernel/signal.c b/kernel/signal.c
index e43bc2a692f5..75cc2339d83e 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -2031,12 +2031,12 @@ bool do_notify_parent(struct task_struct *tsk, int sig)
 	bool autoreap = false;
 	u64 utime, stime;
 
-	BUG_ON(sig == -1);
+	WARN_ON_ONCE(sig == -1);
 
- 	/* do_notify_parent_cldstop should have been called instead.  */
- 	BUG_ON(task_is_stopped_or_traced(tsk));
+	/* do_notify_parent_cldstop should have been called instead.  */
+	WARN_ON_ONCE(task_is_stopped_or_traced(tsk));
 
-	BUG_ON(!tsk->ptrace &&
+	WARN_ON_ONCE(!tsk->ptrace &&
 	       (tsk->group_leader != tsk || !thread_group_empty(tsk)));
 
 	/* Wake up all pidfd waiters */
-- 
2.35.1


      parent reply	other threads:[~2022-07-14  4:28 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-14  4:21 [PATCH AUTOSEL 5.18 01/41] ASoC: ops: Fix off by one in range control validation Sasha Levin
2022-07-14  4:21 ` [PATCH AUTOSEL 5.18 02/41] pinctrl: aspeed: Fix potential NULL dereference in aspeed_pinmux_set_mux() Sasha Levin
2022-07-14  4:21 ` [PATCH AUTOSEL 5.18 03/41] ASoC: Realtek/Maxim SoundWire codecs: disable pm_runtime on remove Sasha Levin
2022-07-14  4:21 ` [PATCH AUTOSEL 5.18 04/41] ASoC: rt711-sdca-sdw: fix calibrate mutex initialization Sasha Levin
2022-07-14  4:21 ` [PATCH AUTOSEL 5.18 05/41] ASoC: Intel: sof_sdw: handle errors on card registration Sasha Levin
2022-07-14  4:21 ` [PATCH AUTOSEL 5.18 06/41] ASoC: rt711: fix calibrate mutex initialization Sasha Levin
2022-07-14  4:21 ` [PATCH AUTOSEL 5.18 07/41] ASoC: rt7*-sdw: harden jack_detect_handler Sasha Levin
2022-07-14  4:21 ` [PATCH AUTOSEL 5.18 08/41] ASoC: codecs: rt700/rt711/rt711-sdca: initialize workqueues in probe Sasha Levin
2022-07-14  4:21 ` [PATCH AUTOSEL 5.18 09/41] ASoC: SOF: Intel: hda-dsp: Expose hda_dsp_core_power_up() Sasha Levin
2022-07-14  4:21 ` [PATCH AUTOSEL 5.18 10/41] ASoC: SOF: Intel: hda-loader: Make sure that the fw load sequence is followed Sasha Levin
2022-07-14  4:21 ` [PATCH AUTOSEL 5.18 11/41] ASoC: SOF: Intel: hda-loader: Clarify the cl_dsp_init() flow Sasha Levin
2022-07-14  4:21 ` [PATCH AUTOSEL 5.18 12/41] ASoC: wcd9335: Remove RX channel from old list before adding it to a new one Sasha Levin
2022-07-14  4:21 ` [PATCH AUTOSEL 5.18 13/41] ASoC: wcd9335: Fix spurious event generation Sasha Levin
2022-07-14  4:21 ` [PATCH AUTOSEL 5.18 14/41] ASoC: wcd938x: Fix event generation for some controls Sasha Levin
2022-07-14  4:21 ` [PATCH AUTOSEL 5.18 15/41] ASoC: Intel: bytcr_wm5102: Fix GPIO related probe-ordering problem Sasha Levin
2022-07-14  4:21 ` [PATCH AUTOSEL 5.18 16/41] ASoC: rockchip: i2s: switch BCLK to GPIO Sasha Levin
2022-07-14  4:21 ` [PATCH AUTOSEL 5.18 17/41] ASoC: wm_adsp: Fix event for preloader Sasha Levin
2022-07-14  4:21 ` [PATCH AUTOSEL 5.18 18/41] ASoC: wm5110: Fix DRE control Sasha Levin
2022-07-14  4:21 ` [PATCH AUTOSEL 5.18 19/41] ASoC: cs35l41: Correct some control names Sasha Levin
2022-07-14  4:22 ` [PATCH AUTOSEL 5.18 20/41] ASoC: rt711-sdca: fix kernel NULL pointer dereference when IO error Sasha Levin
2022-07-14  4:22 ` [PATCH AUTOSEL 5.18 21/41] ASoC: dapm: Initialise kcontrol data for mux/demux controls Sasha Levin
2022-07-14  4:22 ` [PATCH AUTOSEL 5.18 22/41] ASoC: cs35l41: Add ASP TX3/4 source to register patch Sasha Levin
2022-07-14  4:22 ` [PATCH AUTOSEL 5.18 23/41] ASoC: cs47l15: Fix event generation for low power mux control Sasha Levin
2022-07-14  4:22 ` [PATCH AUTOSEL 5.18 24/41] ASoC: madera: Fix event generation for OUT1 demux Sasha Levin
2022-07-14  4:22 ` [PATCH AUTOSEL 5.18 25/41] ASoC: madera: Fix event generation for rate controls Sasha Levin
2022-07-14  4:22 ` [PATCH AUTOSEL 5.18 26/41] irqchip: or1k-pic: Undefine mask_ack for level triggered hardware Sasha Levin
2022-07-14  4:22 ` [PATCH AUTOSEL 5.18 27/41] pinctrl: imx: Add the zero base flag for imx93 Sasha Levin
2022-07-14  4:22 ` [PATCH AUTOSEL 5.18 28/41] x86/xen: Use clear_bss() for Xen PV guests Sasha Levin
2022-07-14  4:22 ` [PATCH AUTOSEL 5.18 29/41] x86: Clear .brk area at early boot Sasha Levin
2022-07-14  4:22 ` [PATCH AUTOSEL 5.18 30/41] soc: ixp4xx/npe: Fix unused match warning Sasha Levin
2022-07-14  4:22 ` [PATCH AUTOSEL 5.18 31/41] ARM: dts: stm32: use the correct clock source for CEC on stm32mp151 Sasha Levin
2022-07-14  4:22 ` [PATCH AUTOSEL 5.18 32/41] Revert "can: xilinx_can: Limit CANFD brp to 2" Sasha Levin
2022-07-14  4:22 ` [PATCH AUTOSEL 5.18 33/41] ALSA: usb-audio: Add quirks for MacroSilicon MS2100/MS2106 devices Sasha Levin
2022-07-14  4:22 ` [PATCH AUTOSEL 5.18 34/41] ALSA: usb-audio: Add quirk for Fiero SC-01 Sasha Levin
2022-07-14  4:22 ` [PATCH AUTOSEL 5.18 35/41] ALSA: usb-audio: Add quirk for Fiero SC-01 (fw v1.0.0) Sasha Levin
2022-07-14  4:22 ` [PATCH AUTOSEL 5.18 36/41] nvme-pci: phison e16 has bogus namespace ids Sasha Levin
2022-07-14  4:22 ` [PATCH AUTOSEL 5.18 37/41] nvme: use struct group for generic command dwords Sasha Levin
2022-07-14  4:22 ` [PATCH AUTOSEL 5.18 38/41] wireguard: selftests: set fake real time in init Sasha Levin
2022-07-14  4:22 ` [PATCH AUTOSEL 5.18 39/41] wireguard: selftests: use virt machine on m68k Sasha Levin
2022-07-14  7:08   ` Geert Uytterhoeven
2022-07-17 23:01     ` Sasha Levin
2022-07-18  1:34       ` Sasha Levin
2022-07-14  4:22 ` [PATCH AUTOSEL 5.18 40/41] wireguard: selftests: always call kernel makefile Sasha Levin
2022-07-14  4:22 ` Sasha Levin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220714042221.281187-41-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=ebiederm@xmission.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.org \
    --cc=stable@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).