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 9EDF830F958 for ; Wed, 16 Sep 2026 10:42:24 +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=1789555350; cv=none; b=td9PO5fxhB56aTAD4cOqAWoSdQEzWbUWHTQZ+lzXXrQB7XBY8qz9lMUIUEeDrLCHKmL6zirD5FLiJ/YaW1E8jajnbQ+/ol0hZI2M1G9tEUiMrkZS3DdPPvPFUY3+f8/K10iOvLdiXiJ3yxThcfVkxi4M3vJCUSQXVTvwXDxbVzw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789555350; c=relaxed/simple; bh=ITBQFYXwVgc0WoaBk5bzwXom57uqC3RvByhBWekHN+c=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=bKnwFyBxcqju6uIoaOFYwk0QVfp6UQv6d1EP90zc8SSv8uetaeNeaAdGRAAHGCNsOsytT+i/QoIXu3U6Hj62QqHnnyWxS1ujBKaYJfUh4/wcHRkDOc1Cm1fqocIVaMC47ptI0GQtszWCwRFQtYHTNEoAnrIvZCFuXgFxDG99Cp4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ABLpuzwt; 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="ABLpuzwt" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA3BB1F0089A; Wed, 16 Sep 2026 10:42:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789555344; bh=SiLUP34TLFACdZeoiA1xmjWqMUsP13b27ucV+ne/nvw=; h=From:To:Cc:Subject:Date:Reply-To; b=ABLpuzwtLe3KCSSAA3FwdBdulmSOSRGemGfkOPUokmUtLl3T12BSA23aN2PDcURnH 2csajH2qgF+qRyaje8Hp7ZJVTrybEWCSUyIIX4DEtQ7D1pDg5hpqEblvH+oJJIdSV1 r6tq4Cxj1/PnGAXrs8FMvJBFJKPHAXUQOfC/Vsmo= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2026-89987: mm/huge_memory: transfer the pmd dirty bit to the folio on zap Date: Wed, 16 Sep 2026 11:31:57 +0100 Message-ID: <2026091657-CVE-2026-89987-2d55@gregkh> X-Mailer: git-send-email 2.55.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=4713; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=yIn7T7HOrM+RrzF1TF+DbA9nqDa81YYCdgJg7hH1nZU=; b=owGbwMvMwCRo6H6F97bub03G02pJDFmr8pceNIw/sk1vrnbmjW2/4x6zZMsb+usl+27bk53vL WIypVe5I5aFQZCJQVZMkeXLNp6j+ysOKXoZ2p6GmcPKBDKEgYtTACZypJFhrogPW1b2Zm2lZGt2 vT2H3srV3bjkx7CgPas7afIWyUcnNl5+p3N49+azzq0rAA== 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/huge_memory: transfer the pmd dirty bit to the folio on zap zap_huge_pmd_folio() propagates the pmd young bit to the folio for the file case, but not the dirty bit. The pte path does propagate it, in zap_present_folio_ptes() and so does the pmd split path, in __split_huge_pmd_locked(). For most file mappings the omission is harmless, because writing to a shared file mapping goes through page_mkwrite(), which dirties the folio. tmpfs is different: it has no page_mkwrite(), and vma_wants_writenotify() is false for it, so a *read* fault on a MAP_SHARED tmpfs mapping installs a writable pmd via do_read_fault(). do_read_fault() does not call fault_dirty_shared_page(), so subsequent stores through that mapping set only the hardware dirty bit in the pmd and never call folio_mark_dirty(). A shmem folio allocated by a fault is marked uptodate but not dirty (see the clear: block in shmem_get_folio_gfp()), so PG_dirty is never set at all. Unmapping such a folio - munmap(), or exit_mmap() when the process dies - then loses the only record that it was written, because zap_huge_pmd() drops the pmd without transferring the dirty bit. Reclaim afterwards sees a clean shmem folio: the whole swap-out block in shrink_folio_list() is inside "if (folio_test_dirty(folio))", so pageout() is skipped and the folio falls into __remove_mapping(). There, folio_is_file_lru() is false for a swapbacked folio, so no shadow entry is created and __filemap_remove_folio(folio, NULL) simply empties the i_pages slot. The data is freed without ever being written to swap, and the next fault on that index returns a freshly zeroed folio. This is silent data loss for any process that keeps state in a MAP_SHARED tmpfs segment across an unmap - for example a cache handed from one process generation to the next through /dev/shm. It requires the folio to be PMD-mapped, so it only shows up once shmem THP is enabled (which is what we did in Meta fleet and started noticing crashes); with THP off the pte path transfers the dirty bit correctly. It also only becomes visible when swap is enabled, because with no swap device shmem folios (which are on the anon LRU) are not scanned by reclaim at all, so the clean folio is never dropped. Reproduced on x86_64 with a tmpfs mounted huge=within_size: read-fault a 2MB-backed region, write a known pattern through the resulting mapping, munmap, force reclaim of the cgroup, then re-map and read back. Without this patch the region reads back as zeros and vmstat shows zswpout 0 - the data was discarded rather than swapped. With this patch the region reads back correctly and the pages are swapped out as expected. With huge=never, or when the first touch is a write, the test passes either way. The Linux kernel CVE team has assigned CVE-2026-89987 to this issue. Affected and fixed versions =========================== Issue introduced in 4.8 with commit b5072380eb619786990cd9eab3ade05d09ccd89e and fixed in 6.18.52 with commit effe3cc6d4fdd407457eb30f7b0ef094393f0d64 Issue introduced in 4.8 with commit b5072380eb619786990cd9eab3ade05d09ccd89e and fixed in 7.2.5 with commit 9435cddf1378d149d826bd7bd1448a44bf96868d Issue introduced in 4.8 with commit b5072380eb619786990cd9eab3ade05d09ccd89e and fixed in 7.3-rc2 with commit fe6cf984939d8e12cb33a99673c8d026c5135e68 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-89987 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/huge_memory.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/effe3cc6d4fdd407457eb30f7b0ef094393f0d64 https://git.kernel.org/stable/c/9435cddf1378d149d826bd7bd1448a44bf96868d https://git.kernel.org/stable/c/fe6cf984939d8e12cb33a99673c8d026c5135e68