From nobody Fri Dec 19 20:14:16 2025 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A51F653E3B for ; Wed, 10 Apr 2024 22:46:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712789218; cv=none; b=fCyXz7aWeMnK0fSo+ife9P2gn6g9iL3PNaKXGwUR192Tr02/LiKKCM2JmhxHxEiIMfNvQTpwy9Dy3BW4OUODKQNG4AWyI3mWw5ZPvHlLajiqyoWzsPEQleuB1Uno8zwR4mA22ikCgSBGw5hzmLnDTDko1JIvBn+J9/5sYWcSphE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712789218; c=relaxed/simple; bh=d1BJ7Kja+UEwMgVwc6Tt6tmvcnKhbXaS3H8LE3K80r4=; h=Message-ID:From:To:Cc:Subject:References:MIME-Version: Content-Type:Date; b=mw0B/8+l1XXjTjbVXgwxJrrtjx2qk6UgN6NnhDklVELySkWQivDKNGeDPkKuW9J8mS8h4qEFY1uWX6De7LeTQX1xYZ7UL3tES2zGpn9egoQfCwANrVZF5Wujw7OV+5uZofZhXr3PG+vUnFRHcrWkCUzFNVVBZJEpzjxbuv5SZuA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=BywFEK8E; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=0BzM0uy0; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="BywFEK8E"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="0BzM0uy0" Message-ID: <20240410165552.447880671@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1712789214; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=Qgv0rOS1X6FuYj5LENG49jFoHaTII1ldHQt4poVGsnc=; b=BywFEK8EhBKq+GTAmPwdrzCsML4KpjodV0Aa5UV7k+IvmE75liV0APZQ5B8086XCqnu9qy w3oBNIHUbUba2WaMMkZPf/anVzdlQiwNE6Vtbq3+mWTE6ClBoV39rgA0oVMJbUaklfx8oW D3ZY4PyG4L9qqBRviqpFAUnoC/w8bFqXPKn7FqhV2GKFVUCGrKafdYiwBSDnsWnt5DzU/K CjmYcgDJS87JtiTGHjlSzGnDs65BSPuIj90SBPhuMqRCVOD7xzz8i0f3TNiFhwsTqeRwNc rqGIbvWr+k3SL6YKd9eF7rZt4zr2+aqJblrzVMcwzEMA55nJtFt3+dQgwMH4mQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1712789214; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=Qgv0rOS1X6FuYj5LENG49jFoHaTII1ldHQt4poVGsnc=; b=0BzM0uy0YvtHTATQTAAu4NX8a7YREsxX/iXHgXRS+pI3tynfPokyIJNUco+FwxHWiil85d dNLfUXrv1l5TG0AA== From: Thomas Gleixner To: LKML Cc: Anna-Maria Behnsen , Frederic Weisbecker , John Stultz , Peter Zijlstra , Ingo Molnar , Stephen Boyd , Eric Biederman , Oleg Nesterov Subject: [patch V2 24/50] signal: Replace BUG_ON()s References: <20240410164558.316665885@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Date: Thu, 11 Apr 2024 00:46:54 +0200 (CEST) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" These really can be handled gracefully without killing the machine. Signed-off-by: Thomas Gleixner Reviewed-by: Frederic Weisbecker Reviewed-by: Oleg Nesterov --- kernel/signal.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) --- a/kernel/signal.c +++ b/kernel/signal.c @@ -1940,10 +1940,11 @@ struct sigqueue *sigqueue_alloc(void) =20 void sigqueue_free(struct sigqueue *q) { - unsigned long flags; spinlock_t *lock =3D ¤t->sighand->siglock; + unsigned long flags; =20 - BUG_ON(!(q->flags & SIGQUEUE_PREALLOC)); + if (WARN_ON_ONCE(!(q->flags & SIGQUEUE_PREALLOC))) + return; /* * We must hold ->siglock while testing q->list * to serialize with collect_signal() or with @@ -1971,7 +1972,10 @@ int send_sigqueue(struct sigqueue *q, st unsigned long flags; int ret, result; =20 - BUG_ON(!(q->flags & SIGQUEUE_PREALLOC)); + if (WARN_ON_ONCE(!(q->flags & SIGQUEUE_PREALLOC))) + return 0; + if (WARN_ON_ONCE(q->info.si_code !=3D SI_TIMER)) + return 0; =20 ret =3D -1; rcu_read_lock(); @@ -2006,7 +2010,6 @@ int send_sigqueue(struct sigqueue *q, st * If an SI_TIMER entry is already queue just increment * the overrun count. */ - BUG_ON(q->info.si_code !=3D SI_TIMER); q->info.si_overrun++; result =3D TRACE_SIGNAL_ALREADY_PENDING; goto out;