|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH] xen/arm: vpl011: record the virq only once it is reserved
On 18-Nov-26 00:51, Stefano Stabellini wrote:
> On Mon, 16 Nov 2026, Orzel, Michal wrote:
>> On 14-Nov-26 03:00, Stefano Stabellini wrote:
>>> domain_vpl011_init() sets vpl011->virq before vgic_reserve_virq() claims
>>> it, and both a refused reservation and a failed
>>> alloc_unbound_xen_event_channel() take the out1 error path into
>>> domain_vpl011_deinit(), which frees vpl011->virq. That clears the
>>> allocation bit of an interrupt the vPL011 never reserved, so an
>>> interrupt held by another user can be handed out a second time.
>> Who is the other user here? The virq is either GUEST_VPL011_SPI or the
>> Xen UART IRQ. libxl rejects a passthrough IRQ that matches the vpl011
>> SPI, dom0less reserves the vpl011 virq before passthrough and panics
>> on failure, and the Xen UART cannot be assigned. AFAICT there is no issue as
>> of
>> today and this should be explained in the commit msg.
>
> Yes, I can explain this in the commit message.
>
> Just one note though: Xen itself doesn't enforce it.
> XEN_DOMCTL_bind_pt_irq accepts GUEST_VPL011_SPI. A toolstack that binds
> a passthrough IRQ there before XEN_DOMCTL_vuart_op would see the vpl011
> error path free that passthrough virq. I'll explain this in the commit
> message.
>
>
>>> Record the virq only after the reservation succeeds.
>>>
>>> Fixes: 08bbc1c02d38 ("xen/arm: vpl011: Fix domain_vpl011_init error path")
>> The SHA is wrong - unknown revision. That said, I think this should be
>> 1ee1e4b0d1ff instead.
>
> Thanks! I can use that
>
> ---
>
> xen/arm: vpl011: record the virq only once it is reserved
>
> domain_vpl011_init() sets vpl011->virq before reserving it. If the
> reservation or the event channel allocation fails, the error path frees
> vpl011->virq, which the vPL011 never reserved.
>
> libxl and dom0less never hit this with a virq held by someone else, but
> Xen does not enforce it: XEN_DOMCTL_bind_pt_irq accepts
> GUEST_VPL011_SPI, so a passthrough IRQ bound there before
> XEN_DOMCTL_vuart_op would lose its reservation.
>
> Record the virq only after the reservation succeeds.
>
> Fixes: 1ee1e4b0d1ff ("xen/arm: Allow vpl011 to be used by DomU")
> Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxx>
Reviewed-by: Michal Orzel <michal.orzel@xxxxxxx>
~Michal
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |