From mboxrd@z Thu Jan 1 00:00:00 1970 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=1795154426; b=bvuvBzFdH4PjI8XmQ/j0fUtKdMJP9ULZUcHMyVuIwhMSZPpclkHIJ3gplJwROJ93ZYRd zosewGmgaw+wWfSGi58E3RvXU63ngkZNcmQY6eo8z4YganmAU/QalBe14xNcM/cwmeCXH 9GAT79rVM5iWTFkdxcjR9n57g0wSVqSd77DmFb1qFqHrEwWAQ12GcNE1konl2/lrjxagn eJM5ZcYZVBeaOgZdEcFfqMCmF/jrw5LiCPDbzsYvP4yGKInGLV2AxRX90bWodyn7bkjoV kMJe7UwyQQHUFY5IODx1rwVIQ0kF/79YEcVNjDY49yv0lwnIZBuuCgP9cx8EWx0/1FA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795154426; 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=WN98ulH1Xqk0vu/g0S/dNcW7rhK9OSkHwNVCBmv7sdw=; b=KPI4Eehkxi3DPc9mIAMZDzfIiyvWVk3cFR5LmHnZsbZoO8KdjH0XtgdV6nFUuKbY1VI5 WwiUDb0MfaKFPb+y1xitV76Pnkg8dHh1l6bTZo9V3gxjMiRZuBxF/8/Xvw1Q5aBv0sME0 KHJRvZBMONMS1D2JT6i0VW3giTf17PcgFnBXIjrCLK9KVzYBHCZgS/ntnSXSOvuiSkEVB Uk5zTvuhVpGPOb65snmYQuYYIWjx0l1jPsowgJY2y/IcAWC6rl3VOxIXDaQjwktvwD9Sj el+JrcF1uxpsv44IHjM5wcvB14HgKsKul+x++VX3+wHWgLMMBU4GwpEtS01GLC+qawg== 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=WGEpU1Kb; 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 544EC606A320 for ; Fri, 20 Nov 2026 06:00:25 +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=WGEpU1Kb Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5059D1F000C6; Fri, 20 Nov 2026 06:00:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1795154425; bh=WN98ulH1Xqk0vu/g0S/dNcW7rhK9OSkHwNVCBmv7sdw=; h=From:To:Cc:Subject:Date:Reply-To; b=WGEpU1Kb/E023MVmei5FdJwJlqP5eLz/frCUwLc363zwKVFTV4s5jgKiqqvgY+Lao A/PfWBPHT7H/fc7kaROsnSxCaV0xxMOpB3ZM5eYrI8zD1CrdEDDReXFT4aLyXx27HY HB0rPVGhUBgFv/g/MwbmmUY8bd4SmzUS1hhyc4/o= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2026-99739: mm/shmem: fix truncate hang in large swap entry Date: Fri, 20 Nov 2026 06:52:05 +0100 Message-ID: <2026112016-CVE-2026-99739-fa37@gregkh> X-Mailer: git-send-email 2.56.1 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=4309; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=2j3oGiy3pVWcwpRjjK+SuFS0we7WOGf7C4rtQorJQ2M=; b=owGbwMvMwCRo6H6F97bub03G02pJDFn/78/0Dl2RLrm0wuz/lteBjhN3zq6e0uV7cvu/9Q4KO SvnipT/6YhlYRBkYpAVU2T5so3n6P6KQ4pehranYeawMoEMYeDiFICJ7EthWDDpnVLk1J1Vu3sP FmVejdWc/D8+7R7DHE7+LoUFWWUpkx+Gdp2YwHSlOrlYEwA= 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: mm/shmem: fix truncate hang in large swap entry Truncating a tmpfs file or memfd to a page-aligned size inside a large swap entry can loop indefinitely in shmem_undo_range(). The task holds the inode lock and cannot be killed. A large swap entry represents a whole swapped-out folio. For example, truncate a file whose pages 0-7 share one swap entry to four pages: [ 0 1 2 3 | 4 5 6 7 ] keep | discard ^ new EOF, start = 4 i_size has already been updated when boundary handling asks shmem_get_partial_folio() for page 4. Since it is swapped out, the helper calls shmem_get_folio() with SGP_READ. That rejects page 4 with -EINVAL because its starting offset equals i_size. Nothing is read back. The final scan cannot free the entry without losing pages 0-3. It skips it, restarts from start = 4, and finds it again indefinitely. An unaligned truncate avoids this particular failure because the requested page starts below i_size. Folios already in the page-cache cannot trigger it as the direct lookup will return them beyond EOF. Fix it by letting shmem_get_partial_folio() call shmem_swapin_folio() directly for swap entries. This bypasses the read path's i_size check, allowing the existing boundary handling to zero and split the folio. If swap-in returns a smaller folio, it also splits the swap entry so the final scan can free the entries beyond EOF. Retry the lookup if the entry changes during swap-in. Handling swap-in allocation failures remains broken and is unchanged by this commit. Even when shmem_swapin_folio() correctly returns -ENOMEM instead of -EEXIST, shmem_get_partial_folio() returns NULL and shmem_undo_range() skips boundary handling. If the large swap entry remains intact, truncation can still loop in the final scan, while hole punching can return without zeroing the boundary. This may read an entire large folio back from swap while holding i_rwsem, only to discard part of it. Avoiding that I/O would require splitting both the swap entry and any large folio still in the swap cache. That, however, is much bigger work. The Linux kernel CVE team has assigned CVE-2026-99739 to this issue. Affected and fixed versions =========================== Issue introduced in 6.12.69 with commit a99f9a4669a04662c8f9efe0e62cafc598153139 and fixed in 6.12.118 with commit 9fbca74e8efbb8fed180639af349449f04a2a3c3 Issue introduced in 6.18.9 with commit b23bee8cdb7aabce5701a7f57414db5a354ae8ed and fixed in 6.18.64 with commit 577374a2171cdb68e492725feb564364f93161b6 Issue introduced in 6.19 with commit 8a1968bd997f45a9b11aefeabdd1232e1b6c7184 and fixed in 7.3.5 with commit ef6daf302dc569a67fe50968f9b6085f111b8560 Issue introduced in 6.19 with commit 8a1968bd997f45a9b11aefeabdd1232e1b6c7184 and fixed in 7.4-rc2 with commit fa213b08f37f9dff78ce240a87579dc264fc7a5d 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-99739 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: mm/shmem.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/9fbca74e8efbb8fed180639af349449f04a2a3c3 https://git.kernel.org/stable/c/577374a2171cdb68e492725feb564364f93161b6 https://git.kernel.org/stable/c/ef6daf302dc569a67fe50968f9b6085f111b8560 https://git.kernel.org/stable/c/fa213b08f37f9dff78ce240a87579dc264fc7a5d