lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  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, 21 Apr 2017 16:38:42 +0200
From:   Juergen Gross <jgross@...e.com>
To:     Boris Ostrovsky <boris.ostrovsky@...cle.com>,
        linux-kernel@...r.kernel.org, xen-devel@...ts.xenproject.org,
        Andrew Cooper <andrew.cooper3@...rix.com>
Subject: Re: [PATCH v3 09/11] x86/xen: use capabilities instead of fake cpuid
 values for xsave

On 21/04/17 16:24, Boris Ostrovsky wrote:
> 
>> +static bool __init xen_check_xsave(void)
>>  {
>> -	unsigned int ax, bx, cx, dx;
>> -	unsigned int xsave_mask;
>> +	unsigned int err, eax, edx;
>>  
>> -	ax = 1;
>> -	cx = 0;
>> -	cpuid(1, &ax, &bx, &cx, &dx);
>> +	/* Test OSXSAVE capability via xgetbv instruction. */
>> +	asm volatile("1: .byte 0x0f,0x01,0xd0\n\t" /* xgetbv */
>> +		     "xor %[err], %[err]\n"
>> +		     "2:\n\t"
>> +		     ".pushsection .fixup,\"ax\"\n\t"
>> +		     "3: movl $1,%[err]\n\t"
>> +		     "jmp 2b\n\t"
>> +		     ".popsection\n\t"
>> +		     _ASM_EXTABLE(1b, 3b)
>> +		     : [err] "=r" (err), "=a" (eax), "=d" (edx)
>> +		     : "c" (0));
> 
> Have you tested this on processors where we actually trap on xgetbv?
> 
> I have an AMD box without XSAVE support and this is a fatal error. I
> suspect it's too early to use exception fixup framework here.

Uuh, too bad.

Then I fear we must use the other solution Andrew didn't like. :-(
Andrew, would you be okay with that?


Juergen

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux - Powered by OpenVZ