]> git.proxmox.com Git - pve-kernel.git/blob - patches/kernel/0084-x86-boot-Relocate-definition-of-the-initial-state-of.patch
revert buggy SCSI error handler commit
[pve-kernel.git] / patches / kernel / 0084-x86-boot-Relocate-definition-of-the-initial-state-of.patch
1 From e0cef0182f7d13edb48119653a4fc225b0287b5a Mon Sep 17 00:00:00 2001
2 From: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
3 Date: Fri, 27 Oct 2017 13:25:29 -0700
4 Subject: [PATCH 084/242] x86/boot: Relocate definition of the initial state of
5 CR0
6 MIME-Version: 1.0
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
9
10 CVE-2017-5754
11
12 Both head_32.S and head_64.S utilize the same value to initialize the
13 control register CR0. Also, other parts of the kernel might want to access
14 this initial definition (e.g., emulation code for User-Mode Instruction
15 Prevention uses this state to provide a sane dummy value for CR0 when
16 emulating the smsw instruction). Thus, relocate this definition to a
17 header file from which it can be conveniently accessed.
18
19 Suggested-by: Borislav Petkov <bp@alien8.de>
20 Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
21 Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
22 Reviewed-by: Borislav Petkov <bp@suse.de>
23 Reviewed-by: Andy Lutomirski <luto@kernel.org>
24 Cc: "Michael S. Tsirkin" <mst@redhat.com>
25 Cc: Peter Zijlstra <peterz@infradead.org>
26 Cc: Dave Hansen <dave.hansen@linux.intel.com>
27 Cc: ricardo.neri@intel.com
28 Cc: linux-mm@kvack.org
29 Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
30 Cc: Huang Rui <ray.huang@amd.com>
31 Cc: Shuah Khan <shuah@kernel.org>
32 Cc: linux-arch@vger.kernel.org
33 Cc: Jonathan Corbet <corbet@lwn.net>
34 Cc: Jiri Slaby <jslaby@suse.cz>
35 Cc: "Ravi V. Shankar" <ravi.v.shankar@intel.com>
36 Cc: Denys Vlasenko <dvlasenk@redhat.com>
37 Cc: Chris Metcalf <cmetcalf@mellanox.com>
38 Cc: Brian Gerst <brgerst@gmail.com>
39 Cc: Josh Poimboeuf <jpoimboe@redhat.com>
40 Cc: Chen Yucong <slaoub@gmail.com>
41 Cc: Vlastimil Babka <vbabka@suse.cz>
42 Cc: Dave Hansen <dave.hansen@intel.com>
43 Cc: Andy Lutomirski <luto@amacapital.net>
44 Cc: Masami Hiramatsu <mhiramat@kernel.org>
45 Cc: Paolo Bonzini <pbonzini@redhat.com>
46 Cc: Andrew Morton <akpm@linux-foundation.org>
47 Cc: Linus Torvalds <torvalds@linux-foundation.org>
48 Link: https://lkml.kernel.org/r/1509135945-13762-3-git-send-email-ricardo.neri-calderon@linux.intel.com
49
50 (cherry picked from commit b0ce5b8c95c83a7b98c679b117e3d6ae6f97154b)
51 Signed-off-by: Andy Whitcroft <apw@canonical.com>
52 Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
53 (cherry picked from commit 27c31a88c22edab269abe17c0ac7db0351d26c5f)
54 Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
55 ---
56 arch/x86/include/uapi/asm/processor-flags.h | 3 +++
57 arch/x86/kernel/head_32.S | 3 ---
58 arch/x86/kernel/head_64.S | 3 ---
59 3 files changed, 3 insertions(+), 6 deletions(-)
60
61 diff --git a/arch/x86/include/uapi/asm/processor-flags.h b/arch/x86/include/uapi/asm/processor-flags.h
62 index 185f3d10c194..39946d0a1d41 100644
63 --- a/arch/x86/include/uapi/asm/processor-flags.h
64 +++ b/arch/x86/include/uapi/asm/processor-flags.h
65 @@ -151,5 +151,8 @@
66 #define CX86_ARR_BASE 0xc4
67 #define CX86_RCR_BASE 0xdc
68
69 +#define CR0_STATE (X86_CR0_PE | X86_CR0_MP | X86_CR0_ET | \
70 + X86_CR0_NE | X86_CR0_WP | X86_CR0_AM | \
71 + X86_CR0_PG)
72
73 #endif /* _UAPI_ASM_X86_PROCESSOR_FLAGS_H */
74 diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S
75 index 337a65377baf..7bbcdb1ea31a 100644
76 --- a/arch/x86/kernel/head_32.S
77 +++ b/arch/x86/kernel/head_32.S
78 @@ -213,9 +213,6 @@ ENTRY(startup_32_smp)
79 #endif
80
81 .Ldefault_entry:
82 -#define CR0_STATE (X86_CR0_PE | X86_CR0_MP | X86_CR0_ET | \
83 - X86_CR0_NE | X86_CR0_WP | X86_CR0_AM | \
84 - X86_CR0_PG)
85 movl $(CR0_STATE & ~X86_CR0_PG),%eax
86 movl %eax,%cr0
87
88 diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S
89 index a2d8541b1da4..4117c1e0b3d2 100644
90 --- a/arch/x86/kernel/head_64.S
91 +++ b/arch/x86/kernel/head_64.S
92 @@ -137,9 +137,6 @@ ENTRY(secondary_startup_64)
93 1: wrmsr /* Make changes effective */
94
95 /* Setup cr0 */
96 -#define CR0_STATE (X86_CR0_PE | X86_CR0_MP | X86_CR0_ET | \
97 - X86_CR0_NE | X86_CR0_WP | X86_CR0_AM | \
98 - X86_CR0_PG)
99 movl $CR0_STATE, %eax
100 /* Make changes effective */
101 movq %rax, %cr0
102 --
103 2.14.2
104