Re: [PATCH 0/3] mm: fix soft-dirty false positives in mprotect() of large folios
From: Paul Gofman
Date: Wed Nov 25 2026 - 10:43:46 EST
On 11/25/26 07:43, David Hildenbrand (Arm) wrote:
On 11/25/26 14:32, Shivank Garg wrote:Do I understand correctly that these issues only affect the old soft dirty feature and not UFFD WP async (UFFD_FEATURE_WP_ASYNC)? Over-indicating written pages with the newer UFFD support is not expected and Wine usage of the feature requires that. But I guess it is not what is concerned here?
mprotect() handles the PTEs of a large folio as one batch, and marks theWhy do we care? Just over-indicate soft-dirty. It's valid, and the whole feature
whole batch dirty with pte_mkdirty() if any of its PTEs is dirty. On
x86, powerpc, riscv and s390, pte_mkdirty() also sets the soft-dirty
bit, so after clear_refs, mprotect() marks unwritten pages soft-dirty.
With 64K mTHP on x86-64, all 240 unwritten pages of a 1MiB region are
reported soft-dirty; with my fix, none are.
is full of holes and buggy as hell.