diff mbox series

x86emul: don't read mask register on AVX512F-incapable platforms

Message ID 5C9CFE7102000078002229A1@prv1-mh.provo.novell.com (mailing list archive)
State Superseded
Headers show
Series x86emul: don't read mask register on AVX512F-incapable platforms | expand

Commit Message

Jan Beulich March 28, 2019, 5:03 p.m. UTC
Reported-by: George Dunlap <george.dunlap@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
This is surely a stable tree candidate, unless it could still make it
into 4.12 before the release.

Comments

George Dunlap March 28, 2019, 5:44 p.m. UTC | #1
On 3/28/19 5:03 PM, Jan Beulich wrote:
> Reported-by: George Dunlap <george.dunlap@citrix.com>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

That seems to fix all the ones related to the crashes I was seeing:

Tested-by: George Dunlap <george.dunlap@citrix.com>

> ---
> This is surely a stable tree candidate, unless it could still make it
> into 4.12 before the release.
> 
> --- a/xen/arch/x86/x86_emulate/x86_emulate.c
> +++ b/xen/arch/x86/x86_emulate/x86_emulate.c
> @@ -3511,7 +3511,7 @@ x86_emulate(
>      }
>  
>      /* With a memory operand, fetch the mask register in use (if any). */
> -    if ( ea.type == OP_MEM && evex.opmsk )
> +    if ( ea.type == OP_MEM && cpu_has_avx512f && evex.opmsk )
>      {
>          uint8_t *stb = get_stub(stub);
>  
> 
>
Andrew Cooper March 28, 2019, 6:03 p.m. UTC | #2
On 28/03/2019 17:44, George Dunlap wrote:
> On 3/28/19 5:03 PM, Jan Beulich wrote:
>> Reported-by: George Dunlap <george.dunlap@citrix.com>
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> That seems to fix all the ones related to the crashes I was seeing:
>
> Tested-by: George Dunlap <george.dunlap@citrix.com>
>
>> ---
>> This is surely a stable tree candidate, unless it could still make it
>> into 4.12 before the release.
>>
>> --- a/xen/arch/x86/x86_emulate/x86_emulate.c
>> +++ b/xen/arch/x86/x86_emulate/x86_emulate.c
>> @@ -3511,7 +3511,7 @@ x86_emulate(
>>      }
>>  
>>      /* With a memory operand, fetch the mask register in use (if any). */
>> -    if ( ea.type == OP_MEM && evex.opmsk )
>> +    if ( ea.type == OP_MEM && cpu_has_avx512f && evex.opmsk )

So, this certainly will fix the crash as reported, you need an %xcr0
check, to prevent other ways of this stub faulting.

~Andrew
Jan Beulich March 29, 2019, 6:59 a.m. UTC | #3
>>> On 28.03.19 at 19:03, <andrew.cooper3@citrix.com> wrote:
> On 28/03/2019 17:44, George Dunlap wrote:
>> On 3/28/19 5:03 PM, Jan Beulich wrote:
>>> Reported-by: George Dunlap <george.dunlap@citrix.com>
>>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>> That seems to fix all the ones related to the crashes I was seeing:
>>
>> Tested-by: George Dunlap <george.dunlap@citrix.com>
>>
>>> ---
>>> This is surely a stable tree candidate, unless it could still make it
>>> into 4.12 before the release.
>>>
>>> --- a/xen/arch/x86/x86_emulate/x86_emulate.c
>>> +++ b/xen/arch/x86/x86_emulate/x86_emulate.c
>>> @@ -3511,7 +3511,7 @@ x86_emulate(
>>>      }
>>>  
>>>      /* With a memory operand, fetch the mask register in use (if any). */
>>> -    if ( ea.type == OP_MEM && evex.opmsk )
>>> +    if ( ea.type == OP_MEM && cpu_has_avx512f && evex.opmsk )
> 
> So, this certainly will fix the crash as reported, you need an %xcr0
> check, to prevent other ways of this stub faulting.

Oh, of course. Let me see how to best fit this in.

Jan
diff mbox series

Patch

--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -3511,7 +3511,7 @@  x86_emulate(
     }
 
     /* With a memory operand, fetch the mask register in use (if any). */
-    if ( ea.type == OP_MEM && evex.opmsk )
+    if ( ea.type == OP_MEM && cpu_has_avx512f && evex.opmsk )
     {
         uint8_t *stb = get_stub(stub);