From: Xiaoming Ni <nixiaoming@huawei.com>
To: <linux-kernel@vger.kernel.org>, <benh@kernel.crashing.org>,
<mpe@ellerman.id.au>, <paulus@samba.org>,
<linuxppc-dev@lists.ozlabs.org>, <yanaijie@huawei.com>,
<npiggin@gmail.com>, <christophe.leroy@csgroup.eu>,
<ravi.bangoria@linux.ibm.com>, <mikey@neuling.org>,
<aneesh.kumar@linux.ibm.com>, <haren@linux.ibm.com>
Cc: wangle6@huawei.com, nixiaoming@huawei.com
Subject: [PATCH] powerpc:Don't print raw EIP/LR hex values in dump_stack() and show_regs()
Date: Mon, 21 Dec 2020 11:27:58 +0800 [thread overview]
Message-ID: <20201221032758.12143-1-nixiaoming@huawei.com> (raw)
Since the commit 2b0e86cc5de6 ("powerpc/fsl_booke/32: implement KASLR
infrastructure"), the powerpc system is ready to support KASLR.
To reduces the risk of invalidating address randomization, don't print the
EIP/LR hex values in dump_stack() and show_regs().
This patch follows x86 and arm64's lead:
commit a25ffd3a6302a6 ("arm64: traps: Don't print stack or raw
PC/LR values in backtraces")
commit bb5e5ce545f203 ("x86/dumpstack: Remove kernel text
addresses from stack dump")
Signed-off-by: Xiaoming Ni <nixiaoming@huawei.com>
---
arch/powerpc/kernel/process.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index a66f435dabbf..913cf1ea702e 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -1455,8 +1455,8 @@ static void __show_regs(struct pt_regs *regs)
{
int i, trap;
- printk("NIP: "REG" LR: "REG" CTR: "REG"\n",
- regs->nip, regs->link, regs->ctr);
+ printk("NIP: %pS LR: %pS CTR: "REG"\n",
+ (void *)regs->nip, (void *)regs->link, regs->ctr);
printk("REGS: %px TRAP: %04lx %s (%s)\n",
regs, regs->trap, print_tainted(), init_utsname()->release);
printk("MSR: "REG" ", regs->msr);
@@ -1493,8 +1493,8 @@ static void __show_regs(struct pt_regs *regs)
* above info out without failing
*/
if (IS_ENABLED(CONFIG_KALLSYMS)) {
- printk("NIP ["REG"] %pS\n", regs->nip, (void *)regs->nip);
- printk("LR ["REG"] %pS\n", regs->link, (void *)regs->link);
+ printk("NIP %pS\n", (void *)regs->nip);
+ printk("LR %pS\n", (void *)regs->link);
}
}
@@ -2160,8 +2160,8 @@ void show_stack(struct task_struct *tsk, unsigned long *stack,
newsp = stack[0];
ip = stack[STACK_FRAME_LR_SAVE];
if (!firstframe || ip != lr) {
- printk("%s["REG"] ["REG"] %pS",
- loglvl, sp, ip, (void *)ip);
+ printk("%s ["REG"] %pS",
+ loglvl, sp, (void *)ip);
ret_addr = ftrace_graph_ret_addr(current,
&ftrace_idx, ip, stack);
if (ret_addr != ip)
--
2.27.0
next reply other threads:[~2020-12-21 3:30 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-21 3:27 Xiaoming Ni [this message]
2020-12-21 15:17 ` [PATCH] powerpc:Don't print raw EIP/LR hex values in dump_stack() and show_regs() Christophe Leroy
2020-12-21 16:31 ` Segher Boessenkool
2020-12-21 16:42 ` David Laight
2020-12-21 17:12 ` Segher Boessenkool
2020-12-22 13:45 ` Xiaoming Ni
2020-12-22 17:29 ` Segher Boessenkool
2020-12-22 17:45 ` Christophe Leroy
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=20201221032758.12143-1-nixiaoming@huawei.com \
--to=nixiaoming@huawei.com \
--cc=aneesh.kumar@linux.ibm.com \
--cc=benh@kernel.crashing.org \
--cc=christophe.leroy@csgroup.eu \
--cc=haren@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mikey@neuling.org \
--cc=mpe@ellerman.id.au \
--cc=npiggin@gmail.com \
--cc=paulus@samba.org \
--cc=ravi.bangoria@linux.ibm.com \
--cc=wangle6@huawei.com \
--cc=yanaijie@huawei.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