[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


  • To: Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • From: "Orzel, Michal" <michal.orzel@xxxxxxx>
  • Date: Wed, 18 Nov 2026 08:04:09 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=LM/d2KI04D//Hw2OGcOA2hdE66KZtkmznCAl7jnfOZI=; b=r/MFk22tVFjwMXS3BGZP/6rldcLSkNTcN/srVvjq57BD80AHYbETIyJgQ7ISUOyiAgpYw2j230Z1x9brSBG50FV6RKH1VJNbv5K+SoJxlh+VbQVrbg2beBrN8OZFJn15LDtic3xhPtLXoNMbwg7eJLF6PfIs4EnxAs1MDJqTGi3G8UcJK0CO1l87K/HwilhgoQZqWjW9j3TMG05pLkPyJ0jeMtp7f0F68xQvRuVsxOh/p7+p4TF8Je07O+xOcOemjB4+HIdzyeJx+y/kFDZDFSsr4CTXzdOSmqeTPogjNNFohLUQmClqyXUVKqMk/jLzxCY72m+f1/5cQKnWzU9bGw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=uxW30yywQkuGRPGtbLipC8kotMnq049ciYQkU/zIZEBf0zokfRsEhjNX0RFdrAA1HkR7lc4/dA3X6cGmkOpsdHJsCmCJCNGH2YED5R/By/4kkuNffx0kKHn3YDKHN91NpTIN8dokIdfna11IOIEG2X3MY9QjYDInywOz10xe1u42Lkrj84KAUARt+OpoNq4HnYEu9g696bVZbQmz8Zq0AZcZ5xN2QqMMcC+L7PiYpjA4laygBCwt0cEmk+W7K+dX9NhBdLiN79rLWtTIqv1xbClPfxK9j3W2vaTzuk3+66fg5mMDj50k1/Si8UQsP3qY7O7Wrxc3M6MO2od0ibs5KQ==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=amd.com header.i="@amd.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Cc: Stefano Stabellini <stefano.stabellini@xxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, "Bertrand Marquis" <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Wed, 18 Nov 2026 07:04:26 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>


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




 


Rackspace

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