summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorWill Deacon <will.deacon@arm.com>2018-02-19 16:46:57 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-02-28 10:21:39 +0100
commit5d1641bd28b2d6a9e1f7a509025c837e0149adea (patch)
treeffab9636e4be6cb51ca4d2ab0b990a370b9936ac /arch
parent6e0535b574bb8569c97752ba33b6739ead19762c (diff)
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. Cc: <stable@vger.kernel.org> Reported-by: NCSC Security <security@ncsc.gov.uk> Signed-off-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch')
-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 583fd8154695..d6ca5fccb229 100644
--- a/arch/arm64/kernel/process.c
+++ b/arch/arm64/kernel/process.c
@@ -221,8 +221,15 @@ void __show_regs(struct pt_regs *regs)
show_regs_print_info(KERN_DEFAULT);
print_pstate(regs);
- print_symbol("pc : %s\n", regs->pc);
- print_symbol("lr : %s\n", lr);
+
+ if (!user_mode(regs)) {
+ print_symbol("pc : %s\n", regs->pc);
+ print_symbol("lr : %s\n", lr);
+ } else {
+ printk("pc : %016llx\n", regs->pc);
+ printk("lr : %016llx\n", lr);
+ }
+
printk("sp : %016llx\n", sp);
i = top_reg;