From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E695BC4363A for ; Mon, 26 Oct 2020 18:05:12 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 666402222C for ; Mon, 26 Oct 2020 18:05:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="eqDmAuhB"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="NDe/P1Vb" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 666402222C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=I5ZVPhk1NrVkev1cBMfkwmw75cZD5zxQCFzVHFZwO4c=; b=eqDmAuhBdNbZC91+9WAyGp/gs 6D2qT9enmJl1TPnY0rbfB4H+t4PMhXzW2WXa3DIl6wiCLx//feYvCGQDAAycC70hROEcqJYSTlLSF eqF0hsrqWA+M3uN7Kazh/y3zudMjPyc0L/zHAVpAMRT9i+0SAp+It23DesKEEkLsobKi63DVdfInO szKWHtfJcVPcGsIF1bRGGhaljCiBRtpgxOhZiBPDAbtWbQz19/ROhHU4Y18EKnkSZRk7pmSorjI+9 9uVMg1Y97h2COn4MXY0VLRRq4x4SUdbvt37wurENIZmTy5mArpFsgyrhqrY2vo9EXINPNvpkh+5Lq 3f9Oppwlw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kX6qM-0003Xk-AA; Mon, 26 Oct 2020 18:03:42 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kX6qG-0002OI-6s for linux-arm-kernel@lists.infradead.org; Mon, 26 Oct 2020 18:03:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=k86Sk2vzUdIAWAPQ+NHqfUDiJ+SZmpD+LsPmG5feGcA=; b=NDe/P1VbFb3pzpjR++6NAqOf/ fmUUQsRNOWIKCXzcPczLfURwp/QtACFvZyjzlhKp3Jk6iY/nhj6DjFlttHcU+FxYnWfe7Hf3glLn5 n2lrFShAAGVRtTC/MbE6zL/oCMMDOjj4rJvywS/RX29ErMLbPy3rAOozPwM4h1YL9bBuGGBoDjxHp wIBNcGyvHnzpotXZxTMZE7Pg0tfOMdJN8reDhBH3lY6a2RnBYfnDcfXrjaiRlFWkkeIqhY97WGR+l Z3+3prrjFtf27Q6at5sx8begjdB8Exaf3PBXNHjkiMxDHvxa/ldOKoWOFWXkOI5MCj6iAp18/NMkK 1KwEQC57Q==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:51294) by pandora.armlinux.org.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kX6oA-0007uS-S1; Mon, 26 Oct 2020 18:01:26 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.92) (envelope-from ) id 1kX6oA-0003CP-Ep; Mon, 26 Oct 2020 18:01:26 +0000 Date: Mon, 26 Oct 2020 18:01:26 +0000 From: Russell King - ARM Linux admin To: Xiaoming Ni Subject: Re: [PATCH] arm:traps:Don't dump the memory in non-system reset scenarios Message-ID: <20201026180126.GI1551@shell.armlinux.org.uk> References: <20201026063106.20744-1-nixiaoming@huawei.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20201026063106.20744-1-nixiaoming@huawei.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201026_140336_283748_5EA06558 X-CRM114-Status: GOOD ( 25.91 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: wangle6@huawei.com, bigeasy@linutronix.de, vincent.whitchurch@axis.com, will.deacon@arm.com, linux-kernel@vger.kernel.org, jpoimboe@redhat.com, akpm@linux-foundation.org, tglx@linutronix.de, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Oct 26, 2020 at 02:31:06PM +0800, Xiaoming Ni wrote: > Do not dump the memory in non-system reset scenarios to prevent virtual > address information leakage. > > This patch follows x86 and arm64's lead and removes the "Exception stack:" > dump from kernel backtraces: > commit a25ffd3a6302a6 ("arm64: traps: Don't print stack or raw > PC/LR values in backtraces") > commit 0ee1dd9f5e7eae ("x86/dumpstack: Remove raw stack dump") Please make this conditional, so that if necessary this information can be retrieved for debugging purposes. I object extremely strongly to this "it's a security leak, let's rip out all the useful debugging that enables people to get to the bottom of problems" attitude that we now seem to have. If that's what people want, then do not expect me to ever look at a kernel crash again; other people can do the debugging and find out how painful it can be without extra information. > Signed-off-by: Xiaoming Ni > --- > arch/arm/kernel/traps.c | 13 ++++++------- > 1 file changed, 6 insertions(+), 7 deletions(-) > > diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c > index 911bbf164875..34e268378972 100644 > --- a/arch/arm/kernel/traps.c > +++ b/arch/arm/kernel/traps.c > @@ -60,13 +60,9 @@ static int __init user_debug_setup(char *str) > __setup("user_debug=", user_debug_setup); > #endif > > -static void dump_mem(const char *, const char *, unsigned long, unsigned long); > - > void dump_backtrace_entry(unsigned long where, unsigned long from, > unsigned long frame, const char *loglvl) > { > - unsigned long end = frame + 4 + sizeof(struct pt_regs); > - > #ifdef CONFIG_KALLSYMS > printk("%s (%ps) from (%pS)\n", > loglvl, (void *)where, (void *)from); > @@ -74,9 +70,6 @@ void dump_backtrace_entry(unsigned long where, unsigned long from, > printk("%sFunction entered at [<%08lx>] from [<%08lx>]\n", > loglvl, where, from); > #endif > - > - if (in_entry_text(from) && end <= ALIGN(frame, THREAD_SIZE)) > - dump_mem(loglvl, "Exception stack", frame + 4, end); > } > > void dump_backtrace_stm(u32 *stack, u32 instruction, const char *loglvl) > @@ -125,6 +118,12 @@ static void dump_mem(const char *lvl, const char *str, unsigned long bottom, > mm_segment_t fs; > int i; > > + /* > + * To prevent virtual address information leakage, memory > + * information cannot be printed in non-reset scenarios. > + */ > + if (panic_on_oops == 0) > + return; > /* > * We need to switch to kernel mode so that we can use __get_user > * to safely read from kernel space. Note that we now dump the > -- > 2.27.0 > > -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last! _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel