Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4420680imw; Tue, 19 Jul 2022 06:23:06 -0700 (PDT) X-Google-Smtp-Source: AGRyM1ug+Mu3FRR9W9KJwtzpKsTrqrGaCIJW7rzzoywDhN+zIRB2zeQBo2zCeQKRKAjfk8TG8qao X-Received: by 2002:a17:907:2856:b0:72b:54bd:40eb with SMTP id el22-20020a170907285600b0072b54bd40ebmr29894296ejc.542.1658236985976; Tue, 19 Jul 2022 06:23:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658236985; cv=none; d=google.com; s=arc-20160816; b=qQTR3mietxK2JK3WFrrnPfWaZXl+0yedDwqzKIosU09AazmdRqE4zkxpcsZuJgOiOt F6Bgzk06RmUUPB4+SN+HdgtcHM4HBGr8MSCUYMFmnSnZnugq2eOXk9ks5y5YhHMS1g2f 9gWxOT/X3zm8/Okkl/+UJcNwlSinImBMruTRHSKRUEgaoqN1kslRvwPwrLXnl0RHYN/i mmJMhs6gNo54YXZ7asNnZX6dBNr3NnTDSW9+sdNdpdjnSq9tVH5vNmlQ9Rc/Kjvlz/jI 5TMAsfHuHuzpNCAWfjerJz2pLeMPTpfqrPTDoia0iCjr/asn8ncftlfi8V58awlLD550 cZMA== 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=xYDX7Y4Cyb0GLjG3C4jqoVk8S/90Vrs8/N6BpsxS1LE=; b=C49GACPlpjmhvCXWpiMb6KVNaVKLlLN9AJKpI2kGPI9KHL5qCNY/AVY/rEE12JpE9O oPt54M6lGnm3HxT8M0qpy3FxXdqz8b/pwu/06+o1p1hLUeClRHV+LRKmDQ5TN27D9jGj QcwVxKM5vpX3em/fJPOSwZaWSagRW09nS41yl2pWWP9X7yFLjMgRqktZmCp0XDnTxMJS QU8Ix8XowgXszVHkh5UZvKFV6g1sBVe3IdXQFPqaeqobocyDmGTeZMiKf1MO4diKCdDg Sg8WXdlErSDG9ZukPSOyi6FGKusErfw8b3VIwTjYbnjdVHTv4A1BbOdWdEzZDs49mGr+ NU2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JdgJ4H6Q; 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 bc15-20020a056402204f00b0043acbfa0469si18122182edb.394.2022.07.19.06.22.41; Tue, 19 Jul 2022 06:23:05 -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=JdgJ4H6Q; 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 S239883AbiGSM0K (ORCPT + 99 others); Tue, 19 Jul 2022 08:26:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240132AbiGSMYg (ORCPT ); Tue, 19 Jul 2022 08:24:36 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 774E646D82; Tue, 19 Jul 2022 05:09:28 -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 0A16DB81B8C; Tue, 19 Jul 2022 12:09:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 44624C341D0; Tue, 19 Jul 2022 12:09:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232566; bh=VZ/ySEKwch8hX9Yt/2DDVKTkE+/L3t9gTkYGiHmEYrA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JdgJ4H6QBCQtycZoA7XjHj+Ihw/kC2yfvig0KVGpSdAN3GqT5WmC87KcH7nUu4Zq8 ouzIrLj0tSiAt7ZAeidA11RfHF+Djg4Gzuyl0pK+8BOqWdLfNvQYD6p1irhemBg06A C8uS98sQzC98bGqJv3SLDuOxTLldJQwlVbqFlV/4= 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.10 102/112] signal handling: dont use BUG_ON() for debugging Date: Tue, 19 Jul 2022 13:54:35 +0200 Message-Id: <20220719114636.778396562@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114626.156073229@linuxfoundation.org> References: <20220719114626.156073229@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 6bb2df4f6109..d05f783d5a5e 100644 --- a/kernel/signal.c +++ b/kernel/signal.c @@ -1912,12 +1912,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