Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1482518

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

From tip-bot for Nicolas Iooss <tipbot@zytor.com>
Newsgroups linux.kernel
Subject [tip:mm/pkeys] x86/mm/pkeys: Do not skip PKRU register if debug registers are not used
Date 2016-09-13 16:10 +0200
Message-ID <sgWzo-2Yc-19@gated-at.bofh.it> (permalink)
References <sfVm2-3Mp-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Commit-ID:  ba6d018e3d2f6a0fad58a668cadf66b2d1f80f59
Gitweb:     http://git.kernel.org/tip/ba6d018e3d2f6a0fad58a668cadf66b2d1f80f59
Author:     Nicolas Iooss <nicolas.iooss_linux@m4x.org>
AuthorDate: Sat, 10 Sep 2016 20:30:45 +0200
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 13 Sep 2016 15:52:28 +0200

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

__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")
Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
Acked-by: Dave Hansen <dave.hansen@linux.intel.com>
Link: http://lkml.kernel.org/r/20160910183045.4618-1-nicolas.iooss_linux@m4x.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 arch/x86/kernel/process_64.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index 63236d8..a21068e 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -110,12 +110,13 @@ void __show_regs(struct pt_regs *regs, int all)
 	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());

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH 1/1] x86: do not skip PKRU register if debug registers are not used Nicolas Iooss <nicolas.iooss_linux@m4x.org> - 2016-09-10 20:40 +0200
  Re: [PATCH 1/1] x86: do not skip PKRU register if debug registers are  not used Dave Hansen <dave.hansen@linux.intel.com> - 2016-09-12 18:50 +0200
  [tip:mm/pkeys] x86/mm/pkeys: Do not skip PKRU register if debug  registers are not used tip-bot for Nicolas Iooss <tipbot@zytor.com> - 2016-09-13 15:20 +0200
  [tip:mm/pkeys] x86/mm/pkeys: Do not skip PKRU register if debug  registers are not used tip-bot for Nicolas Iooss <tipbot@zytor.com> - 2016-09-13 16:10 +0200

csiph-web