Commit 36fc8758 authored by Nicolas Iooss's avatar Nicolas Iooss Committed by Greg Kroah-Hartman

x86/mm/pkeys: Do not skip PKRU register if debug registers are not used

commit ba6d018e upstream.

__show_regs() fails to dump the PKRU state when the debug registers are in
their default state because there is a return statement on the debug
register state.

Change the logic to report PKRU value even when debug registers are in
their default state.

Fixes:c0b17b5b ("x86/mm/pkeys: Dump PKRU with other kernel registers")
Signed-off-by: default avatarNicolas Iooss <nicolas.iooss_linux@m4x.org>
Acked-by: default avatarDave Hansen <dave.hansen@linux.intel.com>
Link: http://lkml.kernel.org/r/20160910183045.4618-1-nicolas.iooss_linux@m4x.orgSigned-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 0480b221
...@@ -110,12 +110,13 @@ void __show_regs(struct pt_regs *regs, int all) ...@@ -110,12 +110,13 @@ void __show_regs(struct pt_regs *regs, int all)
get_debugreg(d7, 7); get_debugreg(d7, 7);
/* Only print out debug registers if they are in their non-default state. */ /* Only print out debug registers if they are in their non-default state. */
if ((d0 == 0) && (d1 == 0) && (d2 == 0) && (d3 == 0) && if (!((d0 == 0) && (d1 == 0) && (d2 == 0) && (d3 == 0) &&
(d6 == DR6_RESERVED) && (d7 == 0x400)) (d6 == DR6_RESERVED) && (d7 == 0x400))) {
return; printk(KERN_DEFAULT "DR0: %016lx DR1: %016lx DR2: %016lx\n",
d0, d1, d2);
printk(KERN_DEFAULT "DR0: %016lx DR1: %016lx DR2: %016lx\n", d0, d1, d2); printk(KERN_DEFAULT "DR3: %016lx DR6: %016lx DR7: %016lx\n",
printk(KERN_DEFAULT "DR3: %016lx DR6: %016lx DR7: %016lx\n", d3, d6, d7); d3, d6, d7);
}
if (boot_cpu_has(X86_FEATURE_OSPKE)) if (boot_cpu_has(X86_FEATURE_OSPKE))
printk(KERN_DEFAULT "PKRU: %08x\n", read_pkru()); printk(KERN_DEFAULT "PKRU: %08x\n", read_pkru());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment