From patchwork Thu Feb 2 05:25:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 51704 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp52731wrn; Wed, 1 Feb 2023 21:30:18 -0800 (PST) X-Google-Smtp-Source: AK7set+ocFccqms0TY2hvxwwN0L3/lLtQkzoRsbl0ebYUmaEF4tbREC9qVOrV8vnqf9ZKbMH1Xqt X-Received: by 2002:a17:902:e550:b0:195:f3e3:b923 with SMTP id n16-20020a170902e55000b00195f3e3b923mr5974102plf.8.1675315818123; Wed, 01 Feb 2023 21:30:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675315818; cv=none; d=google.com; s=arc-20160816; b=F6jCrTHTYwyUOBxTyV4vKhduKfkWkik+eS2/PL09/f/R9mgyNrg+1JB/QjtX040AZR lRC8YEogyX8n6EUxQ7wLT3X+W9vTOhoNs9q8XPb2sw64yqLvcnTBH+Y71Zt1Wr1gGL7G +X4wdEx9hSmU0hbqH6YEWTQZJa+2Dl1JLTJIDvV97rhq0C/NOZAQbKAygfSrg5ecCQF2 7J5E2ZJjH4MoExnlJnbyREOnSUdhyckJVadw6eY4EEiUhcDMDUTv+j9Bn7d65cxatu07 OKIBioC8PYcMcXU980wRnPxx8QOa05VYTu2dvsH2Bq/Uvba2bhz9LODmpJRMJk0RTp35 tdIA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=KMIqUnFpYqAi4nXtm1A6wnfCWHC9OWgQUZeYw0aEKQM=; b=U+6Nw3yNZLiDtwJDlI3cEq8k7X0i7eNIq2QzvrawnGn/dNK6hQXo8Yoez5Wqa0QMMA bT2gnFOf2pSls8P1rbYinmprOgf4/WQckMnPWnTjKlxTBmydrC4VNpIzdNJUSHN/QzMy KD1j6TqAZqXo9g6o0pGckPlh6MC/+Ta638g0iLsfg07G0iDetYKwDEBCRiXAvllZ7b5l 89msdOq2mp8k6jthaNMww7Q/EJVsl7HkZkLFm97sIWtymEw0HmdlQuEdsEtojsmGAdsA vr1oHOebIJTTtb1U2zAjmRGgnfChtb1scc5rFeWydyVLJHoOR0nRrjKCOJGJU8vQ7jdJ C8Cw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PDOyv9Hy; 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=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r206-20020a632bd7000000b004e080a5ba41si18765746pgr.572.2023.02.01.21.30.05; Wed, 01 Feb 2023 21:30:18 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=PDOyv9Hy; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232123AbjBBF3R (ORCPT + 99 others); Thu, 2 Feb 2023 00:29:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231936AbjBBF2Z (ORCPT ); Thu, 2 Feb 2023 00:28:25 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8563020D32; Wed, 1 Feb 2023 21:28:09 -0800 (PST) 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 8B092B824BD; Thu, 2 Feb 2023 05:28:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD25FC4339C; Thu, 2 Feb 2023 05:28:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1675315687; bh=nv2Qqlsj2+1OK7qBLFpDl9kvNBYUdDR2EUyByUiFUks=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PDOyv9HyEEEm1mMma7zFwWbZkwzMocq6zarb2i37VNulT7a3osKH4xFUVY03G0uE1 G9Bwmbvnz5RC4xs3/JXAKDPjHyL8XyQlHwUOfYaY2O7EeS2FYUCn0LqwDkgDfwLfnE s3sda8oybqsTfOSmSaMbXMtcGUfRgWiqyCXHn/z4P+pF49eE3+iYY3FTgmah4dJ+47 //ln2un/CRFL1KDmQJmrY5Tdsts1oSbjNOnJvq7gT10MuzQl2+ZQoBSddMjS6KhSBN EW8r43JO3kEgOgmrmkMwrVmOCjrFGBsIt984oYH9qZmUl3imiZo/eL2Aa3O1lCu2dV HZ4Q10lxbQi0w== From: Eric Biggers To: stable@vger.kernel.org Cc: Harshit Mogalapalli , Kees Cook , SeongJae Park , Seth Jenkins , Jann Horn , "Eric W . Biederman" , linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org, Jonathan Corbet , Andrew Morton , Baolin Wang , "Jason A. Donenfeld" , Eric Biggers , Huang Ying , Arnd Bergmann , linux-doc@vger.kernel.org Subject: [PATCH 4.19 11/16] exit: Allow oops_limit to be disabled Date: Wed, 1 Feb 2023 21:25:59 -0800 Message-Id: <20230202052604.179184-12-ebiggers@kernel.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230202052604.179184-1-ebiggers@kernel.org> References: <20230202052604.179184-1-ebiggers@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756695959635814278?= X-GMAIL-MSGID: =?utf-8?q?1756695959635814278?= From: Kees Cook commit de92f65719cd672f4b48397540b9f9eff67eca40 upstream. In preparation for keeping oops_limit logic in sync with warn_limit, have oops_limit == 0 disable checking the Oops counter. Cc: Jann Horn Cc: Jonathan Corbet Cc: Andrew Morton Cc: Baolin Wang Cc: "Jason A. Donenfeld" Cc: Eric Biggers Cc: Huang Ying Cc: "Eric W. Biederman" Cc: Arnd Bergmann Cc: linux-doc@vger.kernel.org Signed-off-by: Kees Cook Signed-off-by: Eric Biggers --- Documentation/sysctl/kernel.txt | 5 +++-- kernel/exit.c | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Documentation/sysctl/kernel.txt b/Documentation/sysctl/kernel.txt index fd65f4e651d55..e1d375df4f286 100644 --- a/Documentation/sysctl/kernel.txt +++ b/Documentation/sysctl/kernel.txt @@ -559,8 +559,9 @@ scanned for a given scan. oops_limit: Number of kernel oopses after which the kernel should panic when -``panic_on_oops`` is not set. Setting this to 0 or 1 has the same effect -as setting ``panic_on_oops=1``. +``panic_on_oops`` is not set. Setting this to 0 disables checking +the count. Setting this to 1 has the same effect as setting +``panic_on_oops=1``. The default value is 10000. ============================================================== diff --git a/kernel/exit.c b/kernel/exit.c index 5cd8a34257650..b2f0aaf6bee78 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -986,7 +986,7 @@ void __noreturn make_task_dead(int signr) * To make sure this can't happen, place an upper bound on how often the * kernel may oops without panic(). */ - if (atomic_inc_return(&oops_count) >= READ_ONCE(oops_limit)) + if (atomic_inc_return(&oops_count) >= READ_ONCE(oops_limit) && oops_limit) panic("Oopsed too often (kernel.oops_limit is %d)", oops_limit); do_exit(signr);