Skip to contentSkip to conversation

Patch "x86/mm/pkeys: Do not skip PKRU register if debug registers are not used" has been added to the 4.8-stable tree

PATCH [email protected] 1 participant 1 message Oct 14, 2016

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

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

to the 4.8-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
x86-mm-pkeys-do-not-skip-pkru-register-if-debug-registers-are-not-used.patch
and it can be found in the queue-4.8 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From ba6d018e3d2f6a0fad58a668cadf66b2d1f80f59 Mon Sep 17 00:00:00 2001

From: Nicolas Iooss <[email protected]>
Date: Sat, 10 Sep 2016 20:30:45 +0200
Subject: x86/mm/pkeys: Do not skip PKRU register if debug registers are not used

From: Nicolas Iooss <[email protected]>

commit ba6d018e3d2f6a0fad58a668cadf66b2d1f80f59 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 c0b17b5bd4b7 ("x86/mm/pkeys: Dump PKRU with other kernel registers")
---
 arch/x86/kernel/process_64.c |   13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
arch/x86/kernel/process_64.c +7 -6
@@ -110,12 +110,13 @@ void __show_regs(struct pt_regs *regs, i
 	get_debugreg(d7, 7);
 
 	/* Only print out debug registers if they are in their non-default state. */
-	if ((d0 == 0) && (d1 == 0) && (d2 == 0) && (d3 == 0) &&
-	    (d6 == DR6_RESERVED) && (d7 == 0x400))
-		return;
-
-	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 (!((d0 == 0) && (d1 == 0) && (d2 == 0) && (d3 == 0) &&
+	    (d6 == DR6_RESERVED) && (d7 == 0x400))) {
+		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());

Patches currently in stable-queue which might be from [email protected] are

queue-4.8/x86-mm-pkeys-do-not-skip-pkru-register-if-debug-registers-are-not-used.patch