From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A854C2C3268 for ; Sat, 30 May 2026 12:14:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780143266; cv=none; b=amW4W5JYQRF9fpcBtxw/GL+QKN8JGP+mciJFFVmhpH/2AyC7gVB6z4xCesyp9u1Xbw3DpFVAFsMBxuOhP1BzXPfZq6oXSIfuRAUVnWtSmKUiOVs17+vHuV7O7zmyD6PXvd8lnww6czoOdcs7LIbnT00Ogk14XQwvAVxRqI8XbcU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780143266; c=relaxed/simple; bh=qRZr7Ohmpbxc8jIWOuNqe6vSbcKHUMqhOPcrafVofP0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=GtSVUJ40o0OEpEnxvi0KScNlhXyeo6ZR7IYXa5mNPEeQacDZW9IywZtA2fR/fNCDifVYj+rtq6D/BwoSitaueY3t4fvp/ND8ydTsXeFGHoa+MggVw3Gd600aBx4t9IORRdbcJxLYKtRpVhk1E9pp2c1Nzy3U6whY/G/44PkfOF0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=TtSuOoHg; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="TtSuOoHg" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C76081F00893; Sat, 30 May 2026 12:14:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1780143265; bh=b9l7O0YhChg8mu4gWiDdjTuX8jX4sQ1plKxsVm7hquA=; h=From:To:Cc:Subject:Date:Reply-To; b=TtSuOoHg15qmwU2TuhtE+3nOFp0V6BmD55E3MKfYxb/08UVsC7Uy4XUZO6syheoC0 7UhZRhnDN+4/KaU9msveFas2DpY/L4Kly3HzGR0PQzptO0bZhuI97RdvWM4W5F7f0V 10qYiTmeX0p/2ZFP9Pb1M9+799OWGaJWWZ2y+Oh8= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2026-46242: eventpoll: fix ep_remove struct eventpoll / struct file UAF Date: Sat, 30 May 2026 14:13:15 +0200 Message-ID: <2026053014-CVE-2026-46242-8394@gregkh> X-Mailer: git-send-email 2.53.0 Reply-To: , Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=4048; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=ZtN2KIh+zYLFgyiVASRJ6lKDB6ydbFn5Rby9AblWntI=; b=owGbwMvMwCRo6H6F97bub03G02pJDFlSV6JyTp+MNvIq7Z063y7YN1NUVnBK8pXLB3SLmM/uv tHSs9SyI5aFQZCJQVZMkeXLNp6j+ysOKXoZ2p6GmcPKBDKEgYtTACail8gwP6AulPmWW+BfjfXT xB5MXB9yNPPgZoYFHS6TihuOHGc5sTV/oX6/Ypih3w99AA== X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit From: Greg Kroah-Hartman Description =========== In the Linux kernel, the following vulnerability has been resolved: eventpoll: fix ep_remove struct eventpoll / struct file UAF ep_remove() (via ep_remove_file()) cleared file->f_ep under file->f_lock but then kept using @file inside the critical section (is_file_epoll(), hlist_del_rcu() through the head, spin_unlock). A concurrent __fput() taking the eventpoll_release() fastpath in that window observed the transient NULL, skipped eventpoll_release_file() and ran to f_op->release / file_free(). For the epoll-watches-epoll case, f_op->release is ep_eventpoll_release() -> ep_clear_and_put() -> ep_free(), which kfree()s the watched struct eventpoll. Its embedded ->refs hlist_head is exactly where epi->fllink.pprev points, so the subsequent hlist_del_rcu()'s "*pprev = next" scribbles into freed kmalloc-192 memory. In addition, struct file is SLAB_TYPESAFE_BY_RCU, so the slot backing @file could be recycled by alloc_empty_file() -- reinitializing f_lock and f_ep -- while ep_remove() is still nominally inside that lock. The upshot is an attacker-controllable kmem_cache_free() against the wrong slab cache. Pin @file via epi_fget() at the top of ep_remove() and gate the critical section on the pin succeeding. With the pin held @file cannot reach refcount zero, which holds __fput() off and transitively keeps the watched struct eventpoll alive across the hlist_del_rcu() and the f_lock use, closing both UAFs. If the pin fails @file has already reached refcount zero and its __fput() is in flight. Because we bailed before clearing f_ep, that path takes the eventpoll_release() slow path into eventpoll_release_file() and blocks on ep->mtx until the waiter side's ep_clear_and_put() drops it. The bailed epi's share of ep->refcount stays intact, so the trailing ep_refcount_dec_and_test() in ep_clear_and_put() cannot free the eventpoll out from under eventpoll_release_file(); the orphaned epi is then cleaned up there. A successful pin also proves we are not racing eventpoll_release_file() on this epi, so drop the now-redundant re-check of epi->dying under f_lock. The cheap lockless READ_ONCE(epi->dying) fast-path bailout stays. The Linux kernel CVE team has assigned CVE-2026-46242 to this issue. Affected and fixed versions =========================== Issue introduced in 6.4 with commit 58c9b016e12855286370dfb704c08498edbc857a and fixed in 6.18.33 with commit ef4ca02e95363e78977ca04340d44fe3b4b2b81f Issue introduced in 6.4 with commit 58c9b016e12855286370dfb704c08498edbc857a and fixed in 7.0.10 with commit ced39b6a8062bac5c18a1c3df85634107eb8664a Issue introduced in 6.4 with commit 58c9b016e12855286370dfb704c08498edbc857a and fixed in 7.1-rc1 with commit a6dc643c69311677c574a0f17a3f4d66a5f3744b Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community. Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at https://cve.org/CVERecord/?id=CVE-2026-46242 will be updated if fixes are backported, please check that for the most up to date information about this issue. Affected files ============== The file(s) affected by this issue are: fs/eventpoll.c Mitigation ========== The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits: https://git.kernel.org/stable/c/ef4ca02e95363e78977ca04340d44fe3b4b2b81f https://git.kernel.org/stable/c/ced39b6a8062bac5c18a1c3df85634107eb8664a https://git.kernel.org/stable/c/a6dc643c69311677c574a0f17a3f4d66a5f3744b