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

Re: [Xen-devel] [PATCH v3 01/18] x86emul: catch exceptions occurring in stubs



>>> On 15.02.17 at 12:27, <andrew.cooper3@xxxxxxxxxx> wrote:
> On 15/02/17 11:06, Jan Beulich wrote:
>> --- a/xen/arch/x86/x86_emulate/x86_emulate.c
>> +++ b/xen/arch/x86/x86_emulate/x86_emulate.c
>> @@ -604,14 +604,42 @@ do{ asm volatile (
>>  #define __emulate_1op_8byte(_op, _dst, _eflags)
>>  #endif /* __i386__ */
>>  
>> +#ifdef __XEN__
>> +# define invoke_stub(pre, post, constraints...) do {                    \
>> +    union stub_exception_token res_ = { .raw = ~0 };                    \
>> +    asm volatile ( pre "\n\tcall *%[stub]\n\t" post "\n"                \
>> +                   ".Lret%=:\n\t"                                       \
>> +                   ".pushsection .fixup,\"ax\"\n"                       \
>> +                   ".Lfix%=:\n\t"                                       \
>> +                   "pop %[exn]\n\t"                                     \
>> +                   "jmp .Lret%=\n\t"                                    \
>> +                   ".popsection\n\t"                                    \
>> +                   _ASM_EXTABLE(.Lret%=, .Lfix%=)                       \
>> +                   : [exn] "+g" (res_), constraints,                    \
>> +                     [stub] "rm" (stub.func) );                         \
>> +    if ( unlikely(~res_.raw) )                                          \
>> +    {                                                                   \
>> +        gprintk(XENLOG_WARNING,                                         \
>> +                "exception %u (ec=%04x) in emulation stub (line %u)\n", \
>> +                res_.fields.trapnr, res_.fields.ec, __LINE__);          \
> 
> Can we also hexdump the stub here?

I did consider this, but didn't want to go through the hassle. But
now that you ask for it, I do recall that we meanwhile have %ph.

>> +        if ( res_.fields.trapnr != EXC_UD )                             \
>> +            domain_crash(current->domain);                              \
> 
> goto done?

Perhaps a good idea (together with setting rc), even if not
strictly necessary.

> Otherwise, Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>

Thanks, Jan


_______________________________________________
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®.