[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v2 for-4.9 2/2] x86/emul: Reorder the user segments in x86_segment to match SReg3 encoding



On 26/10/16 10:40, Andrew Cooper wrote:
> On 26/10/16 09:57, Jan Beulich wrote:
>>>>> On 25.10.16 at 20:10, <andrew.cooper3@xxxxxxxxxx> wrote:
>>> @@ -2994,8 +2978,8 @@ x86_emulate(
>>>          break;
>>>  
>>>      case 0x8e: /* mov r/m,Sreg */
>>> -        seg = decode_segment(modrm_reg);
>>> -        generate_exception_if(seg == decode_segment_failed, EXC_UD, -1);
>>> +        seg = modrm_reg & 7; /* REX.R is ignored. */
>>> +        generate_exception_if(!is_x86_user_segment(seg), EXC_UD, -1);
>>>          generate_exception_if(seg == x86_seg_cs, EXC_UD, -1);
>> Can I talk you into folding these two generate_exception_if()s, as
>> they logically belong together?
> Ok.
>
>>> @@ -5438,6 +5422,17 @@ x86_emulate(
>>>  #undef override_seg
>>>  #undef ea
>>>  
>>> +static void __init __maybe_unused build_assertions(void)
>>> +{
>>> +    /* Check the values against SReg3 encoding in opcode/ModRM bytes. */
>>> +    BUILD_BUG_ON(x86_seg_es != 0);
>>> +    BUILD_BUG_ON(x86_seg_cs != 1);
>>> +    BUILD_BUG_ON(x86_seg_ss != 2);
>>> +    BUILD_BUG_ON(x86_seg_ds != 3);
>>> +    BUILD_BUG_ON(x86_seg_fs != 4);
>>> +    BUILD_BUG_ON(x86_seg_gs != 5);
>>> +}
>> So using an inline function in the header did not work out?
> No - that would involve making BUILD_BUG_ON() available to x86_emulate.h
>
> In this position, it does also affect the test harness build, as it is
> outside an #ifdef __XEN__ block.
>
>> In any event,
>> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
> Thanks

Wei: Turns out that I typo'd the subject, and I meant "for 4.8" here, as
this is a bugfix in the emulator.  Please can I get a view towards a
release ack?

~Andrew

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.