Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795099069; b=knMSFhe4P0JjzZjHIE6PZhGS1QshyqGPIICNw8XVwVsmWrXT234ds+UjymHvm8Ihblgy p04uLNPwvbPBXoJRvPiCe2S1ZpEebFKmi7L4rysjO7EcxR6S20P04BePlL3bbDtG0FDfd c1qxBsbwlEITGcEMoXvYXlgFN8Jc7fcRihLsHz1TxXvPaUPbaLvvOIRvjsWGioPDPwVWg TlfofIa0Tgie0gwwr09AcHFdg5wWYIlRGjMOlgKIUqG4fbG1eZFfgXcuWb9xnd/YGEm4b cMPLFjDPHfYbULsKI4kfa2mqzymfD4TDLZuaWx7bdOdwNSbDOf78rj4KfsJObxJ6+kQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795099069; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: Reply-To:MIME-Version:Lines:X-Developer-Signature:X-Developer-Key: Content-Transfer-Encoding; bh=9BwuzCB49EeLrbFTFAWS/5gYTQCxD7dR6mnAMsmBtv0=; b=waVAFWwxT5ICqzDIkGyWhNNpcFmJsGbmyRHclJfWBtkcdXPYbcVwLnJoGytSshk9ecf3 R2rmQA5dGysBrXvQ9eLMhWX6dMBfXZThKSKFj9uB7klRRtijr5oNXkXpvWrxxXbezg597 91y4Nk0PNGqbs5vu3M7nemtif9LtVfXmPOi1OJnIs1hYdxg8Ii71wqzkByqSEuvFVWdWC P16YzsoRT6NU67k0n/PNHf7O7SoAo4X1Qqgjjzin2inyC5EvtlTZdWgzaNJB4GNS1wzl5 54GC2wXDop65J9o6J9aK2WUk29GyAB+Uj1ZQD1rHJE3bLwDQtjIJNodR1YSpeiRJBMA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=bWM0HLSx; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 63E35606A320 for ; Thu, 19 Nov 2026 14:37:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=bWM0HLSx Received: by smtp.kernel.org (Postfix) with ESMTPSA id EC5161F000C5; Thu, 19 Nov 2026 14:37:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1795099069; bh=9BwuzCB49EeLrbFTFAWS/5gYTQCxD7dR6mnAMsmBtv0=; h=From:To:Cc:Subject:Date:Reply-To; b=bWM0HLSxQ16bVp0n2T5WE/4L/39M2jh9Bzx6dPt0XqtPlhOcdKRUY+NyusVIsD140 66l9nNK1KCIbBcaVtq9BGtgdA98Vz44Xc1Uzrx8sNeZv90EE7KVyNUN9KkLzhQdxTU WbCtYZb4QbAD2LnNqx49QXHwcCgergiQGfU0xzF0= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2026-99336: KVM: guest_memfd: take the invalidate lock when unbinding a dying file Date: Thu, 19 Nov 2026 15:23:54 +0100 Message-ID: <2026111945-CVE-2026-99336-44e1@gregkh> X-Mailer: git-send-email 2.56.0 Reply-To: , X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=4081; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=ncp50MT0WaP9pKmhiSzNRS9KbbAn0tCvaDOPRLpDxOk=; b=owGbwMvMwCRo6H6F97bub03G02pJDFn/2Qrr/157cOZ60pZHQrMOMdf+f7J4m7hC4ZZLW1e9X Hz3d7FBYkcsC4MgE4OsmCLLl208R/dXHFL0MrQ9DTOHlQlkCAMXpwBMJFCdYcEunvU3Fp70mnxm k3SKo+hZF17HM8cY5ooumfU3vXrWwnUf/KVd153eHPr+yyUA 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: KVM: guest_memfd: take the invalidate lock when unbinding a dying file kvm_gmem_unbind() takes mapping->invalidate_lock only if the get_file_active() succeeds. When the guest_memfd file is dying, its reference count is already zero so get_file_active fails and the binding is removed without holding the invalidate lock. kvm_gmem_invalidate_{start,end}() checks f->bindings independently to decide whether to begin or end KVM MMU invalidation. So, the bindings must therefore remain stable between the two calls. Otherwise, unbind can remove a binding after start increments mmu_invalidate_in_progress, but before end finds the binding and decrements it. Example, unbind race with memory failure: CPU 0: memory failure CPU 1: memslot delete ---------------------------------- --------------------------- (guest_memfd file is dying) kvm_gmem_error_folio() kvm_gmem_invalidate_start() finds binding mmu_invalidate_in_progress++ kvm_gmem_unbind() get_file_active() fails removes binding kvm_gmem_invalidate_end() no binding found counter stays elevated mmu_invalidate_retry() then returns 1 forever, so guest page faults retry without ever installing a mapping and the guest hangs. Remove the distinction between live and dying files in the unbind path. Always use slot->gmem.file and take the invalidate lock when it's non-NULL. Normal unbind callers hold slots_lock, which prevents release from clearing the pointer or freeing the file state until unbind completes. Final VM teardown can only see a NULL pointer because guest_memfd pins the KVM until release has cleared all bindings. The Linux kernel CVE team has assigned CVE-2026-99336 to this issue. Affected and fixed versions =========================== Issue introduced in 6.12.59 with commit a8ac2bd0f98e1a230f1eb3260fa552bf2ef1753b and fixed in 6.12.118 with commit 4ae4316682cdc78d8f5a856ab0712a8281f211ca Issue introduced in 6.18 with commit ae431059e75d36170a5ae6b44cc4d06d43613215 and fixed in 6.18.64 with commit 3af94f4e3526efdf52d84d7ba8d9fb8e8facb93a Issue introduced in 6.18 with commit ae431059e75d36170a5ae6b44cc4d06d43613215 and fixed in 7.3.2 with commit 024be82ac4c4df650cc6daca6d7db79daee95470 Issue introduced in 6.18 with commit ae431059e75d36170a5ae6b44cc4d06d43613215 and fixed in 7.4-rc1 with commit 0ee2c883b62deb74d8c43007e8049dc006d3a2fb Issue introduced in 6.17.9 with commit 393893693a523e053f84d69320d090b93503f79f 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-99336 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: virt/kvm/guest_memfd.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/4ae4316682cdc78d8f5a856ab0712a8281f211ca https://git.kernel.org/stable/c/3af94f4e3526efdf52d84d7ba8d9fb8e8facb93a https://git.kernel.org/stable/c/024be82ac4c4df650cc6daca6d7db79daee95470 https://git.kernel.org/stable/c/0ee2c883b62deb74d8c43007e8049dc006d3a2fb