lkml.org 
[lkml]   [2016]   [Sep]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/3] x86/boot: Fix another __read_cr4() case on 486
Date
The condition for reading CR4 was wrong: there are some CPUs with
CPUID but not CR4. Rather than trying to make the condition exact,
using __read_cr4_safe().

Reported-by: david@saggiorato.net
Fixes: 18bc7bd523e0 ("x86/boot: Synchronize trampoline_cr4_features and mmu_cr4_features directly")
Signed-off-by: Andy Lutomirski <luto@kernel.org>
---
arch/x86/kernel/setup.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 0fa60f5f5a16..5930a4d191b4 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -1137,9 +1137,13 @@ void __init setup_arch(char **cmdline_p)
* auditing all the early-boot CR4 manipulation would be needed to
* rule it out.
*/
- if (boot_cpu_data.cpuid_level >= 0)
- /* A CPU has %cr4 if and only if it has CPUID. */
- mmu_cr4_features = __read_cr4();
+ if (boot_cpu_data.cpuid_level >= 0) {
+ /*
+ * CPUs without CPUID don't have CR4. CPUs with CPUID
+ * usually have CR4.
+ */
+ mmu_cr4_features = __read_cr4_safe();
+ }

memblock_set_current_limit(get_max_mapped());

--
2.7.4
\
 
 \ /
  Last update: 2016-09-28 21:35    [W:0.067 / U:1.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site