From: Xiaoming Ni <nixiaoming@huawei.com>
To: <linux@armlinux.org.uk>, <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>
Cc: wangle6@huawei.com, nixiaoming@huawei.com
Subject: [PATCH] arm:traps:Don't dump the memory in non-system reset scenarios
Date: Mon, 26 Oct 2020 14:31:06 +0800 [thread overview]
Message-ID: <20201026063106.20744-1-nixiaoming@huawei.com> (raw)
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 <nixiaoming@huawei.com>
---
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
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next reply other threads:[~2020-10-26 6:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-26 6:31 Xiaoming Ni [this message]
2020-10-26 18:01 ` [PATCH] arm:traps:Don't dump the memory in non-system reset scenarios Russell King - ARM Linux admin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201026063106.20744-1-nixiaoming@huawei.com \
--to=nixiaoming@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=bigeasy@linutronix.de \
--cc=jpoimboe@redhat.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=tglx@linutronix.de \
--cc=vincent.whitchurch@axis.com \
--cc=wangle6@huawei.com \
--cc=will.deacon@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).