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


Groups > linux.kernel > #1493694 > unrolled thread

[PATCH v2 1/2] x86/boot: Fix another __read_cr4() case on 486

Started byAndy Lutomirski <luto@kernel.org>
First post2016-09-29 21:50 +0200
Last post2016-09-30 12:50 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v2 1/2] x86/boot: Fix another __read_cr4() case on 486 Andy Lutomirski <luto@kernel.org> - 2016-09-29 21:50 +0200
    Re: [PATCH v2 1/2] x86/boot: Fix another __read_cr4() case on 486 Borislav Petkov <bp@alien8.de> - 2016-09-30 00:40 +0200
    [tip:x86/urgent] x86/boot: Fix another __read_cr4() case on 486 tip-bot for Andy Lutomirski <tipbot@zytor.com> - 2016-09-30 12:50 +0200

#1493694 — [PATCH v2 1/2] x86/boot: Fix another __read_cr4() case on 486

FromAndy Lutomirski <luto@kernel.org>
Date2016-09-29 21:50 +0200
Subject[PATCH v2 1/2] x86/boot: Fix another __read_cr4() case on 486
Message-ID<smPvb-8lN-3@gated-at.bofh.it>
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 | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 0fa60f5f5a16..98c9cd6f3b5d 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -1137,9 +1137,7 @@ 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();
+	mmu_cr4_features = __read_cr4_safe();
 
 	memblock_set_current_limit(get_max_mapped());
 
-- 
2.7.4

[toc] | [next] | [standalone]


#1493762

FromBorislav Petkov <bp@alien8.de>
Date2016-09-30 00:40 +0200
Message-ID<smS9H-1Ph-9@gated-at.bofh.it>
In reply to#1493694
On Thu, Sep 29, 2016 at 12:48:11PM -0700, Andy Lutomirski wrote:
> 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().

Please s/using/use/ while applying.

> 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 | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
> index 0fa60f5f5a16..98c9cd6f3b5d 100644
> --- a/arch/x86/kernel/setup.c
> +++ b/arch/x86/kernel/setup.c
> @@ -1137,9 +1137,7 @@ 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();
> +	mmu_cr4_features = __read_cr4_safe();
>  
>  	memblock_set_current_limit(get_max_mapped());
>  
> -- 

Reviewed-by: Borislav Petkov <bp@suse.de>

-- 
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.
--

[toc] | [prev] | [next] | [standalone]


#1494025 — [tip:x86/urgent] x86/boot: Fix another __read_cr4() case on 486

Fromtip-bot for Andy Lutomirski <tipbot@zytor.com>
Date2016-09-30 12:50 +0200
Subject[tip:x86/urgent] x86/boot: Fix another __read_cr4() case on 486
Message-ID<sn3ya-FI-13@gated-at.bofh.it>
In reply to#1493694
Commit-ID:  192d1dccbfc5b901b66527df9df80304693cf06e
Gitweb:     http://git.kernel.org/tip/192d1dccbfc5b901b66527df9df80304693cf06e
Author:     Andy Lutomirski <luto@kernel.org>
AuthorDate: Thu, 29 Sep 2016 12:48:11 -0700
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Fri, 30 Sep 2016 12:37:40 +0200

x86/boot: Fix another __read_cr4() case on 486

The condition for reading CR4 was wrong: there are some CPUs with
CPUID but not CR4.  Rather than trying to make the condition exact,
use __read_cr4_safe().

Fixes: 18bc7bd523e0 ("x86/boot: Synchronize trampoline_cr4_features and mmu_cr4_features directly")
Reported-by: david@saggiorato.net
Signed-off-by: Andy Lutomirski <luto@kernel.org>
Reviewed-by: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Link: http://lkml.kernel.org/r/8c453a61c4f44ab6ff43c29780ba04835234d2e5.1475178369.git.luto@kernel.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

---
 arch/x86/kernel/setup.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 0fa60f5..98c9cd6 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -1137,9 +1137,7 @@ 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();
+	mmu_cr4_features = __read_cr4_safe();
 
 	memblock_set_current_limit(get_max_mapped());
 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web