From nobody Mon Apr 13 02:55:28 2026 X-Original-To: bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4fvBq46v3tz6ZMW3 for ; Mon, 13 Apr 2026 02:55:28 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R12" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4fvBq46FWZz3p5l for ; Mon, 13 Apr 2026 02:55:28 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1776048928; 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: in-reply-to:in-reply-to:references:references; bh=Lk0tlbs2SfBUkF0IpulmznnFc6rKVxRmglmCG7JxZkk=; b=dycsC6h/wTq+fC6qg2mVAZX3a4+jZwHvjGZjD0qvxaivt3DOU++30Edsv0qYDQCIyK0qzs rPqLYzoRuynkrPTx0N4720R5iF/ZbY0jZAi1KdFW6V238qZWAV+kEdvtvsnBKm81HU3zIe 42WAosSpQ9fYCuavrj4W70IhSvixGo0AJQ0o9HA7PXgQs+5zF22WSjwPkS6x1j/C48g0C7 oPdb7STZyU6dIxkpxcKwmKQpiTj7HyIX29CQeT4tL0NXghD2gvATSzLtZOZxGYEHVm1eJQ nXTkz1nuwWzq2wpMvU0m9QXMGqTAWmrQHK9My1N+bmZ1GV/u15h6JDtO16j07A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1776048928; a=rsa-sha256; cv=none; b=Xymm3mB53yLRMGir3c0LaKCW6LlVlOfZoy2KdoaO45QUHwfHs67P4TTfRp+Loc7s8pRQFT Vc/NNIMC+kxZCxucBJJznkW8csGGqWGDR+XoPnsEriOF5+hwCfvJmL87TeQLXPt8kg7WRJ TnKN3N8937vlylpN4y9NUs2PIyYG093h8DmCXgPV86qV6wkQlkTnLatacoL3co3w7h9+F2 b2TfO7893/YmUvnpQy86IqiBB70p6HuXHDu1gH1fgDfiYEdbgc8mvL7XlFU3bBcK6rzWNy RtK9ZOTSYUKQt9rfwPxntyIiq/Hqyl/AxkaCz/KFNaiYtBZI9ZQ1wO0Y7SdV/w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1776048928; 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: in-reply-to:in-reply-to:references:references; bh=Lk0tlbs2SfBUkF0IpulmznnFc6rKVxRmglmCG7JxZkk=; b=mNaixNhCgC/h9ruRUkLWN/cHZ5cuCEMkz62pvuuaiXZY25j1S0Dzs1vnmokNarJtGQek2m CAQXByVt0SFJWho+qS+FYSvUBwPu+mNWzD07SGwBDES9iI82RufImDf+oa4kbpa56u6o37 8K45mShWdy8yyKRoPangRLDZByd4cEJL/ofy2J4vdIjffmL+E5856CTRBBLBQR3r+uFLgZ qwGXKFDhJ01vpBSjkkmUgUe7FWhaFKBXjDxe3fdZL+LPjfzyKhPQLMRGbB+VMFmXQXZrzG 1foj6K59GeQvO22G6hcDznujb4M989cQYTq+GR4ozMvMkSUNHEPBn62axiWW/A== Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4fvBq45sBlzm5p for ; Mon, 13 Apr 2026 02:55:28 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 63D2tS8I097927 for ; Mon, 13 Apr 2026 02:55:28 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from bugzilla@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 63D2tS34097926 for bugs@FreeBSD.org; Mon, 13 Apr 2026 02:55:28 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: bugzilla set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 293382] Dead lock and kernel crash around closefp_impl Date: Mon, 13 Apr 2026 02:55:28 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: 14.3-STABLE X-Bugzilla-Keywords: crash X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: commit-hook@FreeBSD.org X-Bugzilla-Status: Open X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@FreeBSD.org MIME-Version: 1.0 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D293382 --- Comment #66 from commit-hook@FreeBSD.org --- A commit in branch stable/15 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=3D84b871567ebe264222d96655e4f6f92c7= 3b0996e commit 84b871567ebe264222d96655e4f6f92c73b0996e Author: Mark Johnston AuthorDate: 2026-03-27 00:24:18 +0000 Commit: Mark Johnston CommitDate: 2026-04-13 02:53:06 +0000 kqueue: Fix a race when adding an fd-based knote to a queue When registering a new kevent backed by a file descriptor, we first look up the file description with fget(), then lock the kqueue, then see if a corresponding knote is already registered. If not, and KN_ADD is specified, we add the knote to the kqueue. closefp_impl() interlocks with this process by calling knote_fdclose(), which locks each kqueue and checks to see if the fd is registered with a knote. But, if userspace closes an fd while a different thread is registering it, i.e., after fget() succeeds but before the kqueue is locked, then we may end up with a mismatch in the knote table, where the knote kn_fp field points to a different file description than the knote ident. Fix the problem by double-checking before registering a knote. Add a new fget_noref_unlocked() helper for this purpose. It is a clone of fget_noref(). We could simply use fget_noref(), but I like having an explicit unlocked variant. PR: 293382 Reviewed by: kib MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D55852 (cherry picked from commit 8f3227f527567aef53da845ab78da8e16d9051c1) sys/kern/kern_event.c | 14 +++++++++++++- sys/sys/filedesc.h | 17 +++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) --=20 You are receiving this mail because: You are the assignee for the bug.=