Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp970156pxu; Mon, 26 Oct 2020 00:03:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx7MOP7KkvQlVEt+d/b5jLI15aqKQ+R7rvY6Uf78iN+FcruyAgE0J4XYwuO3d7+riaaS8Td X-Received: by 2002:a17:906:1158:: with SMTP id i24mr13898169eja.304.1603695814868; Mon, 26 Oct 2020 00:03:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603695814; cv=none; d=google.com; s=arc-20160816; b=v4KOcrdLFp8oWZKXoBdR8X3HkEq1EL5os7QB5dsn7lGipwdlZwY1awhfapQ0uSK6F/ gVz/+Lis1oBhtE9DcE92JyGjy8oAf1zrtkZm6XHn29rPxvy857KPpDcLdSKd9XPfcw8A tpqVhr7MNMrTP+ZcMzG+4/Z3XYnJtx9rRep+lWQei6w8DIqVkNL+9uwcj0nIb3HCxv1W tY+PD/lRNDD22i4umT2sevRvdPgHA/ee08dg7xTl8HdiQJqoqlJ2cBWLSuW9LcKtexuH pie3uLHlLfBZaLpIyElTEtGE0O3rpQ/PNB+9ZfhP6Fe0FxKoBkD1VoCjoU3J/eQhyc1R 10YQ== 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 :message-id:date:subject:cc:to:from; bh=0v4X10ixgtNCctt7wgsaBNlQSh+bOkVUKyYwCV0BYTU=; b=pVShMIRZA9mS6nW0yadZzNqr1b8lcSApSUQqpNs3zqHOxjDIfSq9DrhKab0z8mQREX kdG+vfuwthnWny6dybvzfkhu8B9Y5Tyt1Jm6YT6ZYICzmQrOrM/kAX7A2ZjE7/xGUn+b Uk9cpvcZ3L9JoX2mkQw5Jvuuf+GsaesvpPWC5v5s+QnPyVJk1ykywYZdSEMNzzdvr/Yc wY8k7qSh2JkJwqpvqDZXeSpsWfmkw2aDKHuStHMLCBoI+FsHtto9TjXMRe/FakYyWEPF CpgN6faEfeXx7ILhBIVRamGkVagH+ZbUfkHmsNGh0RKAfetQZvb63qdcTpcC1DQtyte1 DFvg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k9si6037729edf.377.2020.10.26.00.03.13; Mon, 26 Oct 2020 00:03:34 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1770410AbgJZGbX (ORCPT + 99 others); Mon, 26 Oct 2020 02:31:23 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:2699 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1770405AbgJZGbW (ORCPT ); Mon, 26 Oct 2020 02:31:22 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4CKQ312ZNgz15MLn; Mon, 26 Oct 2020 14:31:25 +0800 (CST) Received: from use12-sp2.huawei.com (10.67.189.174) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.487.0; Mon, 26 Oct 2020 14:31:10 +0800 From: Xiaoming Ni To: , , , , , , , , CC: , Subject: [PATCH] arm:traps:Don't dump the memory in non-system reset scenarios Date: Mon, 26 Oct 2020 14:31:06 +0800 Message-ID: <20201026063106.20744-1-nixiaoming@huawei.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.67.189.174] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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") 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