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 2028549362D for ; Fri, 25 Sep 2026 10:31:21 +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=1790332282; cv=none; b=FjoIGr9qhFzKfD2baX+HQbv0dzzM93j4l9+gqJIEEkvB9OUzXS0DYx+diB4fMglPWsi4xXEC+7je83qO4F9+0LYHMsEXt5IN96MDjWFhpwXJQuCdZTRhZvQGXMFof6vONYQWUEEWv/3ZeWOdCXYCh7/Di9h5/0wUnSGbV6yXnnU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790332282; c=relaxed/simple; bh=PMwT/n1y5PUBif9Yk/o6LEb3n743T1XEHTaswr3r7ZM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=fNABM8GnqCr7f2rrhSvC8WM/Z5ZAdL/BWzqzEfvWOwZ48fupE07q4O1j76YtZW0jf/+ETkTAuXlcQXdp6Tcbbt4bcduZm0ZQRiAZKXuAGf4bbHuE0rCwltBWpko2WauwPClSo1fSnzF+xyEqIUFI9H3qV4xk+zEqFK6pCnff3mo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=GahFFDMF; 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="GahFFDMF" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B1E11F000FF; Fri, 25 Sep 2026 10:31:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1790332281; bh=x2yfQ02H9G77DXNJ17KVerHl1t8AcWAQCa5gFPKQLhA=; h=From:To:Cc:Subject:Date:Reply-To; b=GahFFDMF4OWFL7ns5gm2KkSyKiQf/UHXG0QUFpYrMFXHY8YC4taJSOsZThhKPZpOE wvTQ92IxqrHUC9YS7xvI51lXH/OqI3IU5f/GIKPv8ctP3NgtI0Ykphz/gMQs2Czcwu w3bqjIgu+MBfH5iRD95kVlo0ydgbwcDvOz9Sj/iA= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2026-97945: x86/mm: Fix user-space data loss with MADV_FREE and THP Date: Fri, 25 Sep 2026 12:24:08 +0200 Message-ID: <2026092512-CVE-2026-97945-1f40@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=4300; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=jd0o7lSpyeF6u2XVJ0GJ1yAWo96OinYF55yzeBP3Mww=; b=owGbwMvMwCRo6H6F97bub03G02pJDFnbvENL0pxvs4YW3fFt1n6haRs336GCfVXlEqe/F1a63 Dj+QduuI5aFQZCJQVZMkeXLNp6j+ysOKXoZ2p6GmcPKBDKEgYtTACYSOoFhwZT127fUtjx2PV9n l3ziSm2VlUDsV4b5Dnmxvx1a3uktvLlj9vzpXpv4Z05qBAA= 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: x86/mm: Fix user-space data loss with MADV_FREE and THP Some of users of Polars (a data analytics library) have lost production data from this bug. They seem to have just the right combination of huge pages, MADV_FREE and heavy reclaim pressure. pmd_modify() masks the old value with (_HPAGE_CHG_MASK & ~_PAGE_DIRTY), silently discarding the hardware dirty bit. The subsequent pmd_mksaveddirty() call is supposed to transfer _PAGE_DIRTY into _PAGE_SAVED_DIRTY when write-protecting, but the dirty bit was already stripped from the value, so there is nothing left to transfer. Contrast with pte_modify(), which keeps _PAGE_DIRTY_BITS in its mask, and pud_modify(), which keeps _HPAGE_CHG_MASK untouched: pmd_modify() is the odd one out. Any pmd_modify() on a writable, dirty PMD loses the dirty state. One visible consequence is data loss with MADV_FREE on PMD-mapped THP: memset(buf, 0x5A, size); // PMD-mapped THP, PMD dirty madvise(buf, size, MADV_FREE); // PMD cleaned but left writable, // folio marked lazyfree memset(buf, 0x5A, size); // hardware sets _PAGE_DIRTY again mprotect(buf, size, PROT_READ); // pmd_modify() drops the dirty bit mprotect(buf, size, PROT_READ|PROT_WRITE); // ... memory pressure ... Reclaim (e.g. under memcg pressure) then finds the lazyfree folio with no dirty bit set anywhere and frees it in __discard_anon_folio_pmd_locked(), even though the data was rewritten after MADV_FREE; subsequent reads fault in fresh zero pages. NUMA hinting alone can trigger the same loss, as do_huge_pmd_numa_page() restores the PMD through pmd_modify() as well. PMD-mapped file THPs are affected too: mprotect()/NUMA hinting dropping the dirty bit means rewritten data is never written back. Fix it by keeping _PAGE_DIRTY in the preserved mask, exactly like pte_modify() and pud_modify() do. The existing pmd_mksaveddirty()/pmd_clear_saveddirty() pair then performs the hardware-dirty <-> saved-dirty transition based on the write bit, preserving the shadow-stack encoding rules. The Linux kernel CVE team has assigned CVE-2026-97945 to this issue. Affected and fixed versions =========================== Issue introduced in 6.6 with commit bb3aadf7d446aaf22c725b274e2c194ac5cb2111 and fixed in 6.12.111 with commit e4d569fe2f436a9b58c048fefabf56eab68c1b7e Issue introduced in 6.6 with commit bb3aadf7d446aaf22c725b274e2c194ac5cb2111 and fixed in 6.18.53 with commit 55ddbc2ca6d5db64d44c3fb8f8705b4d39eb30b7 Issue introduced in 6.6 with commit bb3aadf7d446aaf22c725b274e2c194ac5cb2111 and fixed in 7.2.7 with commit a5ad97cbcfcec31430268441c10eedde73200177 Issue introduced in 6.6 with commit bb3aadf7d446aaf22c725b274e2c194ac5cb2111 and fixed in 7.3-rc4 with commit f7491d7c81db0e7c304a7bd757a76d2fbeaff80e 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-97945 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: arch/x86/include/asm/pgtable.h 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/e4d569fe2f436a9b58c048fefabf56eab68c1b7e https://git.kernel.org/stable/c/55ddbc2ca6d5db64d44c3fb8f8705b4d39eb30b7 https://git.kernel.org/stable/c/a5ad97cbcfcec31430268441c10eedde73200177 https://git.kernel.org/stable/c/f7491d7c81db0e7c304a7bd757a76d2fbeaff80e