lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 1 Nov 2017 13:55:28 -0700
From:   tip-bot for Ricardo Neri <tipbot@...or.com>
To:     linux-tip-commits@...r.kernel.org
Cc:     paul.gortmaker@...driver.com, ravi.v.shankar@...el.com,
        peterz@...radead.org, torvalds@...ux-foundation.org,
        mingo@...nel.org, hpa@...or.com, akpm@...ux-foundation.org,
        mhiramat@...nel.org, tglx@...utronix.de, bp@...e.de,
        dvlasenk@...hat.com, luto@...nel.org, cmetcalf@...lanox.com,
        brgerst@...il.com, ray.huang@....com, corbet@....net,
        luto@...capital.net, jpoimboe@...hat.com, jslaby@...e.cz,
        mst@...hat.com, slaoub@...il.com, pbonzini@...hat.com,
        bp@...en8.de, dave.hansen@...ux.intel.com, shuah@...nel.org,
        vbabka@...e.cz, dave.hansen@...el.com,
        ricardo.neri-calderon@...ux.intel.com, linux-kernel@...r.kernel.org
Subject: [tip:x86/mpx] x86/boot: Relocate definition of the initial state of
 CR0

Commit-ID:  b0ce5b8c95c83a7b98c679b117e3d6ae6f97154b
Gitweb:     https://git.kernel.org/tip/b0ce5b8c95c83a7b98c679b117e3d6ae6f97154b
Author:     Ricardo Neri <ricardo.neri-calderon@...ux.intel.com>
AuthorDate: Fri, 27 Oct 2017 13:25:29 -0700
Committer:  Thomas Gleixner <tglx@...utronix.de>
CommitDate: Wed, 1 Nov 2017 21:50:07 +0100

x86/boot: Relocate definition of the initial state of CR0

Both head_32.S and head_64.S utilize the same value to initialize the
control register CR0. Also, other parts of the kernel might want to access
this initial definition (e.g., emulation code for User-Mode Instruction
Prevention uses this state to provide a sane dummy value for CR0 when
emulating the smsw instruction). Thus, relocate this definition to a
header file from which it can be conveniently accessed.

Suggested-by: Borislav Petkov <bp@...en8.de>
Signed-off-by: Ricardo Neri <ricardo.neri-calderon@...ux.intel.com>
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Reviewed-by: Borislav Petkov <bp@...e.de>
Reviewed-by: Andy Lutomirski <luto@...nel.org>
Cc: "Michael S. Tsirkin" <mst@...hat.com>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Dave Hansen <dave.hansen@...ux.intel.com>
Cc: ricardo.neri@...el.com
Cc: linux-mm@...ck.org
Cc: Paul Gortmaker <paul.gortmaker@...driver.com>
Cc: Huang Rui <ray.huang@....com>
Cc: Shuah Khan <shuah@...nel.org>
Cc: linux-arch@...r.kernel.org
Cc: Jonathan Corbet <corbet@....net>
Cc: Jiri Slaby <jslaby@...e.cz>
Cc: "Ravi V. Shankar" <ravi.v.shankar@...el.com>
Cc: Denys Vlasenko <dvlasenk@...hat.com>
Cc: Chris Metcalf <cmetcalf@...lanox.com>
Cc: Brian Gerst <brgerst@...il.com>
Cc: Josh Poimboeuf <jpoimboe@...hat.com>
Cc: Chen Yucong <slaoub@...il.com>
Cc: Vlastimil Babka <vbabka@...e.cz>
Cc: Dave Hansen <dave.hansen@...el.com>
Cc: Andy Lutomirski <luto@...capital.net>
Cc: Masami Hiramatsu <mhiramat@...nel.org>
Cc: Paolo Bonzini <pbonzini@...hat.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Link: https://lkml.kernel.org/r/1509135945-13762-3-git-send-email-ricardo.neri-calderon@linux.intel.com

---
 arch/x86/include/uapi/asm/processor-flags.h | 3 +++
 arch/x86/kernel/head_32.S                   | 3 ---
 arch/x86/kernel/head_64.S                   | 3 ---
 3 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/arch/x86/include/uapi/asm/processor-flags.h b/arch/x86/include/uapi/asm/processor-flags.h
index 185f3d1..39946d0 100644
--- a/arch/x86/include/uapi/asm/processor-flags.h
+++ b/arch/x86/include/uapi/asm/processor-flags.h
@@ -151,5 +151,8 @@
 #define CX86_ARR_BASE	0xc4
 #define CX86_RCR_BASE	0xdc
 
+#define CR0_STATE	(X86_CR0_PE | X86_CR0_MP | X86_CR0_ET | \
+			 X86_CR0_NE | X86_CR0_WP | X86_CR0_AM | \
+			 X86_CR0_PG)
 
 #endif /* _UAPI_ASM_X86_PROCESSOR_FLAGS_H */
diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S
index 9ed3074..c3cfc65 100644
--- a/arch/x86/kernel/head_32.S
+++ b/arch/x86/kernel/head_32.S
@@ -211,9 +211,6 @@ ENTRY(startup_32_smp)
 #endif
 
 .Ldefault_entry:
-#define CR0_STATE	(X86_CR0_PE | X86_CR0_MP | X86_CR0_ET | \
-			 X86_CR0_NE | X86_CR0_WP | X86_CR0_AM | \
-			 X86_CR0_PG)
 	movl $(CR0_STATE & ~X86_CR0_PG),%eax
 	movl %eax,%cr0
 
diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S
index 513cbb0..5e1bfdd 100644
--- a/arch/x86/kernel/head_64.S
+++ b/arch/x86/kernel/head_64.S
@@ -149,9 +149,6 @@ ENTRY(secondary_startup_64)
 1:	wrmsr				/* Make changes effective */
 
 	/* Setup cr0 */
-#define CR0_STATE	(X86_CR0_PE | X86_CR0_MP | X86_CR0_ET | \
-			 X86_CR0_NE | X86_CR0_WP | X86_CR0_AM | \
-			 X86_CR0_PG)
 	movl	$CR0_STATE, %eax
 	/* Make changes effective */
 	movq	%rax, %cr0

Powered by blists - more mailing lists