runtime: verify local_log env_on, logf, and page probes without GPU #1470
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1477"
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?
Imported from R0Y00/Xbox2Windows. Originally posted by Ammmae0x on 2026-11-24T12:34:28Z.
Change
Add a device-free Win32/SEH check (
tests/startup_local_log_check.cpp) forsrc/startup_stubs/local_log.hwithout altering the header itself, registered asstartup_local_logand negative controlstartup_local_log_guard_drop_control(WILL_FAIL TRUE) inCMakeLists.txtand documented indocs/startup-runtime.md. Refs #1149.Covered
x2w_localhelpers and behaviors:env_on: unset and non-"1"values ("","0","2","true","on") returnfalse;"1"returnstrue;GetLastError()is preserved across both absent and present lookups.first_calls: exact1..limitgating,limit <= 0rejection, and 4-thread concurrentInterlockedIncrementexactness.logf:GetLastError()preservation withX2W_TRAP_LOGunset or set, CRLF append behavior, and 1533-byte payload truncation (1536buffer minus\r\nandNUL).probe_readable: rejection of null,< 0x10000,> 0x00007FFFFFFEFFFF, and zero-byte lengths; multi-page and unaligned reads; clean prefix truncation beforePAGE_NOACCESSandMEM_RESERVE; andPAGE_GUARDstop plus guard-bit re-arming verified viaVirtualQueryand a second probe.readable/writable(accessible):PAGE_READONLY,PAGE_READWRITE,PAGE_WRITECOPY,PAGE_NOACCESS,PAGE_GUARD,MEM_RESERVE, and cross-page boundary checks while keepingPAGE_GUARDarmed.--mutate guard-drop): expectsPAGE_GUARDto be dropped rather than re-armed and fails 1 of 58 checks (WILL_FAIL TRUE).Verification
Verified on commit
3ed5928a(rebased cleanly ontoupstream/main2ae8a9e4) in bothdev(Debug) andrelease(/O2) presets with zero compiler errors or warnings:& .\tools\dev.ps1; ctest --preset dev -N->942total tests (startup_local_log,startup_local_log_guard_drop_controlpresent).devbuild and targeted tests:cmake --build --preset dev --target startup_local_log_checkctest --preset dev --no-tests=error -R "^startup_local_log(_guard_drop_control)?$" -V->
2 passed, 0 failed, 0 skipped(startup_local_log:PASS (63 cases);startup_local_log_guard_drop_control:1 of 58 FAILED, passed underWILL_FAIL TRUE).release(/O2) build and targeted tests:cmake --build --preset release --target startup_local_log_checkctest --preset release --no-tests=error -R "^startup_local_log(_guard_drop_control)?$" -V->
2 passed, 0 failed, 0 skipped(startup_local_log:PASS (63 cases);startup_local_log_guard_drop_control:1 of 58 FAILED, passed underWILL_FAIL TRUE)..\out\pe-env\Scripts\python.exe -B tests/form_coverage_check.py->form coverage checks passed(exit 0)..\out\pe-env\Scripts\python.exe -B tests/docs_links_check.py->Checked 16 Markdown files and 332 links.(exit 0)..\out\pe-env\Scripts\python.exe -B tests/bidi_controls_check.py->Checked 1214 tracked source, script and build/CI files: no bidirectional controls.(exit 0).Evidence and follow-up
tests/startup_local_log_check.cppis an original C++ Win32/SEH test written for this repository using syntheticVirtualAlloc,CreateFileMappingW/MapViewOfFile, and temporaryX2W_TRAP_LOGfiles.src/startup_stubs/helper header under #1149; the remaining broader CI and stand-in checks in #1149 stay open.Checklist
AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T12:39:48Z.
Review: COMMENTED
Reviewed
tests/startup_local_log_check.cpp,CMakeLists.txt, anddocs/startup-runtime.mdat3ed5928a0f7566820c4044b0fbca5d6c53d45fb5againstsrc/startup_stubs/local_log.h(header itself is unchanged).Audit notes
env_on: covers unset, non-"1"values ("","0","2","true","on"), and"1", verifyingGetLastError()preservation in all cases and restoring the test env var afterward.first_calls: covers1..limit,limit <= 0, and 4-thread concurrentInterlockedIncrementexactness (400increments,10accepted).logf: redirectsSTD_ERROR_HANDLEtoNULand restores it, preserves/restoresX2W_TRAP_LOG, verifiesGetLastError()preservation (unset and set), CRLF append, and 1533-byte payload truncation (1536buffer minus\r\nandNUL), cleaning up the temp log file.probe_readable&readable/writable(accessible): covers invalid pointer bounds (0,< 0x10000,> 0x00007FFFFFFEFFFF) and zero-byte lengths, multi-page/unaligned reads,PAGE_READONLYandPAGE_WRITECOPY(CreateFileMappingW/MapViewOfFile(FILE_MAP_COPY)),PAGE_NOACCESSandMEM_RESERVEprefix truncation, andPAGE_GUARDstop + re-arming verified viaVirtualQueryand a second probe.startup_local_log_guard_drop_control(--mutate guard-drop,WILL_FAIL TRUE) expectsPAGE_GUARDto be cleared and fails as expected.Verification
Linux (at
3ed5928a0f7566820c4044b0fbca5d6c53d45fb5):git diff --check origin/main..HEAD: clean (exit 0).python3 tests/docs_links_check.py:Checked 16 Markdown files and 332 links.(exit 0).python3 tests/bidi_controls_check.py:Checked 1214 tracked source, script and build/CI files: no bidirectional controls.(exit 0).Windows Server 2025 (Build 26100, MSVC 14.44.35207, commit
3ed5928a0f7566820c4044b0fbca5d6c53d45fb5):--preset dev):cmake --build --preset dev --target startup_local_log_check -- -j 6: built cleanly (3.88s).ctest --preset dev -R '^startup_local_log(_guard_drop_control)?$' --parallel 4 --no-tests=error --output-on-failure: 2/2 passed (startup_local_log0.02s,startup_local_log_guard_drop_control0.01s)./O2(--preset release):cmake --build --preset release --target startup_local_log_check -- -j 6: built cleanly (1.19s).ctest --preset release -R '^startup_local_log(_guard_drop_control)?$' --parallel 4 --no-tests=error --output-on-failure: 2/2 passed (startup_local_log0.02s,startup_local_log_guard_drop_control0.01s).Looks ready to merge.