From nobody Mon Apr 13 02:57:32 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 4fvBsT1rscz6ZMwG for ; Mon, 13 Apr 2026 02:57:33 +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 4fvBsT1637z3pkt for ; Mon, 13 Apr 2026 02:57:33 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1776049053; 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=81AfHn8MFDTTXGmpi2iIHTHlsHzMhnH0Cu2CuHihCDY=; b=X2ekazoEbJcVe8Ee0YadRGzEflP+SCN4TekzR+sXis4THOeSJ0GWWqSIy7o7/dwPfTx/g7 7mDXkDnhnf1ruSGsdX9V45t5cWyXhbpsFRA6vrFSWSre4eBuFlII3uP5I204VSwpaqd8oQ LG6yAU7uc0SkJebOt/TjffaiidLpK1gB7Ng4Q0K2FI5fkT6ilt4VkaipcWes3wxq+Q0SsC ZQdzeSCRU60aw9NpPs+8me3lNbpTJNHICfy0xVmq1iffPDvDFxg+IL/vExgOh/w0qekX3t 1FWCuRGiw3j5+hFuc5A53J2CO2iT41h5GcKfNBlj71BWLn6WLzrWTFWE1fV5Rw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1776049053; a=rsa-sha256; cv=none; b=oU2EqosPGzdMGvk8ocC4mhzvwRLGqQfaa3q3OxOI19kKui6U3eeI/3sIQuNeIX5i9BRg/6 25GmyyDrxwVb6s4dFpQ7TLbBgvoOTl3oUxqVA2FgIaxRvOJ4NBkeulZusXJooy1EbxgeBq uKG49Z8nQBejo0IQVegjTROzIIROOTtIJiQzf5950xJjkLbTDrrWneixdZ65f4sSM70aLK vaJqNVp8TJPj1XvgVrgvF662L8eBxOXlGMoCUDOPgwtYXJ915zbmv72EFx+q3mnPmBPX5w QyeCcU2shDqGl0XAT2Xf0QjTeZTUAFpdESBxj6EGRPNW0gOpSmyFQjLmZQTR3g== 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=1776049053; 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=81AfHn8MFDTTXGmpi2iIHTHlsHzMhnH0Cu2CuHihCDY=; b=W+sRlOi9I8KgOJVJXxwS5WiuQrFkfHnJ9Nkgz06lFKwP4r26el38ROnr3jxDSj493m84RB UBJUjFMYzKRF41DJynuTnbVMaEcyQql02VAlDBEZ515bYL1z+WE9lviLSAAGZG2FsAy68e wLjwiN7zs0gfabv8iG2jVj3V3uJ5qo6+vPnN5977zkhCV9kFwrHclIgja8VqgjtlJxgixL EUajEwHzhha78mNYTgFkAnT7YmUDvHMZHydTDxKZ/ffvTrSJlkc1arbMN9WA7m+ZdSlD29 ta+Veuw64y8vKkVkox00Utgc0EYMLbCwHIiRSehQvQ6pxFcQGQSk6OigGsSjAg== 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 4fvBsT07DRzlP9 for ; Mon, 13 Apr 2026 02:57:33 +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 63D2vWgL099761 for ; Mon, 13 Apr 2026 02:57:32 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from bugzilla@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 63D2vWlj099760 for bugs@FreeBSD.org; Mon, 13 Apr 2026 02:57:32 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:57:32 +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 #67 from commit-hook@FreeBSD.org --- A commit in branch stable/14 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=3D88535adba95d019557b4281c52daa9fec= cade2fe commit 88535adba95d019557b4281c52daa9feccade2fe Author: Mark Johnston AuthorDate: 2026-03-27 00:24:18 +0000 Commit: Mark Johnston CommitDate: 2026-04-13 02:53:26 +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.=