Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp698715pxx; Mon, 26 Oct 2020 20:00:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxw845rPFcQaGvAUX4P9/0sEPKK9sXdnKnbEw0j585Ns/3jlt30aYpDQq8VoaGCcnVDG4LT X-Received: by 2002:a17:906:348c:: with SMTP id g12mr351766ejb.422.1603767608962; Mon, 26 Oct 2020 20:00:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603767608; cv=none; d=google.com; s=arc-20160816; b=XLHWhA1LGeDUUQowm6WKBxmZ7Ozi66CZ8nROoVxDk0Crd5SdseugOtYO41eHgLSp1i rpCtGrrz1sOevUcd+IxANOu0CG1rkdPiOjvZSaGFn80GPZdyCw7qgHtpiUpa7IpEaRvc z0iDgjO24uHSLtUjCUPUrxTzGl5QtHuIfnTGTmPLhlmYoxYjcDW5JWl4JwXNHdJItpX4 3lkW+HYHLn4BZNORsYElMy7gZQNDStYp/CPq/7QT+J4PWtjGR1oVq/hUMiYI+BhE0RF8 Sl89bn+lwgYOJlbAkPclqsebluUiemulLOgMOSYxixeZAjc+vu/XNZxCz1MqTcni7LbB 8a9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=k86Sk2vzUdIAWAPQ+NHqfUDiJ+SZmpD+LsPmG5feGcA=; b=eQF35i2kzNe/fBP+rIWa4aJwRHfmvhirgJA2ZwUuaCxxisSgVmFeyFNsi6l9YN77DF 7Iy/C/5b22WOJ1/oZnJgAyr4P1hEHKi+5bl+seIfwwYKfR8U46rw5m8A62HEuST2w8h5 toMVxhrGxYvkaH6rRR3cffDOvqtXa1I90HJIkMa6dlsCZ9jZG2Uk5AL69xZy7y5ivsPF H+9/b5fJEl+axBQirtdKMNucS5nV/2n4qbl17e0vwSx02TzuELMhznIC5AZaJ9aFQxNB BV4MVttfHQY8CqfJn2d6wgQ6Mav3svJBUwRxlGo1TL/iLCk+Pz+rFM8gKZwhSYQ6luyJ gR9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b="NDe/P1Vb"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y1si7475583edp.57.2020.10.26.19.59.47; Mon, 26 Oct 2020 20:00:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b="NDe/P1Vb"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1789221AbgJZSI5 (ORCPT + 99 others); Mon, 26 Oct 2020 14:08:57 -0400 Received: from pandora.armlinux.org.uk ([78.32.30.218]:46416 "EHLO pandora.armlinux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1789214AbgJZSIz (ORCPT ); Mon, 26 Oct 2020 14:08:55 -0400 X-Greylist: delayed 558 seconds by postgrey-1.27 at vger.kernel.org; Mon, 26 Oct 2020 14:08:53 EDT 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 Cc: akpm@linux-foundation.org, tglx@linutronix.de, vincent.whitchurch@axis.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, jpoimboe@redhat.com, bigeasy@linutronix.de, will.deacon@arm.com, wangle6@huawei.com 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-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201026063106.20744-1-nixiaoming@huawei.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: Russell King - ARM Linux admin Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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!