From patchwork Tue Jan 24 19:29: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: 47869 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2337500wrn; Tue, 24 Jan 2023 11:36:41 -0800 (PST) X-Google-Smtp-Source: AMrXdXucI11cMA4yBX5afh71BsZ8hc0S809oNr2r1S3FnMb6h7CQZApsaoj9KSPDILp1+pGyw2xP X-Received: by 2002:a05:6a21:918a:b0:b8:7bfc:7a32 with SMTP id tp10-20020a056a21918a00b000b87bfc7a32mr29196147pzb.2.1674589000854; Tue, 24 Jan 2023 11:36:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674589000; cv=none; d=google.com; s=arc-20160816; b=S9UXu9QAxhKCsv9UDI8r77l/TwtWVg243XgmpXaBOKI743U8rdwiEUoJ6Z0zjT88X6 4Ij2BFAnBUhLN8kOAIz3DA9CmQOCILCY/8zqA14mRztsyDzd3XrnRadiHJZmohEbqJ8x 3rjGUhquFDhVr707ggScooIjw92el4FXmLvM42HggjhHt02pzjeKWNdsHknIJAUlv2J3 EbRARJCggWauYpz4yh+WtB/zN/TtJ9yK+dsduZ4H/GI5kUdF/R036ru0rXWPU/dPcGD6 juSm8clBVv4E0bKtZfmKWnCUXb+mm1e6swBAKZFFF/RvEXpK83/mvkwboCSwqtapjUU9 oHPg== 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=4vg27I0AcXaRVhIPLzyopGSdo5LiPLnOmvAZ2BO5DoY=; b=uGccVsRyShjIhfludP6iT/tXJw3uKxjjyi9Tu6HMEgjMbbkhWPkKN1GFSZL3fEe86V 7ZcOHo88fAjoI8DjV9KgGO6n8ifZ8tmSDbu69ILJkDDUpa3RUft/kwLCYmcthq3Oa5rm UcE+7IypP4QuvUI4/fZq4xmHU1cJ3CP02A0C098ZkJLSNi8GuoFRnTtTeyeuG98Jj8yd ZSYpB51LbmZ9dVdm+FJ5ZG8fSyiPxIgJGD3qumvJASgtf6dj4r+fBzHR3W6QAaBud1lR MSM82k8zZYx7iBjtwZs3o0BNyyIemY80Qgk0Z2NkaR3AHfwvrCyaTflQZAYW6lG/nMG8 n22Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JtAPx1Pj; 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 e188-20020a6369c5000000b004c76dcc9983si2989803pgc.164.2023.01.24.11.36.29; Tue, 24 Jan 2023 11:36:40 -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=JtAPx1Pj; 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 S234735AbjAXTgH (ORCPT + 99 others); Tue, 24 Jan 2023 14:36:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234381AbjAXTfY (ORCPT ); Tue, 24 Jan 2023 14:35:24 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CEBC92D72; Tue, 24 Jan 2023 11:35:23 -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 6B20061348; Tue, 24 Jan 2023 19:35:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B94D8C433A0; Tue, 24 Jan 2023 19:35:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674588923; bh=/HryASB3ALWUABFie0JbJpEEo1dVwkZUTuiyweA1EY4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JtAPx1PjCmZNXoQOY1fmWc83RPmkD1ecKLEjJtMGhYwZW0kKtd5vh8sbATyiZC2FQ 4YVgl/9Xg3s/ydEDodxCKKhyZql//Vm0ll+JnktmKoFAMKThQlJeHSHJ+hwLdYYPSy 9tZpwm6YwFDXvOG9T0nm8z9OtSQL1xEUW4XYTP/aSNPzrUqm+HbCwDq068hVkxmb4Q G5KUT+yb5+oCb+ZjMcsKvTnhoYBgWQeaLEHmuHRygIpgkpv2Ly7Gmc14cPGI0X0Mzf pArvQitFfwaRQdJrOmZtEY/muzLJTS76GonSCsG9E6sssU08lakemYfQmULRolRoFb 3hruf5+3vVPHA== 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.10 15/20] exit: Allow oops_limit to be disabled Date: Tue, 24 Jan 2023 11:29:59 -0800 Message-Id: <20230124193004.206841-16-ebiggers@kernel.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230124193004.206841-1-ebiggers@kernel.org> References: <20230124193004.206841-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?1755933836506463853?= X-GMAIL-MSGID: =?utf-8?q?1755933836506463853?= 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 cd9247b48fc73..470262c088589 100644 --- a/Documentation/admin-guide/sysctl/kernel.rst +++ b/Documentation/admin-guide/sysctl/kernel.rst @@ -667,8 +667,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 b519abee2c541..8c820aa7b9c5d 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -927,7 +927,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);