From patchwork Thu Feb 2 04:42:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 51683 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp37932wrn; Wed, 1 Feb 2023 20:46:48 -0800 (PST) X-Google-Smtp-Source: AK7set+nZvksHb9oBR588xxTtS9dUEHu6sjXjPX77oJQvON0Mghb05j5Xm3R7ZkdbfkhfuYR3f/9 X-Received: by 2002:a17:902:f20c:b0:198:c6d1:cc03 with SMTP id m12-20020a170902f20c00b00198c6d1cc03mr148281plc.24.1675313208380; Wed, 01 Feb 2023 20:46:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675313208; cv=none; d=google.com; s=arc-20160816; b=X98OunSFSsCbh/LY2ghN0MndKJxtmLMhHXDKvFTk1+m1EER9bHZ3BHnCbBEjEJeqTF 7CeBydjLBw36llqbyaAwK/aOBxoB9HkANPKM4zHX22nlRODv780R/ExpTuGECoc6OHZO AydMLWBzDj1BiNYZ157JRydc13lvEP1npIMYLk1vK7xQkZL+3Jpk6BVDOveg6J4TN/l7 2jZ0ZrpMI3Hj3Se9Aje4OAiwUmSgxlpKCIU3sbiJl1mh39OzjgJzYRgIz1nvg94nTD+K KfPere2PPYB3SCe65H7KVFpkPnVFmCPFQeWfYGLGoyM10dMLsSnUKCKJSpjlunhpHyee 9D7w== 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=SFJ30Afl23HfBjxDwjUp8WpVg2tzuFuaKE0u0PrRs1Y=; b=C01+1CTwsysm3nwvecZdoJLqNIvmD6UYPRsDdDQHNAC9rj3MwCkZetEb/QnV9ve6uN 2SWTJITMnW/AwZnXIEeJ6VN+4/p4zh5heC7h4AcjnbsfGjEsufNeZS2jNe7E+V05VLO3 a3yZkXsI38iUPoZhcoP3ClgHMn26hwJfU55kmQQSHSfnwrCZgB5YeBAUHqIsaN33z2qn qdKIf7v0pOJGOGA0op/utUOC5Un/dYNLTQ8yRmvUbm+fxpW1ab3/Uc3rd6AHPlYXt5WW P/QiOts/BmJb+2hRfpEjf7xHn/I5mMR2UP+6n5Kzfhdfc/7X52MungNGyyQB3Uq0VdAA B5fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SRKetWvc; 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 x11-20020a170902ec8b00b001968cbc67e2si10271264plg.583.2023.02.01.20.46.36; Wed, 01 Feb 2023 20:46:48 -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=SRKetWvc; 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 S231970AbjBBEpq (ORCPT + 99 others); Wed, 1 Feb 2023 23:45:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231679AbjBBEof (ORCPT ); Wed, 1 Feb 2023 23:44:35 -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 E51B47A491; Wed, 1 Feb 2023 20:44:04 -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 803B0B8241D; Thu, 2 Feb 2023 04:43:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ACEDBC4339B; Thu, 2 Feb 2023 04:43:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1675313033; bh=H528wNNxm5Oo0hjUOWSVmZTKVIN9JjXoFt12rdqUAXA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SRKetWvcTG8xZO55clQQVma8DAfR6WxTmSIO3yNoIAIHU4Wy4wmEiLoyXMI0Lh1C0 2k7E2v75DJ1pR19FhbL0kkFrqW5f3UBCtaveVYGOGJsAiXrZVCvqHzCOOz0DjjHwzG YUKTLkRTSml4kJNPMzCU41quLTFUmQj0AGkQgpx/gM0El59PO3OUhnM9MQDeqqJeMo 33n0zw2n4rsdfz+sE/VHlNYNYCHWSmSNRcBqWuGTvb5GEqrB9Ef7ph6OFsXdAxpYvC lkJBJ8WAebzlw5OW8oHiAOKcz+r8PcnoY/oOR9qGGjm3zdhVAslz+gieJzpymURMGq dYzB1KR3qo/dw== 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 5.4 12/17] exit: Allow oops_limit to be disabled Date: Wed, 1 Feb 2023 20:42:50 -0800 Message-Id: <20230202044255.128815-13-ebiggers@kernel.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230202044255.128815-1-ebiggers@kernel.org> References: <20230202044255.128815-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?1756693223093929576?= X-GMAIL-MSGID: =?utf-8?q?1756693223093929576?= 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 4bdf845c79aa3..bc31c4a88f20f 100644 --- a/Documentation/admin-guide/sysctl/kernel.rst +++ b/Documentation/admin-guide/sysctl/kernel.rst @@ -561,8 +561,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 48ac68ebab728..381282fb756c3 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -928,7 +928,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);