[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v1 20/21] hw/i386/kvm/xen_evtchn: Hold port_lock for whole of bind_pirq_op
- To: David Woodhouse <dwmw2@xxxxxxxxxxxxx>, qemu-devel@xxxxxxxxxx
- From: Paul Durrant <xadimgnik@xxxxxxxxx>
- Date: Wed, 25 Nov 2026 11:35:32 +0000
- Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=20260707 header.d=gmail.com header.i="@gmail.com" header.h="Content-Transfer-Encoding:Content-Type:In-Reply-To:Content-Language:References:Cc:To:Subject:User-Agent:MIME-Version:Date:Message-ID:From"
- Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx, kvm@xxxxxxxxxxxxxxx, Paolo Bonzini <pbonzini@xxxxxxxxxx>, Peter Maydell <peter.maydell@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Anthony PERARD <anthony@xxxxxxxxxxxxxx>, "Edgar E . Iglesias" <edgar.iglesias@xxxxxxxxx>, "Michael S . Tsirkin" <mst@xxxxxxxxxx>, Richard Henderson <richard.henderson@xxxxxxxxxx>, Marcelo Tosatti <mtosatti@xxxxxxxxxx>, Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>, Jason Wang <jasowangio@xxxxxxxxx>, Hui Peng <benquike@xxxxxxxxx>, Mark Syms <mark.syms@xxxxxxxxxx>, Feifan Qian <bea1e@xxxxxxxxx>, David Woodhouse <dwmw@xxxxxxxxxxxx>
- Delivery-date: Wed, 25 Nov 2026 11:44:41 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 24/11/2026 16:22, David Woodhouse wrote:
From: David Woodhouse <dwmw@xxxxxxxxxxxx>
The check for an existing binding read s->pirq[].port before taking
port_lock, and the allocation wrote it after. The BQL serialises the
writers in practice, but holding port_lock across the check and the
allocation is clearly correct and lets Coverity see it too.
The region now under the lock is pure port_table/pirq bookkeeping.
The MSI unmask and kvm_update_msi_routes_all() calls must remain
outside port_lock: they can re-enter via the MSI translate function,
which takes port_lock itself. The PIRQ→evtchn→GSI delivery paths have
further BQL/port_lock ordering constraints — see the comments in
xen_evtchn_set_callback_level() and xen_evtchn_set_gsi().
Resolves: Coverity CID 1527403
Fixes: 6096cf7877bc ("hw/xen: Support MSI mapping to PIRQ")
Reported-by: Peter Maydell <peter.maydell@xxxxxxxxxx>
Signed-off-by: David Woodhouse <dwmw@xxxxxxxxxxxx>
---
hw/i386/kvm/xen_evtchn.c | 25 +++++++++++--------------
1 file changed, 11 insertions(+), 14 deletions(-)
Reviewed-by: Paul Durrant <paul@xxxxxxx>
|