summaryrefslogtreecommitdiffstats
path: root/arch/arm64
diff options
context:
space:
mode:
authorWill Deacon <will.deacon@arm.com>2018-02-19 16:46:57 +0000
committerBen Hutchings <ben@decadent.org.uk>2018-06-16 22:22:21 +0100
commit18ba80533558af0cb186ccb71022fabfa9604ffe (patch)
tree92216b100e7d81fbb83dd7f1eea44434edbf3db3 /arch/arm64
parentdb95024d392a6b65962b4f68c3fcca6bb67299b0 (diff)
downloadlinux-stable-18ba80533558af0cb186ccb71022fabfa9604ffe.tar.gz
linux-stable-18ba80533558af0cb186ccb71022fabfa9604ffe.tar.bz2
linux-stable-18ba80533558af0cb186ccb71022fabfa9604ffe.zip
arm64: __show_regs: Only resolve kernel symbols when running at EL1
commit a06f818a70de21b4b3b4186816094208fc7accf9 upstream. __show_regs pretty prints PC and LR by attempting to map them to kernel function names to improve the utility of crash reports. Unfortunately, this mapping is applied even when the pt_regs corresponds to user mode, resulting in a KASLR oracle. Avoid this issue by only looking up the function symbols when the register state indicates that we're actually running at EL1. Reported-by: NCSC Security <security@ncsc.gov.uk> Signed-off-by: Will Deacon <will.deacon@arm.com> [bwh: Backported to 3.16: adjust context] Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'arch/arm64')
-rw-r--r--arch/arm64/kernel/process.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c
index 831a45e1f8e4..0bfb5fe5fdc7 100644
--- a/arch/arm64/kernel/process.c
+++ b/arch/arm64/kernel/process.c
@@ -197,8 +197,15 @@ void __show_regs(struct pt_regs *regs)
}
show_regs_print_info(KERN_DEFAULT);
- printk("pc : %pS\n", (void *)regs->pc);
- printk("lr : %pS\n", (void *)lr);
+
+ if (!user_mode(regs)) {
+ printk("pc : %pS\n", (void *)regs->pc);
+ printk("lr : %pS\n", (void *)lr);
+ } else {
+ printk("pc : %016llx\n", regs->pc);
+ printk("lr : %016llx\n", lr);
+ }
+
printk("sp : %016llx pstate : %08llx\n", sp, regs->pstate);
for (i = top_reg; i >= 0; i--) {
printk("x%-2d: %016llx ", i, regs->regs[i]);