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
| ||
|
Date: Tue, 20 Jul 2010 20:50:56 +0200 From: Robert Richter <robert.richter@....com> To: "H. Peter Anvin" <hpa@...or.com> CC: Ingo Molnar <mingo@...e.hu>, Suresh Siddha <suresh.b.siddha@...el.com>, LKML <linux-kernel@...r.kernel.org>, Robert Richter <robert.richter@....com> Subject: [PATCH 09/10] x86, xsave: check cpuid level for XSTATE_CPUID (0x0d) The patch adds a check that tests if XSTATE_CPUID exists. Signed-off-by: Robert Richter <robert.richter@....com> --- arch/x86/include/asm/xsave.h | 2 ++ arch/x86/kernel/xsave.c | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletions(-) diff --git a/arch/x86/include/asm/xsave.h b/arch/x86/include/asm/xsave.h index 4d3b5d1..d1b5f3a 100644 --- a/arch/x86/include/asm/xsave.h +++ b/arch/x86/include/asm/xsave.h @@ -4,6 +4,8 @@ #include <linux/types.h> #include <asm/processor.h> +#define XSTATE_CPUID 0x0000000d + #define XSTATE_FP 0x1 #define XSTATE_SSE 0x2 #define XSTATE_YMM 0x4 diff --git a/arch/x86/kernel/xsave.c b/arch/x86/kernel/xsave.c index 2322f58..49540b7 100644 --- a/arch/x86/kernel/xsave.c +++ b/arch/x86/kernel/xsave.c @@ -423,9 +423,15 @@ static void __init setup_xstate_init(void) */ static void __cpuinit xstate_enable_boot_cpu(void) { + struct cpuinfo_x86 *c = &cpu_data(0); unsigned int eax, ebx, ecx, edx; - cpuid_count(0xd, 0, &eax, &ebx, &ecx, &edx); + if (c->cpuid_level < XSTATE_CPUID) { + WARN(1, KERN_ERR "XSTATE_CPUID missing\n"); + return; + } + + cpuid_count(XSTATE_CPUID, 0, &eax, &ebx, &ecx, &edx); pcntxt_mask = eax + ((u64)edx << 32); if ((pcntxt_mask & XSTATE_FPSSE) != XSTATE_FPSSE) { -- 1.7.1.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@...r.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists