Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 734BB314D3D for ; Wed, 15 Oct 2025 07:57:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760515029; cv=none; b=M/zZSO1H16AlGLPE9iBiRKUq84Ia/xwd8tMDrrWWkgItDqnoOvo81ZO+EzIbyR1VuRE3lzkb/5Prbi0IW2wlszWrstXcs6bk9TyC3QU0nrlC3GuLLoha3kw5Zgy9fv97e0eqyxH9IBKt6WWB+wl71CT7gtBIM7JG84OCM33eSqE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760515029; c=relaxed/simple; bh=/m5F+5y+jaAHaZg64qgO9Ymnreagb+9rhqxOIhf80iY=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=lX8swcfZHi1/DRyq1qKvQ4zmQ+KS2pV1XCgqxD6/LMqXULzXTUCPmBUHyqwLPVjTquprdwUxIQND8Blhq/WRcUTz1ChMOTUV3YsyMidvBoYpr0ilKtQ0VH1TochjjKxVHHabUwkdozIz8mk7rxiJLeQSJkuuyxWhNn9DeYXSjJI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=FuWUOGgu; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="FuWUOGgu" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 92105C116B1; Wed, 15 Oct 2025 07:57:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1760515028; bh=/m5F+5y+jaAHaZg64qgO9Ymnreagb+9rhqxOIhf80iY=; h=From:To:Cc:Subject:Date:Reply-to:From; b=FuWUOGguKeH2XXFFJEJB9HOX3tcANCCRwRz7JvxqVkIvlnwHGkqGhIHXhsCyvd10t hnTCFOe4rl99bncSLWjSk5ACTB9rvZSm5y6sDiqDzbzCgVWjYO2D2hBfjuPPjhk1bV VDZtoqcKzGYYBVbQuiO1lSXHqhT3W3YEHveKERn0= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2025-39966: iommufd: Fix race during abort for file descriptors Date: Wed, 15 Oct 2025 09:56:54 +0200 Message-ID: <2025101553-CVE-2025-39966-736b@gregkh> X-Mailer: git-send-email 2.51.0 Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reply-to: , X-Developer-Signature: v=1; a=openpgp-sha256; l=5028; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=UVSww11RqBmEFlSPJxUcPxjjzI4TPupYv2kMmHondcU=; b=owGbwMvMwCRo6H6F97bub03G02pJDBnvg48eeCzxtfaHPfdtsRXHPAOdroj8UpF8uPCpbE9Zd DmnvYVVRywLgyATg6yYIsuXbTxH91ccUvQytD0NM4eVCWQIAxenANzkeoZ5itddxK8u21a6REp0 KWt0l9tNlb2PGeanNhxwbpZuCBfkUJTsDc+5+PbnSmsA 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: iommufd: Fix race during abort for file descriptors fput() doesn't actually call file_operations release() synchronously, it puts the file on a work queue and it will be released eventually. This is normally fine, except for iommufd the file and the iommufd_object are tied to gether. The file has the object as it's private_data and holds a users refcount, while the object is expected to remain alive as long as the file is. When the allocation of a new object aborts before installing the file it will fput() the file and then go on to immediately kfree() the obj. This causes a UAF once the workqueue completes the fput() and tries to decrement the users refcount. Fix this by putting the core code in charge of the file lifetime, and call __fput_sync() during abort to ensure that release() is called before kfree. __fput_sync() is a bit too tricky to open code in all the object implementations. Instead the objects tell the core code where the file pointer is and the core will take care of the life cycle. If the object is successfully allocated then the file will hold a users refcount and the iommufd_object cannot be destroyed. It is worth noting that close(); ioctl(IOMMU_DESTROY); doesn't have an issue because close() is already using a synchronous version of fput(). The UAF looks like this: BUG: KASAN: slab-use-after-free in iommufd_eventq_fops_release+0x45/0xc0 drivers/iommu/iommufd/eventq.c:376 Write of size 4 at addr ffff888059c97804 by task syz.0.46/6164 CPU: 0 UID: 0 PID: 6164 Comm: syz.0.46 Not tainted syzkaller #0 PREEMPT(full) Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/18/2025 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0xcd/0x630 mm/kasan/report.c:482 kasan_report+0xe0/0x110 mm/kasan/report.c:595 check_region_inline mm/kasan/generic.c:183 [inline] kasan_check_range+0x100/0x1b0 mm/kasan/generic.c:189 instrument_atomic_read_write include/linux/instrumented.h:96 [inline] atomic_fetch_sub_release include/linux/atomic/atomic-instrumented.h:400 [inline] __refcount_dec include/linux/refcount.h:455 [inline] refcount_dec include/linux/refcount.h:476 [inline] iommufd_eventq_fops_release+0x45/0xc0 drivers/iommu/iommufd/eventq.c:376 __fput+0x402/0xb70 fs/file_table.c:468 task_work_run+0x14d/0x240 kernel/task_work.c:227 resume_user_mode_work include/linux/resume_user_mode.h:50 [inline] exit_to_user_mode_loop+0xeb/0x110 kernel/entry/common.c:43 exit_to_user_mode_prepare include/linux/irq-entry-common.h:225 [inline] syscall_exit_to_user_mode_work include/linux/entry-common.h:175 [inline] syscall_exit_to_user_mode include/linux/entry-common.h:210 [inline] do_syscall_64+0x41c/0x4c0 arch/x86/entry/syscall_64.c:100 entry_SYSCALL_64_after_hwframe+0x77/0x7f The Linux kernel CVE team has assigned CVE-2025-39966 to this issue. Affected and fixed versions =========================== Issue introduced in 6.11 with commit 07838f7fd529c8a6de44b601d4b7057e6c8d36ed and fixed in 6.12.50 with commit 17195a7d754a5c6a31888702ca93f6f08f3383ad Issue introduced in 6.11 with commit 07838f7fd529c8a6de44b601d4b7057e6c8d36ed and fixed in 6.16.10 with commit e4825368285e33d6360c6c6a6a10d2d83da06e55 Issue introduced in 6.11 with commit 07838f7fd529c8a6de44b601d4b7057e6c8d36ed and fixed in 6.17 with commit 4e034bf045b12852a24d5d33f2451850818ba0c1 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-2025-39966 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: drivers/iommu/iommufd/eventq.c drivers/iommu/iommufd/main.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/17195a7d754a5c6a31888702ca93f6f08f3383ad https://git.kernel.org/stable/c/e4825368285e33d6360c6c6a6a10d2d83da06e55 https://git.kernel.org/stable/c/4e034bf045b12852a24d5d33f2451850818ba0c1