Repository navigation
Description
Problem
The page walkers request dirty-bit updates for ordinary writes or read-modify-writes even when the leaf entry itself has R/W=0. On a processor with CET shadow-stack support, this can set D in a read-only leaf before the access is rejected for insufficient permissions. The SDM prohibits that update even when CR4.CET=0.
The affected leaves are 4-KiB and 4-MiB pages in legacy 32-bit paging; 4-KiB and 2-MiB pages in PAE paging; and 4-KiB, 2-MiB and 1-GiB pages in four-level and five-level paging.
Concrete case
Use four-level paging at CPL3 with CPUID_CET_SS=True, CR4.CET=0 and CR0.WP=1. Map an ordinary user page through present, writable, user-accessible upper entries. Give its 4-KiB leaf PTE P=1, U/S=1, R/W=0, A=1 and D=0; for a page at physical address 0x9000, that PTE is 0x9025.
An ordinary MOV store or memory XCHG to the mapped page must raise #PF with error code 7 while leaving D clear. The source instead changes the PTE to 0x9065 before raising the fault. Starting with A already set isolates the erroneous D update.
Expected behavior and references
References use Intel SDM 325462-093, checked on 2026-10-09. PDF page numbers refer to the combined manual.
- Vol. 3A §5.8, Accessed and Dirty Flags, printed 5-39 / combined PDF page 3299: a processor supporting CET must not set D in a paging-structure entry whose R/W flag is clear. The condition concerns processor support, independently of whether CET is enabled.
- Vol. 3A, Event 14, printed 7-49 / combined PDF page 3399: a page-protection fault may still leave accessed flags set. Those permitted A updates need to remain separate from the prohibited D update.
Source
Source checked at Intel SDM repository commit 48741fad8f9cd646450c6f98ae945ff55acbd558.
- Translate_With_32Bit_Paging: 4-MiB PDE and 4-KiB PTE leaf updates.
- Translate_With_PAE_Paging: 2-MiB PDE and 4-KiB PTE leaf updates.
- Translate_With_4Level_Paging and Translate_With_5Level_Paging: 1-GiB PDPTE, 2-MiB PDE and 4-KiB PTE leaf updates.
- Page_AD_Bit_Update: the helper sets D when requested and does not check the leaf's R/W bit or CET support itself.
Each leaf write/read-modify-write branch passes update_D_bit=>True unconditionally.
The helper links are readable current pages. The reviewed definitions are in the compressed definition database at the pinned commit.
Suggested correction
In each leaf write/read-modify-write branch, define update_dirty_bit := not CPUID_CET_SS or leaf.RW == 0b1, using that branch's pdpte, pde or pte as the leaf, and pass it as update_D_bit. Add the corresponding CPUID_CET_SS dependencies. Keep the calls in their existing positions so permitted A updates remain available, and preserve D when it was already set.
Evidence
On Intel hardware under KVM (Xeon Platinum 8488C), ordinary MOV stores and memory XCHG through read-only four-level leaves raise #PF(7) without changing D. With A=1 and D=0, a 4-KiB leaf retains low byte 0x25; writable controls change 0x27 to 0x67. The same observation holds for 2-MiB and 1-GiB leaves, with CET shadow-stack support exposed and CR4.CET=0. The capture records page-table entries, destination data, accumulator, CR2 and the control-register profile.
Source inspection shows that the write branch passes update_D_bit=>True, causing Page_AD_Bit_Update to change 0x25 to 0x65 before the permission check faults. The same guard is missing in all ten leaf branches. Hardware coverage is four-level paging; five-level, PAE and legacy paths have source-inspection evidence. CET and 1-GiB/five-level paging are optional extensions.
AI disclosure
Assisted by Codex
Activity
brandonhalesintel commentedon Oct 13, 2026
The SDM note that says,
"a processor that supports CET will never set the dirty flag in a paging-structure entry in which the R/W flag is clear"
is not entirely accurate.
The dirty flag could be set for a paging-structure entry with R/W=0 for a a supervisor write with CR4.CET=0 and CR0.WP=0.
So this is both a executable specification issue and and problem with the SDM PDF.
The fix for the executable specification has been made to the master repo and will be in the next update of this repo.