Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4472546imw; Tue, 19 Jul 2022 07:15:45 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sItmrdAgFtB9skglInScOZ++lIwdCUOSk14VE3PgHbO19IILI9Rjqj8XgWBqFosdKkeYek X-Received: by 2002:ac8:478b:0:b0:31e:eb59:2b07 with SMTP id k11-20020ac8478b000000b0031eeb592b07mr8985297qtq.357.1658240145422; Tue, 19 Jul 2022 07:15:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658240145; cv=none; d=google.com; s=arc-20160816; b=O1MI6Wcd+20mLDCiLbkQc3O+/m+QYiBUTUDFwIOrdSDSRTc0AR1HTY/PLsWzZds0IG Z2U5X9Id6Wzko8eaAOZfP2I7jTZc2ug9mQVARjCVyM7vaib540fO1fzrzvENUJwxZoQ0 ocPH2AUKV1SDEkPa1D+GOTXQlABB+4UCvzRZjALFC+p3+18WQaG22aNdmhAlt2m9jOc3 t4IiffsncQ8wuNzvuEDO17HCB6p2Lm5JWll/KezsAVrIhq2jxlxFPt6KesYKtRKpAA0F v4jlXojnbM9pSn54yjBszg3Zk91iIKej9ivOND7S3NMIpdJTeO86rSTZUk+yxOtva1b5 6ELw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0l2XA+S4p9Zw+Z+nDoAqUtPrvX9S1LubU2xz22knQaQ=; b=MGXq3QTHjAlvy02VIHcQSG/6cA0HQYyf1hrukOMEb07/sfcLWIelrLH/9GGJn2D8p/ gNrur5Im281FBJOEmw1o3QOemjgN9qAL+GQBN7PaflpgOFAWDykhrtBODwcQLp296T6C n3ZbrCKHrk2R3p/AEkHBqF677nsmziz4oV2nCyESGQXUASgzNePNhIFiD70C+4BOTwQW zRspO1gU8mXvH9zShzDNebOGS/uUxCBsgWvhztfmrRa9p2iwYJuNhgYAbTWL+Dp5Rxab 9EYrJUHHfuOvsC+k35LXuN+t9SMIjSZjbwKHRo3rAbZ5KwcHqqshUv50O0GhWUTmHxrx UpvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZSIJTHUC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bl20-20020a05620a1a9400b006b2543c5866si6907786qkb.18.2022.07.19.07.15.29; Tue, 19 Jul 2022 07:15:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZSIJTHUC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238448AbiGSMrH (ORCPT + 99 others); Tue, 19 Jul 2022 08:47:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242013AbiGSMo7 (ORCPT ); Tue, 19 Jul 2022 08:44:59 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62C6A87C1A; Tue, 19 Jul 2022 05:17:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 035F7B81B82; Tue, 19 Jul 2022 12:17:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5EFBEC341C6; Tue, 19 Jul 2022 12:17:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233050; bh=fHBYmqcIiLMomw61JKDjJgzcDQQWoa5ofC83PhIIq4k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZSIJTHUCpEMqPKTBqDs+lTiNSLEr9NnLVcSVNrlQg9n/0ONjaY85IEB6efW79witK ydzsUblNxHFAfG0LS3JmJGB8HbCgtCKmcZe4JjgeurdWpGYSQZ8whDTVuKUS1VmxV6 BmVAwPDGupboOO3/H+/vw9muAIk3/CLvzRsnItnA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Linus Torvalds , Sasha Levin Subject: [PATCH 5.15 157/167] signal handling: dont use BUG_ON() for debugging Date: Tue, 19 Jul 2022 13:54:49 +0200 Message-Id: <20220719114711.690583853@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Linus Torvalds [ 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 Signed-off-by: Sasha Levin --- kernel/signal.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/kernel/signal.c b/kernel/signal.c index d831f0aec56e..c7dbb19219b9 100644 --- a/kernel/signal.c +++ b/kernel/signal.c @@ -2027,12 +2027,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