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

Re: [Xen-devel] [PATCH v6.5 11/26] x86: Support indirect thunks from assembly code



On 11/01/18 13:03, David Woodhouse wrote:
> On Thu, 2018-01-04 at 00:15 +0000, Andrew Cooper wrote:
>> +         * We've got no usable stack so can't use a RETPOLINE thunk, and are
>> +         * further than +- 2G from the high mappings so couldn't use 
>> JUMP_THUNK
>> +         * even if was a non-RETPOLINE thunk.  Futhermore, an LFENCE isn't
>> +         * necesserily safe to use at this point.
> I count three typos, pedantry about ± and GiB aside.
> Late night? :)

Just one of many...

I've found furthermore and necessarily.  Where is the 3rd?

>
>> --- a/xen/arch/x86/extable.c
>> +++ b/xen/arch/x86/extable.c
>> @@ -158,7 +158,7 @@ static int __init stub_selftest(void)
>>          memcpy(ptr, tests[i].opc, ARRAY_SIZE(tests[i].opc));
>>          unmap_domain_page(ptr);
>>  
>> -        asm volatile ( "call *%[stb]\n"
>> +        asm volatile ( "CALL_THUNK %[stb]\n"
> If you make that %V[stb] then...
>
>> +    .if CONFIG_INDIRECT_THUNK == 1
>> +
>> +        $done = 0
>> +        .irp reg, rax, rbx, rcx, rdx, rsi, rdi, rbp, r8, r9, r10, r11, r12, 
>> r13, r14, r15
>> +        .ifeqs "\arg", "%\reg"
>> +            \insn __x86.indirect_thunk.\reg
>> +            $done = 1
>> +           .exitm
>> +        .endif
>> +        .endr
>> +        .if $done != 1
>> +        .error "Bad register arg \arg"
>> +        .endif
>> +
> ... you don't need this.

That's fine in principle, except it isn't compatible with most of the
compilers we support.  To use, the %V has to be hidden behind a
conditional macro, and I can't think of any remotely-clean way to do that.

~Andrew

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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