tests: add device-free tests for resident_pages.h #3654
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!3654
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3652"
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?
@Ammmae0x on GitHub · 2026-11-30 21:26 UTC · original
Ammmae0x:tests/startup-resident-pages→main· +788 −0 · 5 files · 2 commits · merged 2026-12-01 00:11 UTCRefs #1149
Adds a device-free C++ unit and configure-time header-mutation test suite for
x2w_local::resident_read_write(src/startup_stubs/resident_pages.h), which was untested directly intests/. No existing file is modified; only 5 new files, and the header and device code are untouched.What changed
tests/startup_resident_pages_check.cpp: Win32 C++17 check (windows.h,psapi.honly) with 15 cases: validPAGE_READWRITE/PAGE_EXECUTE_READWRITEpages, an unaligned[page0 + 0xFFE, page1 + 4)span with a corrupt page on either side, a 520-page range crossing the 512-pageQueryWorkingSetExbatch loop with a corrupt last page (519), and refusals for reserved, untouched, read-only, no-access, guarded and mixed-boundary pages, plus the empty and inverted range edges. Every mismatch printsFAIL: <case>: ...to stderr and exits non-zero.--caseselects one case; no argument runs all.tests/cmake/startup_resident_pages.cmake: registers one CTest test per case plusstartup_resident_pages_all, and 5WILL_FAIL TRUEmutation controls mirroringera_physical_owns_last_page_control. Each control builds the same check against a configure-time copy ofresident_pages.hwith one targeted edit: dropping thePAGE_EXECUTE_READWRITEarm (valid_exec_rw), stepping0x2000instead of0x1000(mixed_boundary_refused), acceptingPAGE_READONLY(readonly_refused), single-batchwhile->if(large_last_corrupt), dropping the& ~0xFFFstart alignment (unaligned_span_second_corrupt).tests/startup_resident_pages_meta_check.py+tests/checks/python-linux/startup_resident_pages.txt: Linux contract audit plus a mutation audit on a Python transliteration ofresident_read_write.docs/experiments/startup-resident-pages.md: note, zero personal paths.Linux results
PASS: startup resident pages: 15 cases, 5/5 mutations killedtools/run_checks_parallel.py --from-dir tests/checks/python-linux: all 73 checks passedtests/form_coverage_check.py,tests/docs_links_check.py(193 files, 749 links),tests/bidi_controls_check.py(2765 files): passWindows verification fix round (
bc3af024->de6001a4)Windows 11
dev+releaseCTest ran 21 tests: 16/16 functional cases passed andreadonly_mut+batch_mutpassed, but 3WILL_FAIL TRUEcontrols failed because of real Win32QueryWorkingSetExbehaviour, plus 1 privacy string lint finding. Fixed in this commit:align_mutnow runsunaligned_span_second_corrupt:QueryWorkingSetExpage-aligns the queried address internally, so the validunaligned_spanrange still passes with the alignment dropped; the walk then steps0x1000from0x...FFEand skips page 1, so the read-only second page is never looked at and the range is accepted.guard_mutandvalid_mutare replaced byexec_rw_mut(drop thePAGE_EXECUTE_READWRITEarm, caught byvalid_exec_rw) andstep_mut(step0x2000instead of0x1000, caught bymixed_boundary_refused): probing confirmed both an untouched committed page and aPAGE_READWRITE | PAGE_GUARDpage reportValid=0, Bad=0, Win32Protection=0x0, so the protection check already refuses both wheneverValid=0.guard_refusedanduntouched_refusedstay as functional tests.cmakeaudit confirms all 5 fragment edits apply (including the empty-replacementexec_rwedit).Notes
QueryWorkingSetExon Windows 11 page-aligns a queried address internally, and reports both an untouched committed page and aPAGE_READWRITE | PAGE_GUARDpage asValid=0, Bad=0, Win32Protection=0x0. The note and the meta check document both behaviours.Windows Verification (
de6001a4)AI-assisted.
@R0Y00 on GitHub · 2026-12-01 00:10 UTC · original · approved these changes
Reviewed the resident-pages fixtures and CTest controls.
ctest --test-dir <build> --no-tests=error -j1 -R '^startup_resident_pages_' --output-on-failurepassed in the Windows Release integration. All five mutations were caught, including the unaligned second-page and last-page checks.python -B tests/startup_resident_pages_meta_check.pyalso passed.