Skip to content

[General]: Paging sets dirty bits in read-only leaves on CET-supported processors #78

Open

Description

@OsamaAlkhodairy

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.

Source

Source checked at Intel SDM repository commit 48741fad8f9cd646450c6f98ae945ff55acbd558.

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

  1. added
    SDM PDF issueThis problem is present in the SDM PDF and is/may be present in the website as a consequence
    and removed on Oct 12, 2026
  2. brandonhalesintel commented on Oct 13, 2026

    @brandonhalesintel

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    SDM PDF issueThis problem is present in the SDM PDF and is/may be present in the website as a consequence

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions