x86/mm/pkeys: Dump PKRU with other kernel registers
authorDave Hansen <[email protected]>
Fri, 12 Feb 2016 21:02:25 +0000 (13:02 -0800)
committerIngo Molnar <[email protected]>
Thu, 18 Feb 2016 18:46:29 +0000 (19:46 +0100)
Protection Keys never affect kernel mappings.  But, they can
affect whether the kernel will fault when it touches a user
mapping.  The kernel doesn't touch user mappings without some
careful choreography and these accesses don't generally result in
oopses.  But, if one does, we definitely want to have PKRU
available so we can figure out if protection keys played a role.

Signed-off-by: Dave Hansen <[email protected]>
Reviewed-by: Thomas Gleixner <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: Andy Lutomirski <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: Brian Gerst <[email protected]>
Cc: Dave Hansen <[email protected]>
Cc: Denys Vlasenko <[email protected]>
Cc: H. Peter Anvin <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Rik van Riel <[email protected]>
Cc: [email protected]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
arch/x86/kernel/process_64.c

index b9d99e0f82c4f072a15f7cb3fb3434d391281daf..776229e98202f32dedd96642e03509e516945760 100644 (file)
@@ -116,6 +116,8 @@ void __show_regs(struct pt_regs *regs, int all)
        printk(KERN_DEFAULT "DR0: %016lx DR1: %016lx DR2: %016lx\n", d0, d1, d2);
        printk(KERN_DEFAULT "DR3: %016lx DR6: %016lx DR7: %016lx\n", d3, d6, d7);
 
+       if (boot_cpu_has(X86_FEATURE_OSPKE))
+               printk(KERN_DEFAULT "PKRU: %08x\n", read_pkru());
 }
 
 void release_thread(struct task_struct *dead_task)