eh: harden is_writable for PAGE_GUARD, multi-region spans, and lazy pages #626
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl#626
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Grimkaaah on GitHub · 2026-11-24 02:39 UTC · original
Problem
eh::is_writable(used by emulatedCLZERO/ClzeroLoop) answers with a singleVirtualQuery. That is wrong in four ways (originally listed as item 3 of #278; items 1–2 are onmain, item 4 is #321):PAGE_GUARD.PAGE_READWRITE | PAGE_GUARD(0x104) passes& (PAGE_READWRITE | PAGE_EXECUTE_READWRITE) != 0, so the VEH can write through a guard page instead of letting the real fault happen.ClzeroLoopcan cover adjacent committed runs with different protect; one query only sees the first.va + bytes. A wrapping end is undefined.MEM_RESERVE(lazy map) makesis_writablefalse →0xC000001D, instead of committing vialazy::ensureand zeroing.Plan
Match the shape of
dstorage::writable:checked_add→lazy::ensure→ UMA coherent-window fast path → walk everyVirtualQueryregion covering[va, end), requiring a writable protect and noPAGE_GUARD. Unit tests withVirtualAllocfor guard, multi-region, hole, overflow, and a lazy page.Complements #501 (sparse-window fast path); does not touch the CLWB race (#321).
Tracking
Split out of #278 item 3 so the fix can land as one small PR.
@Grimkaaah on GitHub · 2026-11-24 02:44 UTC · original
Complete PR: https://github.com/ivall/xcl/pull/523 (rebased, smoke on main + head, lib tests 648 passed).