Re: [Xen-devel] [RFC v3 2/2] x86/xen: allow privcmd hypercalls to be preempted
From: Andrew Cooper
Date: Thu Jan 22 2015 - 17:29:33 EST
On 22/01/2015 20:58, Andy Lutomirski wrote:
> On Thu, Jan 22, 2015 at 12:37 PM, Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
>> On Thu, 22 Jan 2015 12:24:47 -0800
>> Andy Lutomirski <luto@xxxxxxxxxxxxxx> wrote:
>>
>>>> Also, please remove the "notrace", because function tracing goes an
>>>> extra step to not require RCU being visible. The only thing you get
>>>> with notrace is not being able to trace an otherwise traceable function.
>>>>
>>> Is this also true for kprobes? And can kprobes nest inside function
>>> tracing hooks?
>> No, kprobes are a bit more fragile than function tracing or tracepoints.
>>
>> And nothing should nest inside a function hook (except for interrupts,
>> they are fine).
>>
> But kprobes do nest inside interrupts, right?
>
>>> The other issue, above and beyond RCU, is that we can't let kprobes
>>> run on the int3 stack. If Xen upcalls can happen when interrupts are
>>> off, then we may need this protection to prevent that type of
>>> recursion. (This will be much less scary in 3.20, because userspace
>>> int3 instructions will no longer execute on the int3 stack.)
>> Does this execute between the start of the int3 interrupt handler and
>> the call of do_int3()?
> I doubt it.
>
> The thing I worry about is that, if do_int3 nests inside itself by any
> means (e.g. int3 sends a signal, scheduling for whatever reason
> (really shouldn't happen, but I haven't looked that hard)), then we're
> completely hosed -- the inner int3 will overwrite the outer int3's
> stack frame. Since I have no idea what Xen upcalls do, I don't know
> whether they can fire inside do_int3.
The upcall is the "you have a virtual interrupt pending" signal and
should behave exactly like an external interrupt. The exception frame
will appear to have interrupted the correct vcpu context, despite actual
trip via Xen.
Exceptions are handled as per native, with the xen_write_idt_entry()
PVOP taking care of registering the entry point with Xen, rather than
filling in a real IDT entry.
~Andrew
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/