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:	Fri, 02 Oct 2015 13:26:32 +0200
From:	Vitaly Kuznetsov <vkuznets@...hat.com>
To:	Paolo Bonzini <pbonzini@...hat.com>
Cc:	linux-kernel@...r.kernel.org, devel@...uxdriverproject.org,
	haiyangz@...rosoft.com, alex.williamson@...hat.com, x86@...nel.org,
	"K. Y. Srinivasan" <kys@...rosoft.com>
Subject: Re: [PATCH] x86: guest: rely on leaf 0x40000001 to detect Hyper-V

Paolo Bonzini <pbonzini@...hat.com> writes:

> The specification says that "Microsoft Hv" is actually a vendor ID field
> that is only used for reporting and diagnostic purposes.  The actual
> field that you need to check is the interface ID that you get in eax
> when querying the HYPERV_CPUID_INTERFACE.
>
> Change ms_hyperv_platform to actually do what the specification suggests.
> This roughy matches what Windows looks for, though Windows actually
> ignores HYPERV_CPUID_VENDOR_AND_MAX_FUNCTIONS completely.
>
> Signed-off-by: Paolo Bonzini <pbonzini@...hat.com>

Reviewed-by: Vitaly Kuznetsov <vkuznets@...hat.com>

(and it seems K. Y. is missing on the CC: list, fixed).

> ---
>  arch/x86/kernel/cpu/mshyperv.c | 14 ++++++--------
>  1 file changed, 6 insertions(+), 8 deletions(-)
>
> diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c
> index 381c8b9b3a33..7910e7fd705b 100644
> --- a/arch/x86/kernel/cpu/mshyperv.c
> +++ b/arch/x86/kernel/cpu/mshyperv.c
> @@ -116,18 +116,16 @@ static void hv_machine_crash_shutdown(struct pt_regs *regs)
>  static uint32_t  __init ms_hyperv_platform(void)
>  {
>  	u32 eax;
> -	u32 hyp_signature[3];
>
>  	if (!boot_cpu_has(X86_FEATURE_HYPERVISOR))
>  		return 0;
>
> -	cpuid(HYPERV_CPUID_VENDOR_AND_MAX_FUNCTIONS,
> -	      &eax, &hyp_signature[0], &hyp_signature[1], &hyp_signature[2]);
> -
> -	if (eax >= HYPERV_CPUID_MIN &&
> -	    eax <= HYPERV_CPUID_MAX &&
> -	    !memcmp("Microsoft Hv", hyp_signature, 12))
> -		return HYPERV_CPUID_VENDOR_AND_MAX_FUNCTIONS;
> +	eax = cpuid_eax(HYPERV_CPUID_VENDOR_AND_MAX_FUNCTIONS);
> +	if (eax >= HYPERV_CPUID_MIN && eax <= HYPERV_CPUID_MAX) {
> +		eax = cpuid_eax(HYPERV_CPUID_INTERFACE);
> +		if (!memcmp(&eax, "Hv#1", sizeof(eax)))
> +			return HYPERV_CPUID_VENDOR_AND_MAX_FUNCTIONS;
> +	}
>
>  	return 0;
>  }

-- 
  Vitaly
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ