Article View: muc.lists.freebsd.bugs
Article #535[Bug 300891] xen/xen_intr: xen_intr_get_evtchn_from_port() takes a reference on an interrupt source whose refcount is already 0
From: bugzilla-noreply
Date: Thu, 19 Nov 2026 05:52
Date: Thu, 19 Nov 2026 05:52
54 lines
3815 bytes
3815 bytes
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=300891
Bug ID: 300891
Summary: xen/xen_intr: xen_intr_get_evtchn_from_port() takes a
reference on an interrupt source whose refcount is
already 0
Product: Base System
Version: 15.1-RELEASE
Hardware: amd64
OS: Any
Status: New
Severity: Affects Some People
Priority: ---
Component: kern
Assignee: bugs@FreeBSD.org
Reporter: sablomenkamp@gmail.com
Environment: FreeBSD 15.1-RELEASE amd64 as a PVH domU on Xen 4.20.5-pre (Debian
13 dom0), and as an HVM domU on Qubes OS 4.3 (Xen 4.19). Found while running
Xen's libxenvchan and the Qubes OS qrexec agent. Still present in main 5151bc2
(line numbers below are from that commit).
xen_intr_unbind() drops the last reference and releases xen_intr_isrc_lock, and
only then calls xen_intr_release_isrc(). In that window,
xen_intr_get_evtchn_from_port() still finds the source in
xen_intr_port_to_isrc[] and does refcount_acquire() from 0
(sys/dev/xen/bus/xen_intr.c, line 1078). The caller then holds a handle to a
source that is torn down under it.
How it showed: panic 'interrupt handler "evtchn0" not found', with the change
described in the gntdev use-after-free report in place, which makes this path
frequent.
Suggested fix: refcount_acquire_if_not_zero(), returning EINVAL when the count
was already 0. A tested patch against main is available if wanted.
Disclosure: found and analysed with an AI assistant (Claude). The reproduction,
the test runs and the results are from my own machines.
--
You are receiving this mail because:
You are the assignee for the bug.
--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
Technical Details
Message-ID:
<bug-300891-227@https.bugs.freebsd.org/bugzilla/>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!2.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.karotte.org!news.muc.de!.POSTED.news.muc.de!not-for-mailShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!2.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.karotte.org!news.muc.de!.POSTED.news.muc.de!not-for-mail From: bugzilla-noreply@freebsd.org Newsgroups: muc.lists.freebsd.bugs Subject: [Bug 300891] xen/xen_intr: xen_intr_get_evtchn_from_port() takes a reference on an interrupt source whose refcount is already 0 Date: Thu, 19 Nov 2026 05:52:06 +0000 Organization: Newsgate at muc.de e.V. Approved: news-admin@muc.de Distribution: world Message-ID: <bug-300891-227@https.bugs.freebsd.org/bugzilla/> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: news.muc.de; posting-host="news.muc.de:193.149.48.2"; logging-data="9116"; mail-complaints-to="news-admin@muc.de" X-Original-To: bugs@mlmmj.nyi.freebsd.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1795067526; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=zdxV1d9RScgeBym+bFcSbls3pjXCanuPNDHjQuT3QH8=; b=oDsNkQ1wdy3Boi3xJs2CJEM26cjXSrf0pFdASwHfegCrxQNqtArTgA7J5UpJ2vR7KJchyJ b82ySFxs94oeaVz4cyLBBlMmnwI5yM65n7jlriqmG8tvoM/KYoN2ysFiqbqIxrXdXntd/B QRb9pyP2SE4NgelKXnqMEuFUwOIEIr1WyH56hx2AR4BS8UpuyI49zFIOTN57W26VViY7TR BkYLAoCqHNBGEqiVo4JpHxAa8gQp+BqjfxDLm3mlMpxnsw4T+6/xombJrztBrtlOriwOQH AUwrMUcYOUtAcRSlZW5ra2boJBx63cu50TNa5ZaQJDdDobFcut/67pAGYpHSCA== X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f Auto-Submitted: auto-generated Precedence: list X-Newsgate-Id: f02c70b8849f+ X-No-Archive: Yes