]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
arm64: __show_regs: Only resolve kernel symbols when running at EL1
authorWill Deacon <will.deacon@arm.com>
Mon, 19 Feb 2018 16:46:57 +0000 (16:46 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 28 Feb 2018 09:21:39 +0000 (10:21 +0100)
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>
arch/arm64/kernel/process.c

index 583fd81546957e4d05de08b08473be5462a36777..d6ca5fccb2298d43a70e819edef9205562e739a6 100644 (file)
@@ -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;