From patchwork Tue Jan 24 18:51:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 47827 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2319038wrn; Tue, 24 Jan 2023 10:53:51 -0800 (PST) X-Google-Smtp-Source: AMrXdXvXcNiS05q4w4NMIi82QJPWagS4uY0FLgR7ebowq43SDn0V3vm50Ez4YOqxXSOknaXmTFkx X-Received: by 2002:a17:902:e9cd:b0:194:5de4:52d0 with SMTP id 13-20020a170902e9cd00b001945de452d0mr30645155plk.41.1674586431501; Tue, 24 Jan 2023 10:53:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674586431; cv=none; d=google.com; s=arc-20160816; b=LNc3tmUPoGlJfVLUwxUTAZopfMFfgqOj0z3764WnuvBb9Ju/yYT9T5GmIncFnq9Ckt qEm9sbuOT9cfrlCXJqbe3wDKWi1TXGgbAZi6CXv5it1UUmvegl5bMVqv5T9Yxo6oH1mI JnqvD0x86kieQXKH7MOEBX/F5jnXK4t9i5gLq//gAAGny6Jpuuyxe0rqiRqDOTNx5ztf utGLNFo13JFy9SoGfCefC3qUttY8EMNi37SySo2Rg5Uak1Yby6zXqBin7GrxRhIXM/b5 nrO+JoKu8hCJbZ69jfxFB8HM7zEy/P+pqb5xthn8kv8/7jxfSAopScA03Wu7NQibNHjU yorg== 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=4/FCEX8pK2ZuTQMIHTfcbZL0cpj4+jiCgIxt8GoZs10=; b=0tTcREShAyodSK5YodilZZiDt2zzD/28l+RDwxPjNEPtiSHh8Q+nmqKOeJuhA506FC 0Pnakyf88VRP9sssOm6K3olUMUipH7gCiD6gxbKsZJC8vxSD3269X5hjt+zHe1P6byWd dbfxG7TlHAZfryLemxgtTejFpclzFQeN49Xg4dEDrtAb6P2xrbRegOO9rHtMbe5Inssy SCxafX7M7ZO45MXARhconS0oNi2nTryMNaQN6dcKyM860HLTR7VF3T7A0BSkrZ+lvq7o 9y1IKXh2OmkqGfgYGHE2RPo6+bUpBx2HkZzV22l8TLYqj9F5UFElBGuX/UjkyBDdXpZz 7frA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fEuDjKUV; 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 l7-20020a170903244700b00186b3cb49basi3392415pls.202.2023.01.24.10.53.38; Tue, 24 Jan 2023 10:53:51 -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=fEuDjKUV; 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 S233205AbjAXSw7 (ORCPT + 99 others); Tue, 24 Jan 2023 13:52:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233877AbjAXSwg (ORCPT ); Tue, 24 Jan 2023 13:52:36 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB64846156; Tue, 24 Jan 2023 10:52:10 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 87AD761338; Tue, 24 Jan 2023 18:52:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 70F7EC43326; Tue, 24 Jan 2023 18:52:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674586330; bh=leveuMYdLJGLyfBl3ZKl32ZBXIzkUK2G8DzKRi5KAsE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fEuDjKUVsKyG2ujjjMpLuz7JDPK6cDyP1JGGINeZi/eB3K8ecTvvyxN3AmE7stXVG X8lU7dS1fo2oNB/zQqgk0fgeKAmeVMNK2ZAV5SgkwQXdbA1DM7u8p+kV4F9TGb915T fIhNYNhjNjRpj+LE9SDLwsrvBZAhfqSi8rxOPYQ7HL6LmFBa5+Ez0tK//chbrzYI3m 7xu68omeUadtBH+5xzBNTZVNXUH+9ocnGs/bYv6Ofqy7W/U7GQBqlsg4SBwOzhUrqv 9oz5RGQNygWnAsA+TfeuRUU4rvQcxi+5fyNVT2IxXSjJGz+TgtV6OUAJ0pj6TsIgCY qPaL+JuhyRNGg== From: Eric Biggers To: stable@vger.kernel.org, Greg Kroah-Hartman Cc: 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 5.15 15/20] exit: Allow oops_limit to be disabled Date: Tue, 24 Jan 2023 10:51:05 -0800 Message-Id: <20230124185110.143857-16-ebiggers@kernel.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230124185110.143857-1-ebiggers@kernel.org> References: <20230124185110.143857-1-ebiggers@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755931141591894511?= X-GMAIL-MSGID: =?utf-8?q?1755931141591894511?= 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/admin-guide/sysctl/kernel.rst | 5 +++-- kernel/exit.c | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Documentation/admin-guide/sysctl/kernel.rst b/Documentation/admin-guide/sysctl/kernel.rst index b6e68d6f297e5..d6f1d3892e71e 100644 --- a/Documentation/admin-guide/sysctl/kernel.rst +++ b/Documentation/admin-guide/sysctl/kernel.rst @@ -675,8 +675,9 @@ 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. osrelease, ostype & version diff --git a/kernel/exit.c b/kernel/exit.c index f68a9c6adfc9c..f6c85101dba0f 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -941,7 +941,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);