Repository navigation
fix(libc): reset every page of a run view that Commit reprotects - #11344
Conversation
MarcZX10
left a comment
There was a problem hiding this comment.
The range iteration matches the protection operation: it starts at the aligned first mapped view, resets each view whose base is before the region end, and then applies VirtualProtect to that same region. The added regression arms a four-page shared run, verifies a later-page store is collected and rearmed, and checks the final protection on every page. The author reports the focused Windows suite passing 7/7 (including three repetitions of the new case); hosted conventions, relinker ASan, Windows relinker, macOS write-watch and register-context checks pass. I could not reproduce the Windows library test locally because the MinGW configuration lacks the Windows SDL2 package; the hosted full product jobs are path-skipped. No blocking issue found in the diff.
MarcZX10
left a comment
There was a problem hiding this comment.
The exact-head review and the reported regression are otherwise solid: the implementation clears each View whose base lies in the region being reprotected, and the new test exercises a multi-page shared run, a later-page write, re-arming, and final per-page protection. Current hosted policy, relinker, ASan, register-context and write-watch checks pass; the full Linux/Windows product jobs are path-skipped.
The branch is still 1 ahead and 20 behind current main (14c99b52ac); the report and the 3/3 negative-control runs are based on 442c43a574. CONTRIBUTING.md asks branches to stay up to date. Please refresh onto current main and rerun windows_write_watch plus the focused mapping tests on that exact head before merge. The merge preview is clean, and I found no intervening changes to WindowsMappings.hpp or WindowsWriteWatch.cpp, but that does not replace an exact-current-base run.
10b38aa to
62d94f9
Compare
|
@MarcZX10 I refreshed the branch onto
I've updated the description to match. |
MarcZX10
left a comment
There was a problem hiding this comment.
The requested current-main validation is complete: the refreshed head 62d94f9854c2093c074a1cc88403e89ff65f33e8 is one commit ahead of 14c99b52ace303eef1667764670d1d1540140b3d, with a clean merge preview. The implementation still resets every mapped view covered by the protection range, and the exact-head focused Windows tests and negative control reported in the updated description exercise the multi-page failure and recovery. The remaining hosted Windows and macOS x86_64 relinker jobs are infrastructure/build validation; all other relevant policy, ASan, register-context, write-watch and relinker checks have passed. No remaining actionable findings.
|
Current-base follow-up ( |
Co-Authored-By: Claude <noreply@anthropic.com>
62d94f9 to
2b640c8
Compare
|
@MarcZX10 refreshed, picking this up for contact today:
The description's Tested line now names this head and base. AI-assisted: yes (Claude Code) |
|
@thuanquang looks right to me, from reading it against |
What
Since #9505, a run of shared guest pages is mapped as one host view, with one
Viewper 16 KiB page. InCommit, the branch for already committed memory reset only theViewat the start of eachVirtualQueryregion (views.find(cursor)), then calledVirtualProtecton the whole region. OnceCollecthas armed the pages of a run view alike, one region covers several pages. The other pages then became writable while theirViews keptarmedset andseen == generation. Stores to them never faulted, andCollectdid not report them, so the GPU could keep stale copies.Commitnow resets everyViewin the range it reprotects, the same range as theVirtualProtect.This is point 1 of the post-merge review of #9505, which its author asked us to fix (comment).
Tested
Windows 11 26200, Ryzen 5 5600X, WinLibs GCC 15.2.0 r7, Release. Head
2b640c8ad0onmain5b5d24cb22.windows_write_watchcovers this:All, so all four pages are armed read-only as one region.PAGE_READWRITE, stores into page 1, and requiresCollect(Armed)to report the store.Commit(PAGE_READONLY)to give all fourViewsPAGE_READONLY.main'sWindowsMappings.hpp, the check fails in 3 of 3 runs:a store into the second page of a run that Commit reprotected was not collected. With this change it passes in 3 of 3 runs.^(windows_write_watch|windows_mappings_release.*|guest_memory|windows_shared_map_cost)$: 7 of 7 pass, in 3 of 3 rounds.How a guest reaches it: guest
mprotectcallsGuestArenaSetProtection, which resets everyView, beforeCommitArenaRange. A single-threadedmprotectis therefore fine onmain. The defect needs aCollectbetween those two calls, or a directCommitover an armed run.Not tested: Linux and macOS (
WindowsMappingsis Windows-only). No title is known to hit this yet.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code