lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20220815092137.1819-1-thunder.leizhen@huawei.com>
Date:   Mon, 15 Aug 2022 17:21:37 +0800
From:   Zhen Lei <thunder.leizhen@...wei.com>
To:     Russell King <linux@...linux.org.uk>,
        <linux-arm-kernel@...ts.infradead.org>,
        <linux-kernel@...r.kernel.org>, <patches@...linux.org.uk>
CC:     Zhen Lei <thunder.leizhen@...wei.com>
Subject: [PATCH v2] ARM: Remove the special printing format of pc and lr in __show_regs()

When CONFIG_KALLSYMS is set, the parsed symbols of 'pc' and 'lr' are
printed. Otherwise, the raw content of 'pc' and 'lr' are printed in the
lines: "PC is at" and "LR is at". If at this point they are printed in
format [<%08lx>], the subsequent printing of 'pc' and 'lr' does not need
to follow this format again. This allows the register list to be printed
neatly.

For example:
CONFIG_KALLSYMS=y before:
PC is at test+0x58/0x74
LR is at test+0x28/0x74
pc : [<802f3868>]    lr : [<802f3838>]    psr: 60000013
sp : cabc5da8  ip : 00002ff4  fp : 00000001
r10: 81951018  r9 : 00400cc0  r8 : 7ffff000

CONFIG_KALLSYMS=n after:
PC is at [<802f369c>]
LR is at [<802f366c>]
pc : 802f369c  lr : 802f366c  psr: 60000013
sp : cabd9da8  ip : 00002ff4  fp : 00000001
r10: 827e6018  r9 : 00400cc0  r8 : 7ffff000

Signed-off-by: Zhen Lei <thunder.leizhen@...wei.com>
---
KernelVersion: v6.0-rc1
 arch/arm/kernel/process.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

v1 --> v2:
On the basis of v1, print the instruction pointers in the lines of
"PC is at" and "LR is at" in format [<%08lx>] if CONFIG_KALLSYMS=n,
as is done in dump_backtrace_entry(). To make sure that tools like
scripts/decode_stacktrace.sh can output the symbols of 'pc' and 'lr'.

v1:
Change the format of "pc:" and "lr:" from [<%08lx>] to %08lx.

diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index 96f3fbd51764292..f9f4e31393a6f56 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -134,9 +134,15 @@ void __show_regs(struct pt_regs *regs)
 
 	show_regs_print_info(KERN_DEFAULT);
 
+#ifdef CONFIG_KALLSYMS
 	printk("PC is at %pS\n", (void *)instruction_pointer(regs));
 	printk("LR is at %pS\n", (void *)regs->ARM_lr);
-	printk("pc : [<%08lx>]    lr : [<%08lx>]    psr: %08lx\n",
+#else
+	printk("PC is at [<%08lx>]\n", instruction_pointer(regs));
+	printk("LR is at [<%08lx>]\n", regs->ARM_lr);
+#endif
+
+	printk("pc : %08lx  lr : %08lx  psr: %08lx\n",
 	       regs->ARM_pc, regs->ARM_lr, regs->ARM_cpsr);
 	printk("sp : %08lx  ip : %08lx  fp : %08lx\n",
 	       regs->ARM_sp, regs->ARM_ip, regs->ARM_fp);
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ