Received: by 2002:ab2:784b:0:b0:1fd:adc2:8405 with SMTP id m11csp506515lqp; Mon, 10 Jun 2024 10:23:20 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU2vH/X5PSZBps7aYVrRsHvREKQRTibRtaRDiOIxl07buzT+Z5pO4JV0HUuE1Djm0TD5BBaRH6T6sBx2S4izAX2QPoHxwZWSFJyOcxQ3Q== X-Google-Smtp-Source: AGHT+IFJ7YadS6o7kf+PwrpVslme/HsOepTGDL8X+t1Jx+Qy/4yb6ahR4cbtTHzwbHOrq1RZ77e+ X-Received: by 2002:a05:6358:430c:b0:19f:4c24:d9a2 with SMTP id e5c5f4694b2df-19f4c24da7fmr494427955d.31.1718040200116; Mon, 10 Jun 2024 10:23:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718040200; cv=pass; d=google.com; s=arc-20160816; b=JH4k6fR52+bLRocQ85eOAB2M7fpjvSHnjamcKk/I7Zi6KYGg9HcWwEbPljVWL1y3OT EXoUkVX3wzfxlIEVP26xvMvV94NF8QPrFzF0mErUIvPTK7ys1Lg2IQy7Svn5VRQIp5dT V2dQpmox6O5jzczS91GRxMoLopiJBVUOz+W/diy0ExG6XtckgT2MRQ+sIZI48pS9uSt0 auchBHidofj+DJrEXI0eMPZg/BkcFm80nI+ZC0B+YXE0BjkGe80Tl2VTARMa7y67+iL/ /ibaBWEuQCU8ee1q2QAvBLaVan36a6O9TtpJbrRTF+Tr26rDTPIPmUbWdlsiZsUB5jeX thxQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=date:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:references:subject:cc:to:from:dkim-signature :dkim-signature:message-id; bh=Qgv0rOS1X6FuYj5LENG49jFoHaTII1ldHQt4poVGsnc=; fh=joBs/8L+orz77ylyCy6wqNwwi35f7sYhLR+/TQjQjhI=; b=ym/mMQRdqMV4QBmVaEqH+189Yd/q+cim6NqDyPceoGvRGmTAQjtyVF+3UwE9800Ig3 9pLO6iimIhWs/CykhQqCk1xVI3LvQSUuCtg2NGl2vFvxWjMkJtjfGTaLn0ZiMFLvTXbx yNPFF29PQ70ylc17brhLokD6eZKnYNZ7XODfVfsh0YczQjXq1JjlVJ+PpukMZQadj5vK JDOKrSYFlGKJzxtAP1ssjXQ+al5M6mueNMBcjcNUp6QGfycwI3JWOglI2udiguJspXsu HhEZzREDo0kWrtudKbUwvkdPkbRT8VmRzQq+BIXOxXkTZeUkTk5jy/z4HvA0IUiz9Cup kcig==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="bOl04P/V"; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-208588-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-208588-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 41be03b00d2f7-6de20831af0si4919073a12.169.2024.06.10.10.23.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 10:23:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-208588-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="bOl04P/V"; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-208588-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-208588-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 92B2EB266F5 for ; Mon, 10 Jun 2024 16:47:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9179C155CA3; Mon, 10 Jun 2024 16:42:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="bOl04P/V"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="XfXAlRMy" 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 47729155A2B for ; Mon, 10 Jun 2024 16:42:37 +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=1718037759; cv=none; b=NIsUsw/tlwcqQmijmlTHfffYnaToCSMN5iutREaFNg1VfNpahwRBhZbxJsHhtKNTLYn6rhTWo7esxzPFGnZ4AXX6Asl/EuEBxqsrTVm1S2DbICKfMDGfsqxkucHZFuphBuYhsJP7Wx+R7CuKuvTnTSlKE/1RfHXz+aVpDUpNChc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718037759; c=relaxed/simple; bh=d1BJ7Kja+UEwMgVwc6Tt6tmvcnKhbXaS3H8LE3K80r4=; h=Message-ID:From:To:Cc:Subject:References:MIME-Version: Content-Type:Date; b=PGoOUDn7vN50wuEld5F43hbUoUxynowObQrPB0afh4GgDXVnGRjqQ4FOm6+nUlIDS8sm0nEqUwqixp/JrilVsmukNrHUFGeJrCtZ7yukdU6/ZLl9RedmusNPD8v7ihTl1MfzB2+0E+V1vBBDBKkV/+3hAhLa7olauZxI0KHNZCw= 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=bOl04P/V; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=XfXAlRMy; 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 Message-ID: <20240610164026.992475995@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1718037755; 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=bOl04P/VxIRlk0A/cs0WrD231whGwrzsLd+OpYoKeVyecflRVg3Yp6TOBUL7QJypZC4FDT l10eCKY0ELR79UMYtZR3V5yjAgO/Xn109WU6YnPlKOVoF0KYjwtsWII3NF8RdRtUVZb1Ow 3/acV3dUEujIqqHSEK6w5rlpu2g6lRBQyn3tAQaIR5E62aLPCwgWJkhrv6CA5UmjZYT23y T4kjLF3b1djHKKG7zeqc9e3rEDTPUz1oAxCFzkYQeDg5ZCsOXBiHeIPPJgNn2IAn+Dh2/I CbBizImIDELWodIjSXZo4KuiaYKW+KzyWdq80bh4JLBHXz+ea26W/1cCCXW4SA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1718037755; 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=XfXAlRMy8hhmQtBX6rTA1Kcq7EoUOaaf+WPuOAY21WOpp7eEjgSrQrt/P2tucKmhetqOo9 LtdAtMBa/q/dDXBA== 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 V3 24/51] signal: Replace BUG_ON()s References: <20240610163452.591699700@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Date: Mon, 10 Jun 2024 18:42:34 +0200 (CEST) These really can be handled gracefully without killing the machine. Signed-off-by: Thomas Gleixner Reviewed-by: Frederic Weisbecker --- 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) void sigqueue_free(struct sigqueue *q) { - unsigned long flags; spinlock_t *lock = ¤t->sighand->siglock; + unsigned long flags; - 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; - BUG_ON(!(q->flags & SIGQUEUE_PREALLOC)); + if (WARN_ON_ONCE(!(q->flags & SIGQUEUE_PREALLOC))) + return 0; + if (WARN_ON_ONCE(q->info.si_code != SI_TIMER)) + return 0; ret = -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 != SI_TIMER); q->info.si_overrun++; result = TRACE_SIGNAL_ALREADY_PENDING; goto out;