From patchwork Tue Feb 6 21:39:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nir Lichtman X-Patchwork-Id: 197654 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp1840934dyb; Tue, 6 Feb 2024 13:44:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IGqPb8dNlieXacKgI61J8tt50/OtroMr3gYic67/KyuY5qlTEXto+CMJ0l2pIueRmrt292s X-Received: by 2002:ad4:5ca6:0:b0:68c:a6ac:ea86 with SMTP id q6-20020ad45ca6000000b0068ca6acea86mr7470983qvh.2.1707255875107; Tue, 06 Feb 2024 13:44:35 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707255875; cv=pass; d=google.com; s=arc-20160816; b=MqfaP1TecnjGGiMN4gGexeTcqSi0nqDBC3fnWn+jflAqDTSv+UWJS2MVX2fv8v/pNc pAuw0YHzBxjqK6jKzdTrfpGXrFTG62oIJEcR0TwdvHWPiXCgoUWMiya7m+4GFik3ahh1 vquSOaQCj2EUDGIezy1Elb0MPfD5GMY1clM9dR0ixTTcBCygO4lkBUqqNIpPJ5pD1lCc Cn//Fnb77YX2Ipfg74pF8NYIws0cxwxLii05A0u+4twvAL4vx3Jm/GT9hfSEsPHMNwyQ Lu3n2MutMqzGB7iEwDtn3OOa3FuyR5dU6yUf9WklA8xWfWEvnPDUL2RjzKPCQipNMGxe F6jA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-disposition:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:message-id:subject:to:from:date:dkim-signature; bh=nQ5xe0HKKbq/ErxUGJNXKaGM7XjTWDe6iVd0oA3K8jU=; fh=YUinnDucP6RksN5rZ5Z3Nml9VveP2rq/4rlpSSlLK+A=; b=R61J6A20EJderuQxBnO0WOVNDD5zXyqgtn1RYhuNoDyiZCK/ONjtVzyt3qiu25nJpb 1VW0IyNXONY7ocnzDHzASZosdTfwYRpriKOP8QO5AQwo3M3AlgHcKBtJR1O8g0rEZ6lF EQ5JRuOqZBKV7tAknziEnrz/uY1JBjFfFx6xZY0FOJAi5jdsWMS5aw9+R59uTmeY7N0b 0D/VMLY/UhQZIicpsUdiVjrGC7ndxMQutf6GlDJYIqe4qR3LqjFPA32+mcY3Ohke5D5W CEMsZH9WtZkBDBwY0CfzAZ7D+ipeptMbDVP+utUO9AbVwFPUPWGD+H5I5UHTaFRiDs3H rfeA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@lichtman.org header.s=mail header.b=MslBc6fW; arc=pass (i=1 spf=pass spfdomain=lichtman.org dkim=pass dkdomain=lichtman.org dmarc=pass fromdomain=lichtman.org); spf=pass (google.com: domain of linux-kernel+bounces-55645-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55645-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lichtman.org X-Forwarded-Encrypted: i=1; AJvYcCV9CsPjEk3cp6PbiYhxAfIfA/WG9BpZfWBFuH9BwZOMyjtbpgkjCr91bp4SQVcgbj3ynQUlSJVPIAnbUytgMcJIkeFJFw== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id a3-20020a0ce903000000b0068c87dfc7edsi3309446qvo.311.2024.02.06.13.44.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 13:44:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-55645-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@lichtman.org header.s=mail header.b=MslBc6fW; arc=pass (i=1 spf=pass spfdomain=lichtman.org dkim=pass dkdomain=lichtman.org dmarc=pass fromdomain=lichtman.org); spf=pass (google.com: domain of linux-kernel+bounces-55645-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55645-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lichtman.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id DECD71C2319B for ; Tue, 6 Feb 2024 21:44:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4B6FB1BF38; Tue, 6 Feb 2024 21:44:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lichtman.org header.i=@lichtman.org header.b="MslBc6fW" Received: from lichtman.org (lichtman.org [149.28.33.109]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C2CED1BC35 for ; Tue, 6 Feb 2024 21:44:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=149.28.33.109 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707255861; cv=none; b=QlgysGq+5pa1nPEXTg3JhEGZfBNPSMnQN2dRDOWjQ6UmEcOCLZ03zQ4wXLOjQQ3j0yd02ZA9IHlGejDmNMWWZZXfiFfh2ty6dHQDCA4GWhbN0BGT5gFUnMybnzXfrkRlgeJxEhP+Jw7AEGb4WQwlCz8+pxHamRmZMSx5n7BEXUI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707255861; c=relaxed/simple; bh=lH5sVaiLtqfzbtaHk3feLejvLIsj4MXSS+5uIQz64KA=; h=Date:From:To:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=Pc4RbXc1g3frNa2Hw3tCpxQBpWg/m4lBEtXLKnMJkDUExaPaHEhnAp5ygt8ZqlDaQ7VhWZiXIu0Tr3UX7z4JxkvqelF8TkgwgmPele6gMUx0GjuF11f05RGxUYXeSHj7qKGpEU2HkNJolgCqEiXwnDArwmwUtZq5/ROtF9u4AfQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lichtman.org; spf=pass smtp.mailfrom=lichtman.org; dkim=pass (2048-bit key) header.d=lichtman.org header.i=@lichtman.org header.b=MslBc6fW; arc=none smtp.client-ip=149.28.33.109 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lichtman.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lichtman.org Received: by lichtman.org (Postfix, from userid 1000) id CEC31176E0F; Tue, 6 Feb 2024 21:39:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=lichtman.org; s=mail; t=1707255542; bh=lH5sVaiLtqfzbtaHk3feLejvLIsj4MXSS+5uIQz64KA=; h=Date:From:To:Subject:From; b=MslBc6fWC1O/HL7WEIkwStU/meOS2aJg/sQ6wGFsrMUfntp/gxPKLMg099WZbT5tE uvtLgQ3gOeV5lnIgeLBze/RzYQTbhvN31VGeLF8Go4kmmV8HkWBIKGK5ulkWJgf95B izBdpYtkVU9ozPzbgaRTpd0MkOJgi011mTUsviZm0khmasvJm/Dq/kybSl/FMU0ItV EkxC2TbxL5a4kNnj04ZT/IbakBdu3uzdNu7U0VCY7YU1rcUOC9KA1ISQrTHPXZHEu2 TSvcjVF+OPH/HU3T58YNTcU/9Y8eqmm4TNGFhSs/g6zmvqnwTjys+g2LdqeYlmtzsa zaD8d5OxKmqdg== Date: Tue, 6 Feb 2024 21:39:02 +0000 From: Nir Lichtman To: linux-kernel@vger.kernel.org Subject: [PATCH] kernel: add boot param to disable stack dump on panic Message-ID: <20240206213902.GA1490631@lichtman.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790187536906961436 X-GMAIL-MSGID: 1790187536906961436 From: Nir Lichtman Date: Sat, 3 Feb 2024 10:19:30 +0200 Subject: [PATCH] kernel: add boot param to disable stack dump on panic --- Documentation/admin-guide/kernel-parameters.txt | 5 +++++ kernel/panic.c | 12 +++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index 31b3a2568..433e3e5d1 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -1127,6 +1127,11 @@ MTRR settings. This parameter disables that behavior, possibly causing your machine to run very slowly. + disable_stack_dump_on_panic + This parameter disables call stack dumping when there + is a panic, which can help obscure less earlier messages + that lead to the panic. + disable_timer_pin_1 [X86] Disable PIN 1 of APIC timer Can be useful to work around chipset bugs. diff --git a/kernel/panic.c b/kernel/panic.c index 2807639aa..a1e1d064e 100644 --- a/kernel/panic.c +++ b/kernel/panic.c @@ -266,6 +266,16 @@ static void panic_other_cpus_shutdown(bool crash_kexec) crash_smp_send_stop(); } +static int disable_stack_dump_on_panic __initdata; + +static int __init disable_stack_dump_on_panic_setup(char *str) +{ + disable_stack_dump_on_panic = 1; + return 0; +} + +early_param("disable_stack_dump_on_panic", disable_stack_dump_on_panic_setup); + /** * panic - halt the system * @fmt: The text string to print @@ -340,7 +350,7 @@ void panic(const char *fmt, ...) /* * Avoid nested stack-dumping if a panic occurs during oops processing */ - if (!test_taint(TAINT_DIE) && oops_in_progress <= 1) + if (!test_taint(TAINT_DIE) && oops_in_progress <= 1 && !disable_stack_dump_on_panic) dump_stack(); #endif