Message ID | 20230124185110.143857-4-ebiggers@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2318742wrn; Tue, 24 Jan 2023 10:53:09 -0800 (PST) X-Google-Smtp-Source: AMrXdXuWI2VrYm4ForcREaSoJvPEzXapb8jynaHB/7iNJg82nj9WoHrEzW2h5zhvgIbCyGv0A32X X-Received: by 2002:a05:6a00:4c91:b0:580:ea08:5277 with SMTP id eb17-20020a056a004c9100b00580ea085277mr31000895pfb.16.1674586389592; Tue, 24 Jan 2023 10:53:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674586389; cv=none; d=google.com; s=arc-20160816; b=gA00mKnTJABtX+INlA1fw1tRKgPbqAO2cBU6kVoOow2Cm8pAB4NZSUOKMHeAaBXOAe fEj3XOwKaDseRJIonQ+X2TVX+ivhDSrwLpUwVg3kkf9kvASVVMk3Ky5UVJVhL+4iS9ty 6xu8JoX8qt1Zbwf+PAFEPDjHdaSlrJ09/flrAc3zZfOmvfE+NWM7CYJwLYg8ZkT7z+2C gQdQzjs3H7Ef9vqBlAhPTGMymBZvKx5TZbDoiFhCfrTbLGf3Yz7WcmInMgLLQBlqIN7E FwTUcB4OAu6cbViVnd+VwAmrh2eHJMLjOSICE9nblyCAhyr8vi670o8LBAjKuCIc7qRF NeoA== 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=YXxFrWp2XxPcAMlEt6CXmhB5psC1oJ6sDkufw4U+g2Y=; b=IV7k8TZll2haQgh8CfJdjiO75Lddp7x4Q2GTFkbZued+5ytkYIsLELgR11ecaKrrdY u6HEFpKv5e2n5qzQRdDJdBlYEKbHTLlWzs4jfirCfjpuw2IBq5TwRGzgjrwiVSrLI48D 2HDkTQzYE+9TWzJkOcqpO++G/myBvabKXQcHLmuozRm5x/7d9eHh1QY6An6yg6b+7iKq QOoSYsPiPj6Aumyn5MQwsZirNIuVljbiwBcDZISHa5GyheSh+mxr5nD9vVxLc0tRLEcQ 4eK/HrUMaYaxzYunkS0sHbPDEqurIJVqdtNpyHpMIYOEvekEecryW+X5xg8AI9sOJnQh a1pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FUF0b4HL; 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 y195-20020a6264cc000000b0057462551be5si2961202pfb.237.2023.01.24.10.52.55; Tue, 24 Jan 2023 10:53:09 -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=FUF0b4HL; 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 S234226AbjAXSwT (ORCPT <rfc822;rust.linux@gmail.com> + 99 others); Tue, 24 Jan 2023 13:52:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234158AbjAXSwG (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 24 Jan 2023 13:52:06 -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 E9B18305FD; Tue, 24 Jan 2023 10:52:05 -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 9DBC6B816A4; Tue, 24 Jan 2023 18:52:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA4DEC433D2; Tue, 24 Jan 2023 18:52:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674586323; bh=ddhv5ZxDDV8fG0tIULVcl+ZErzPf+c/2H6zK1ntF56M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FUF0b4HLD8/J08B1DhAe6wF+jGyV1GTa4S3Np4VZl3fBWcGhcOaiaLXAj2GJK8djO sulhGapTFWWRF1j3Rl2i/8YEmibrsz6UspWyWPSDTkue+fV3YEZjhu9JFzpaGPKY52 WcJjeNTF6uvfn4gpBSsEN1+dXBiTc2OKuaaNvm2eV+FFFzMZob5tliVYSxlPVPxoRw UNQhji7iSHB2ofY/COuzE9BcPLnaiNzk0ipjMBhS9/qWDepCz+PfPv/BgWKhnXy0ao atre0vCb/6vCEt4dx20Ote8BCWc24EQg2VAWRiQthwCk6dc1QJjKo+kSAer/3bY526 rovSOp/TCmZ3Q== From: Eric Biggers <ebiggers@kernel.org> To: stable@vger.kernel.org, Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Kees Cook <keescook@chromium.org>, SeongJae Park <sj@kernel.org>, Seth Jenkins <sethjenkins@google.com>, Jann Horn <jannh@google.com>, "Eric W . Biederman" <ebiederm@xmission.com>, linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org, Andrey Ryabinin <ryabinin.a.a@gmail.com>, Baoquan He <bhe@redhat.com>, Jonathan Corbet <corbet@lwn.net>, Xuefeng Li <lixuefeng@loongson.cn>, Tiezhu Yang <yangtiezhu@loongson.cn>, Marco Elver <elver@google.com>, Andrew Morton <akpm@linux-foundation.org>, Linus Torvalds <torvalds@linux-foundation.org> Subject: [PATCH 5.15 03/20] panic: unset panic_on_warn inside panic() Date: Tue, 24 Jan 2023 10:50:53 -0800 Message-Id: <20230124185110.143857-4-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 Content-Transfer-Encoding: 8bit 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755931098375788408?= X-GMAIL-MSGID: =?utf-8?q?1755931098375788408?= |
Series |
Backport oops_limit to 5.15
|
|
Commit Message
Eric Biggers
Jan. 24, 2023, 6:50 p.m. UTC
From: Tiezhu Yang <yangtiezhu@loongson.cn> commit 1a2383e8b84c0451fd9b1eec3b9aab16f30b597c upstream. In the current code, the following three places need to unset panic_on_warn before calling panic() to avoid recursive panics: kernel/kcsan/report.c: print_report() kernel/sched/core.c: __schedule_bug() mm/kfence/report.c: kfence_report_error() In order to avoid copy-pasting "panic_on_warn = 0" all over the places, it is better to move it inside panic() and then remove it from the other places. Link: https://lkml.kernel.org/r/1644324666-15947-4-git-send-email-yangtiezhu@loongson.cn Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn> Reviewed-by: Marco Elver <elver@google.com> Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com> Cc: Baoquan He <bhe@redhat.com> Cc: Jonathan Corbet <corbet@lwn.net> Cc: Xuefeng Li <lixuefeng@loongson.cn> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Eric Biggers <ebiggers@google.com> --- kernel/panic.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/kernel/panic.c b/kernel/panic.c index 5ee281b996f9e..5ed1ad06f9a34 100644 --- a/kernel/panic.c +++ b/kernel/panic.c @@ -208,6 +208,16 @@ void panic(const char *fmt, ...) int old_cpu, this_cpu; bool _crash_kexec_post_notifiers = crash_kexec_post_notifiers; + if (panic_on_warn) { + /* + * This thread may hit another WARN() in the panic path. + * Resetting this prevents additional WARN() from panicking the + * system on this thread. Other threads are blocked by the + * panic_mutex in panic(). + */ + panic_on_warn = 0; + } + /* * Disable local interrupts. This will prevent panic_smp_self_stop * from deadlocking the first cpu that invokes the panic, since @@ -616,16 +626,8 @@ void __warn(const char *file, int line, void *caller, unsigned taint, if (regs) show_regs(regs); - if (panic_on_warn) { - /* - * This thread may hit another WARN() in the panic path. - * Resetting this prevents additional WARN() from panicking the - * system on this thread. Other threads are blocked by the - * panic_mutex in panic(). - */ - panic_on_warn = 0; + if (panic_on_warn) panic("panic_on_warn set ...\n"); - } if (!regs) dump_stack();