🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: muc.lists.freebsd.bugs
2 messages
2 total messages Started by bugzilla-noreply Mon, 23 Nov 2026 22:09
[Bug 301062] snp(4): snp_dtor() frees the softc without draining snp_outpoll sleepers
#689
Author: bugzilla-noreply
Date: Mon, 23 Nov 2026 22:09
55 lines
4006 bytes
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=301062

            Bug ID: 301062
           Summary: snp(4): snp_dtor() frees the softc without draining
                    snp_outpoll sleepers
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: laamalif@proton.me

snp_dtor() frees struct snp_softc with threads still registered on
ss->snp_outpoll. A thread blocked in poll(2) on the snoop device has
its selfd linked on snp_outpoll.si_tdlist (selrecord() at
sys/dev/snp/snp.c:338); when the last file descriptor is closed,
snp_dtor() runs cv_destroy() and free(ss, M_SNP) without calling
seldrain(). When the blocked thread later returns from poll, its
selfdfree does mtx_lock(sfp->sf_mtx) and TAILQ_REMOVE on the selinfo
inside the freed softc: a use-after-free write into freed M_SNP
memory.

This is the same defect FreeBSD-SA-26:19 / CVE-2026-45251 fixed in
procdesc, jaildesc, and netmap, and the same seldrain() call that
tty.c, tty_pts.c, kern_jaildesc.c, sys_timerfd.c, sys_eventfd.c,
vfs_inotify.c, uipc_mqueue.c, and kqueue_destroy all perform before
freeing the structure holding their selinfo. snp is the one site the
advisory series missed: the destruction path has no drain.

The device is 0600 root:wheel (make_dev() at snp.c:354), so both the
closer and the poller hold descriptors opened by root; the exposure
is root-configured snoop sessions, not an unprivileged path. The bug
is the use-after-free itself, matching the SA-26:19 primitive.

The attached patch adds the missing call:

cv_destroy(&ss->snp_outwait);
seldrain(&ss->snp_outpoll);
free(ss, M_SNP);

I have not built or booted a kernel with the patch; the one-line
seldrain() placement mirrors the other SA-26:19 sites exactly.

-- 
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
[Bug 301062] snp(4): snp_dtor() frees the softc without draining snp_outpoll sleepers
#690
Author: bugzilla-noreply
Date: Mon, 23 Nov 2026 23:39
16 lines
2503 bytes
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=301062

Mark Linimon <linimon@FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|bugs@FreeBSD.org            |net@FreeBSD.org

-- 
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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads