startup: opt-in guarded write of the view token in note_view #3097
Closed
lukaslw-lab wants to merge 8 commits from
upstream-pr/3097 into main
pull from: upstream-pr/3097
merge into: R0Y00:main
R0Y00:main
R0Y00:codex/indirect-large-backed-views
R0Y00:codex/word3-preflight-check
R0Y00:codex/vertex-table-two-records
R0Y00:codex/live-index-alias
R0Y00:codex/copied-vertex-buffer-srv
R0Y00:codex/windows-stage-test-output
R0Y00:codex/preserve-live-srv-retirement
R0Y00:codex/share-render-target-tracking
R0Y00:codex/sgd5-negative-offset-fixture
R0Y00:coverage-dashboard
R0Y00:codex/mesh-loose-root
R0Y00:codex/mesh86-cache-padding
R0Y00:codex/xmem-scatter-preflight
R0Y00:codex/mesh-depth-ps
R0Y00:codex/indirect-dispatch-refresh
R0Y00:codex/compute-container-index
R0Y00:codex/startup-compute-formatted-load
R0Y00:codex/compute-indirect-producer
R0Y00:codex/compute-atomic-soffset
R0Y00:codex/mesh-dual-handoff
R0Y00:codex/startup-run-sh-watcher-control
R0Y00:codex/queue31-page-alias
R0Y00:codex/indexed-indirect-compute-root
R0Y00:codex/typed-buffer-view-metadata
R0Y00:codex/translated-indexed-address-alias
R0Y00:codex/fixed-mesh-create-result
R0Y00:codex/xmem-section-lease
R0Y00:codex/startup-slot86-mesh-cache
R0Y00:codex/restore-mesh-barrier-iteration
R0Y00:codex/translated-indirect-upload-index
R0Y00:codex/xapu-completion-opt-in
R0Y00:codex/translated-indexed-rect
R0Y00:codex/translated-indexed-indirect
R0Y00:codex/startup-mesh-lds-integration
R0Y00:codex/startup-console-ms24
R0Y00:codex/startup-slot57-mesh-request
R0Y00:codex/indirect-copy-provenance
R0Y00:codex/present-color-producer-trace
R0Y00:codex/compute-dispatch-binding-trace
R0Y00:codex/translated-indirect-table-buffers
R0Y00:codex/indirect-copy-provenance-base
R0Y00:codex/mix-half-literal-source
R0Y00:codex/translated-indirect-draw
R0Y00:codex/xmem-scatter-diagnostics
R0Y00:codex/slot148-recording-upload
R0Y00:codex/slot70-loading-art-verified
R0Y00:codex/command-list-upload-arena
R0Y00:codex/recover-failed-command-list
R0Y00:codex/startup-heap-timing-notes
R0Y00:codex/align-audio-input-timeline
R0Y00:codex/synthetic-depth-export-control
R0Y00:codex/startup-texture1d-on-windows
R0Y00:codex/1629-packed-position-fixture
R0Y00:codex/cpu-srv-refresh
R0Y00:codex/stream-root-srv-draw
R0Y00:codex/audio-mixer-timer
R0Y00:codex/startup-reload-published-shader
R0Y00:codex/priority-integrate-1284
R0Y00:codex/guest-sixteen-page-record
R0Y00:codex/aot-placed-dxr-batch
R0Y00:codex/guest-directory-selection
R0Y00:codex/gamesave-enumerate-read
R0Y00:codex/readme-archive-to-pixels
R0Y00:codex/pe-placed-view-draw
R0Y00:codex/archive-directory-gpu
R0Y00:codex/slot133-dxr-build
R0Y00:codex/materialize-placed-vertex-view
R0Y00:codex/dstorage-directory-offsets
R0Y00:codex/xg-nine-bc-copy
R0Y00:codex/xg-slot10-bc64-arrays
R0Y00:codex/dxr-guest-address-readback
R0Y00:codex/gpu-va-high-bits
R0Y00:codex/clarify-diagnostic-startup-scope
R0Y00:codex/xg-six-levels
R0Y00:codex/typed-derived-blend
R0Y00:codex/english-legal-text-progress
R0Y00:codex/address-bc-4ks
R0Y00:codex/dstorage-bounded-file-read
R0Y00:codex/wide-srv-offsets-menu
R0Y00:codex/startup-memory-srv
R0Y00:codex/bound-view-tail
R0Y00:codex/language-selector-readback
R0Y00:codex/setup-menu-progress
R0Y00:codex/cpu-plane-refresh
R0Y00:codex/startup-ubyte-vertex
R0Y00:codex/presenter-window-selection
R0Y00:codex/startup-uniform-buffer-lane
R0Y00:codex/intro-loop-timing
R0Y00:codex/static-clzero-loops
R0Y00:codex/document-rtx-intro
R0Y00:codex/startup-insertq
R0Y00:codex/nv12-startup-texture
R0Y00:codex/stream-stage-draw
R0Y00:codex/startup-null-uav-format
R0Y00:codex/startup-draw-capture
R0Y00:codex/shorten-windows-checks
R0Y00:codex/dstorage-rfc1950
R0Y00:codex/startup-dump-fence
R0Y00:codex/pr1135-review-base
R0Y00:codex/startup-stream-requests
R0Y00:codex/startup-chroma-view
R0Y00:codex/readme-graphics-pipeline-streams
R0Y00:codex/static-crt-free-tls
R0Y00:codex/arc-140t-rtx-5080-laptop-gpu-reports
R0Y00:codex/main-startup-progress-entry
R0Y00:codex/signed-dxil-catalogue
R0Y00:codex/reloc-free-preferred-base
R0Y00:codex/quad-dpp-bit-mask
R0Y00:codex/raw-srv-bounds
R0Y00:codex/rx9070-31044-hardware-report
R0Y00:codex/gpu-page-source-provenance
R0Y00:codex/runtime-placeholder-interior
R0Y00:codex/gpu-copy-queue-tile-order
R0Y00:codex/pe-pin-external-providers
R0Y00:codex/xmem-placeholder-reservations
R0Y00:codex/xmem-shared-physical-pages
R0Y00:codex/pe-package-startup
R0Y00:codex/xmem-tools-memory-query
R0Y00:codex/cpu-stack-output-import
R0Y00:codex/pe-load-security-cookie
R0Y00:codex/record-three-bvh-retests
R0Y00:codex/cpu-rbp-frame-anchor
R0Y00:codex/xmem-default-startup
R0Y00:codex/record-rtx-3050-ti-9597
R0Y00:codex/docs-readme-start-here
R0Y00:codex/check-compute-mad24-truncation
R0Y00:codex/docs-discord-community
R0Y00:codex/bound-rcx-branch-mutants
R0Y00:codex/rtx5060ti-bvh-62114
R0Y00:codex/837-neutral-readme-disclaimer
R0Y00:codex/record-rtx-3070-ti
R0Y00:codex/title-neutral-public-wording
R0Y00:codex/exe-shadow-frame-submissions
R0Y00:codex/exe-shadow-runtime-chain
R0Y00:codex/readme-polish
R0Y00:codex/gpu-coverage-nov23
R0Y00:codex/spirv-minlod
R0Y00:codex/shadow-shim-device
R0Y00:codex/exe-two-shadow-frames
R0Y00:codex/shim-dispatch-cleanup
R0Y00:codex/fix-spirv-cache-probe
R0Y00:codex/sampler-use
R0Y00:codex/ballot-bit-extract
R0Y00:codex/packed-fma-release
R0Y00:codex/cpu-packed-fma-o2
R0Y00:codex/publish-coverage-dashboard
R0Y00:codex/mesh-cbv-binding-order
R0Y00:codex/spirv-window-fixture
R0Y00:codex/ps-e32-float-uint
R0Y00:codex/ps-cbuffer-reads
R0Y00:codex/fixed-profile-rescan
R0Y00:codex/shim-compute-integration
R0Y00:codex/readme-visible-coverage
R0Y00:codex/readme-research-navigation
R0Y00:codex/integrate-pr-256
R0Y00:codex/indexed-mesh
R0Y00:codex/sampled-coverage
R0Y00:codex/first-ms
R0Y00:codex/dual-ps
R0Y00:codex/ps-attribute
R0Y00:codex/compute-first
R0Y00:codex/ps-export
R0Y00:codex/readme-research-status
R0Y00:codex/ps-layout
R0Y00:codex/blast-window
R0Y00:codex/chart-caption
R0Y00:codex/reviewer-roles
R0Y00:codex/blast-aot
R0Y00:codex/archive-program
R0Y00:codex/crc-stream-program
R0Y00:codex/exe-image-data-chain
R0Y00:codex/local-cpu-fixture-coverage
R0Y00:codex/exe-bound-frame-chain
R0Y00:codex/exe-mapped-comparison
R0Y00:codex/contribution-dependencies
R0Y00:codex/exe-entry-aot
R0Y00:codex/bink-frame-heap-integration
R0Y00:docs/hardware-seven-reports
R0Y00:codex/bink-custom-heap
R0Y00:codex/bink-heap-callers
R0Y00:codex/discussions-entry-points
R0Y00:codex/gpu-community-batch-64
R0Y00:codex/ffx-scratch-writers
R0Y00:codex/generic-project-documentation
R0Y00:codex/ffx-dispatch-rcas
R0Y00:codex/four-windows-gpu-reports
R0Y00:codex/title-neutral-project-wording
R0Y00:codex/community-coverage-provenance
R0Y00:codex/rcas-packed-texels
R0Y00:codex/community-gpu-retests
R0Y00:codex/community-build-and-gpu-reports
R0Y00:codex/ffx-provider-loop
R0Y00:codex/ffx-recurrent-views
R0Y00:codex/ffx-recurrent-resource
R0Y00:codex/amd-wave64-reports
R0Y00:codex/ffx-backend-slots
R0Y00:codex/upscaler-device-init
R0Y00:codex/ffx-context-lifecycle
R0Y00:codex/ffx-version-query
R0Y00:codex/ffx-provider-contract
R0Y00:codex/typed-object-callback
R0Y00:codex/cpu-ordinal-import
R0Y00:codex/chained-cpu-ranges
R0Y00:codex/cpu-import-call
R0Y00:codex/cpu-direct-call
R0Y00:codex/cpu-leaf-aot
R0Y00:codex/community-project-status
R0Y00:codex/script-state-path-replay
R0Y00:codex/script-state-evidence
R0Y00:codex/bc7-resident-tail
R0Y00:codex/bcpack-mip-tail
R0Y00:codex/bc7-texture-draw
R0Y00:codex/asset-ranges
R0Y00:codex/pixel-constants
R0Y00:codex/pixel-aot
R0Y00:codex/pre-exe-workloads
R0Y00:codex/root-signature-device-coverage
R0Y00:engineering/packed-bvh-leaves
R0Y00:engineering/bvh-build-and-update
R0Y00:engineering/intake-root-roundtrip
R0Y00:community/gpu-check-release
R0Y00:community/english-contributor-entry
No reviewers
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Reference
R0Y00/Xbox2Windows!3097
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3097"
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 lukaslw-lab on 2026-11-27T15:03:51Z.
Change
Fixes #3096 (every view call asks
VirtualQueryand xmem's commit mutex before writing its token).X2W_D3D12_VIEW_TOKEN_GUARDED=1(opt-in):note_viewwrites the view token into the title's descriptor memory under an exception guard (write_view_token) instead of aftercommit_lazyand aVirtualQuery(x2w_local::writable). Unset, the check and the write are as onmain.writablereturning false did. A guard page has its guard bit set again, asprobe_readabledoes.title_backedis checked first). So this does not go against #2845, which asks to query first for reads of stale pointers, where faults are common.x2w_d3d12_view_token_writes(written, refused), and with the switch set a line before the render totals:x2w-render view tokens (X2W_D3D12_VIEW_TOKEN_GUARDED): written N, refused M.docs/startup-runtime.md;docs/experiments/startup-view-token-guarded.md.mainca659396): no new conflict withcpp-migrationor with any of the open PRs that touch these files.Verification
Windows 10 22H2, i7-4790K, RTX 3080 Ti (NVIDIA 32.0.16.1047) and WARP; dev and release; commit
cff24b08(mainca659396merged).startup_view_token_{unset,set}_{warp,hardware}: 4/4 per preset. Three descriptor heaps over title memory the fixture owns, protected after creation (writable, read-only, guard page). In both modes the writable heap holds both tokens, the read-only heap stays zero, and the guard page keeps its guard bit and stays zero. The export reports unset0, 0, set2, 2.the guarded path did not write 2 tokens and refuse 2; not setting the guard bit again failsthe guard page lost its guard bit.startup_logical_view_warpandstartup_root_heap_{warp,hardware}(no debug layer), the same in every run.Startup run of the main executable (#870), release on
main36d2cbeb, warm shader cache, scripted input, 250 s, the three merged switches in every run, two pairs (second in reverse order):buffer; device removaltokenper 1,000 translated drawsA confirmation run with the switch set logged
written 16447410, refused 0: the guard refused no write, so the tokens are the ones the default path writes. Thetokennull bindings scale with the draws recorded; runs without this change gave 23–34 per 1,000 translated draws on this machine. Not covered: other adapters, hosts with more cores, Wine.AI-assisted: the change, tests and this description were written with Claude; I ran the startup comparison.
🤖 Generated with Claude Code
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-27T15:23:40Z.
Review: CHANGES_REQUESTED
The guarded path changes page protections and can write a partial token when a 32-byte descriptor spans a page boundary. The registered-range check only bounds the span, and
device_heapaccepts caller-supplied backing without an alignment check. A handle at the first descriptor of such a heap can therefore cross a page even when its offset inside the heap is aligned.I compiled the exact
write_view_tokenfromcff24b08in a source-built x64 probe with two committed pages, placing the destination 16 bytes before the boundary. With the right pagePAGE_READWRITE | PAGE_GUARD, the helper returned false but setPAGE_GUARDon both pages. With the right pagePAGE_READONLY, it returned false after changing the writable prefix. Both happened under/Odand/O2. The originalwritablerange check refused that span before writing. Please route page-crossing tokens through the existing full-span check and add a caller-backed boundary fixture that verifies the writable prefix and both page protections stay unchanged on refusal.Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-11-27T16:01:20Z.
Thanks, confirmed. The fixture had only page-aligned heaps, so it never produced a token that crosses a page.
Fixed in
69befbc8: only a token that lies inside one 4 KiB page takes the guarded write (view_token_in_one_pagein
note_view). A token that crosses a page boundary keeps the full-spanwritable()check, with or without theswitch. Inside one page, a refusal comes on the first byte, so nothing is written and the guard re-arm touches only
that page.
startup_view_tokennow has two more caller-backed heaps whose base is 16 bytes before a page boundary. The rightpage is
PAGE_READONLYin one andPAGE_READWRITE | PAGE_GUARDin the other. A slot 18 SRV goes into descriptor 0 ofeach. In both modes the 16-byte writable prefix keeps its sentinel bytes, the left page stays
PAGE_READWRITE, theright page keeps its protection, and the right page stays zero.
^startup_view_token_set_warp+set_hardwarefail:a crossing heap's writable prefix changed(read-only right page); left page0x104=PAGE_READWRITE | PAGE_GUARD(guard right page);unsetpassesstartup_logical_view_warp,startup_root_heap_{warp,hardware}as before2, 2insetmode, so the crossing tokens did not go through the guard.token, because 4096 is a multiple of 32 and of 16.
Host: Windows 10 22H2 (19045), RTX 3080 Ti, NVIDIA 32.0.16.1047, and WARP.
Imported from R0Y00/Xbox2Windows. Originally posted by pigalot on 2026-11-27T23:03:58Z.
Review: APPROVED
Independently reviewed
69befbc8integrated overmain4b0350ea(tree490df414). The merge is clean andgit diff --cached --check origin/mainis clean.R0Y00's page-crossing finding (changes requested on
cff24b08). Addressed.note_viewnow takes the guarded write only whenview_token_in_one_page(dest_title, token_bytes)holds. A crossing token keeps the full-spanwritable()check with or without the switch. Inside one page every byte shares one protection, so a refused write faults before any byte lands. The guard re-arm then touches only that page.startup_view_tokenadds the two caller-backed heaps whose base is 16 bytes before a page boundary, with the right pagePAGE_READONLYin one andPAGE_READWRITE | PAGE_GUARDin the other. The test checks the writable prefix, both protections and the right page's contents.What I traced. A guard page clears its guard bit on the first touch, so
info.Protectin the handler is the base protection, and| PAGE_GUARDrestores the original. xmem's vectored handler runs before the__exceptfilter, so a lazily committed page is committed on the first touch as the description says. Without xmem, a reserved page faults and is refused, ascommit_lazypluswritable()refuses it onmain.What I ran. I built
startup_view_token startup_descriptor_heap_type_check startup_descriptor_increment startup_logical_view_table_check startup_single_element_srv_check startup_view_alloc d3d12_xs_shim startup_stream_consumer offscreen_checkindevandrelease, then ran:I ran the second command once with
X2W_D3D12_VIEW_TOKEN_GUARDEDunset and once with it set to1.startup_view_token_{unset,set}_{warp,hardware}: 4/4 per preset, on WARP and on the RTX 5090. Unset reportswritten 0, refused 0and set reportswritten 2, refused 2. The PASS line includes "crossing tokens refused without a write or a protection change"./O2). 27 pass, andstartup_logical_view_warpreports a capability skip (77) in every arm, as in the description.main.Mutants in
src/startup_stubs/d3d12_capture.inl. Each was applied alone,d3d12_xs_shim startup_view_tokenrebuilt indev,startup_view_token_{set,unset}_warprun, and the source restored afterwards (git diff --quietclean).cff24b08condition)a crossing heap's writable prefix changedthe guard page lost its guard bitEXCEPTION_ACCESS_VIOLATIONdropped from the filterException: SegFaultthe writable heap's first descriptor holds no slot 18 tokenview_token_in_one_pagetestsdest + bytesinstead ofdest + bytes - 1Verdict: approve on
69befbc8. R0Y00's changes request oncff24b08still stands, so I am not merging.Environment: NVIDIA GeForce RTX 5090 driver 32.0.16.1088 and WARP 10.0.26100.9818, Windows 11 25H2 build 26200.9974, MSVC 19.52.37029; the debug layer is off (
X2W_D3D12_DEBUG=0in the fixture).CI:
Build and test on Windows,Assemble and translate gfx1013 fixturesandRun platform-independent Python checks on Linuxpass on69befbc8.This reply was AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by JohnConnorNPC on 2026-11-28T07:58:01Z.
Thanks for the update. I did a static review of head
69befbc8, and it looks ready from our side, pending R0Y00's re-review. R0Y00's changes-requested review (oncff24b08) still stands, so R0Y00 needs to re-review or dismiss it before this can merge. Both requested changes are on the head: crossing tokens take the full-span check again (if (view_token_guarded() && view_token_in_one_page(dest_title, token_bytes)), otherwisewritable()and then memcpy), and the caller-backed boundary fixture is in place.git merge-tree --write-tree origin/main <head>against mainc3204a9cis clean (tree 5d2093f4). With the switch unset,note_viewkeeps main'stitle_backed→writable→ memcpy path.view_token_in_one_pageagainst a page-relative reference model (4 page bases including the top of the 64-bit space, sizes 0–64):cases=152064 mismatches=0.gh pr checks 3097shows Windows, gfx1013 and Linuxpass.ctest --preset prran100% tests passed out of 41, but theprname filter matches none of the 4startup_view_token_{unset,set}_{warp,hardware}tests, so CI has not run the new fixture yet.docs_links_check(Checked 149 Markdown files and 672 links.) andbidi_controls_checkboth pass. The docs/startup-runtime.md row links the new page.SHOULD
VirtualQuery(memory[guard])andall_zero(memory[guard], …). A re-arm overinfo.BaseAddress, info.RegionSizewould guard the whole merged 16-page read-write region and still pass every expect (static analysis, not run). An expect that the page after the guard page staysPAGE_READWRITEwould cover it.MEM_RESERVE | MEM_COMMITand loads no xmem.dll. Either add a reserved-page case under xmem, or say in the doc that only the startup run measured this.NIT
// Fixture probe (startup_view_alloc)comment andstruct ViewStoreProbe, so that comment now sits abovex2w_d3d12_view_token_writes.refused 0shows only that the guard refused nothing, not that "the tokens written match the default path".tokennulls per 1,000 draws were also higher with the switch (33.6 / 30.1 vs 25.7 / 23.5), which "scale with the draws recorded" does not explain.VirtualProtectre-arm, another thread's write to that page succeeds wherewritable()would refuse it. Withrefused 0this doesn't matter in practice, but "aswritablereturning false did" doesn't hold under concurrency.Not run: no build, Wine or GPU. This covers static review, the trial merge, the model and the pure-Python docs checks only.
This comment was AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-11-28T08:44:28Z.
Thanks, @JohnConnorNPC. All five are in
88c171b1(with a merge ofmain1f07b2c1):PAGE_READWRITE. Your mutant (re-arm overinfo.BaseAddress,info.RegionSize) failsset_warpandset_hardwarewiththe page after the guard page changed its protection; added to the note's mutant list.startup_view_alloccomment, which sits onViewStoreProbeagain.refused 0shows no token was lost to a refusal, not that every token matches the default path. Thetokennulls are given as within the 23–34 spread of runs without the change, but not explained.write_view_token: between the guard fault and the re-arm, another thread's write goes through wherewritable()would refuse.^startup_view_token_4/4 in dev and release; view-token matrix 121/121 in each of release and dev, switch off and on (3 skips as before:startup_logical_view_warp,startup_root_heap_{warp,hardware}).prpreset's filter doesn't includestartup_view_token_*, so the fixture has only run locally (RTX 3080 Ti + WARP). Happy to add it to the preset if you want it there.AI-assisted (Claude); I ran the tests.
Imported from R0Y00/Xbox2Windows. Originally posted by pigalot on 2026-11-28T10:55:16Z.
Review: APPROVED
Retested
88c171b1integrated overmainec71c290(tree21d59e8f). The merge is clean andgit diff --cached --check origin/mainis clean. This follows my approval on69befbc8, which had no blocking finding.What changed since
69befbc8. The author mergedmain1f07b2c1as39ead69c(no conflict resolution:git show --remerge-diff 39ead69cis empty), then pushed88c171b1. I readgit diff 39ead69c 88c171b1:tests/startup_view_token.cpp: one new expect, that the page after the guard page is stillPAGE_READWRITE.src/startup_stubs/d3d12_capture.inl: comment only (the concurrency caveat onwrite_view_token).src/startup_stubs/d3d12_xs_device.cpp: the export moved above thestartup_view_alloccomment; no code change.docs/experiments/startup-view-token-guarded.md: the lazy-commit, concurrency and null-binding wording.The runtime code is the same as at
69befbc8.note_viewandwrite_view_tokenare unchanged, and the re-arm is stillVirtualProtect(dest, bytes, info.Protect | PAGE_GUARD, &old), which covers one page because the token lies inside one page.R0Y00's page-crossing finding (changes requested on
cff24b08). Still addressed at this head: the crossing-token mutant below failsa crossing heap's writable prefix changed.JohnConnorNPC's points 1 to 5. Each one is in
88c171b1as the author describes. For point 1 I ran the mutant he named (re-arm overinfo.BaseAddress,info.RegionSize): it fails the new expect. With the test file from69befbc8, the same mutant passes, so the new expect is what catches it. Points 2, 4 and 5 are wording, and the new text matches what the code and the fixture do: the fixture commits its memory up front and loads no xmem.dll, so only the startup runs exercise lazy commit.What I ran. I built
startup_view_token d3d12_xs_shim startup_view_alloc startup_descriptor_heap_type_check startup_descriptor_increment startup_logical_view_table_check startup_single_element_srv_check startup_stream_consumer offscreen_checkindevandrelease, then ran:I ran the second command once with
X2W_D3D12_VIEW_TOKEN_GUARDEDunset and once with it set to1.startup_view_token_{unset,set}_{warp,hardware}: 4/4 in Debug and in Release/O2, on WARP and on the RTX 5090. Unset reportswritten 0, refused 0and set reportswritten 2, refused 2.startup_logical_view_warpreports a capability skip (77) in every arm.Mutants in
src/startup_stubs/d3d12_capture.inl. Each was applied alone,d3d12_xs_shim startup_view_tokenrebuilt indev,startup_view_token_{set,unset}_warprun, and the source restored afterwards (git diff --quietclean).Killed (10):
info.BaseAddress,info.RegionSize)the page after the guard page changed its protectionbytes + 0x1000)the page after the guard page changed its protectionthe guard page lost its guard bita crossing heap's writable prefix changedthe guarded path did not write 2 tokens and refuse 2the guarded path ran with the switch unset(unsetarm)the writable heap's first descriptor holds no slot 18 tokenSTATUS_GUARD_PAGE_VIOLATIONdropped from the filterset_warpfailsEXCEPTION_ACCESS_VIOLATIONdropped from the filterset_warpcrashesthe guarded path did not write 2 tokens and refuse 2Survives (1), not blocking:
EXCEPTION_IN_PAGE_ERRORdropped from the filter. The fixture has no page that raises an in-page error, and I don't see a cheap way to build one.Equivalent in outcome (1):
view_token_in_one_pagetestsdest + bytesinstead ofdest + bytes - 1. A token that ends exactly at a page end then takes the full-span check instead of the guarded write; the result is the same.Nit, not blocking. The header comment in
tests/startup_view_token.cppnow has one 196-column line (line 5); the rest of the comment wraps near 120.Verdict: approve on
88c171b1. R0Y00's changes request oncff24b08still stands on the PR, so I am not merging.Environment: NVIDIA GeForce RTX 5090 driver 32.0.16.1088 and WARP, Windows 11 25H2 build 26200.9974, MSVC 19.52.37029, Python 3.12.10.
X2W_TEST_DEBUG_LAYER=1was set for the hardware runs; the view-token fixture itself setsX2W_D3D12_DEBUG=0.CI:
Build and test on Windows,Assemble and translate gfx1013 fixturesandRun platform-independent Python checks on Linuxpass on88c171b1. As JohnConnorNPC noted, theprpreset's filter does not runstartup_view_token_*, so CI has not run the new fixture.This reply was AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-29T00:42:46Z.
@R0Y00 your changes request here is on
cff24b08.69befbc8has both items: a page-crossing token keeps the full-spanwritable()check (view_token_in_one_pageinnote_view), andstartup_view_tokenhas two caller-backed heaps that start 16 bytes before a page boundary (read-only and guard right page).pigalot approved the current head
88c171b1. Could you re-review or dismiss it?Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-11-29T08:45:50Z.
Merged
main(#3377) in6e8ee394. Both PRs changed the token write innote_view: the token is now built firstand, for a freeable view, replaced by its content token (#3377), then written by the guarded write or the
writable()fallback as before. Both PRs' helpers kept. The change againstmainis the reviewed one apart fromtokenno longer beingconst.Release and dev:
startup_view_token_*4/4; slot 17-22 view families 125/125 with the switch unset and set;startup_view_content*5/5 withX2W_D3D12_VIEW_TOKEN_GUARDEDunset and set.Imported from R0Y00/Xbox2Windows. Originally posted by JohnConnorNPC on 2026-11-29T13:18:28Z.
I re-checked head
6e8ee394, your merge ofmainwith #3377, against currentmain(c04e0dd6).git merge-tree --write-tree origin/main 6e8ee394exits 0. All five points from my last comment are in88c171b1, and thenote_viewconflict is resolved correctly.X2W_D3D12_VIEW_TOKEN_GUARDEDunset,note_viewbuilds the token and, for a freeable view, copiescontentover it. It returns whendest_title == dest_desktop || !title_backed(...), and otherwise writes onlyif (x2w_local::writable(...)). That ismain's condition, and nothing follows it innote_view. Building the token before the checks has no side effects.protection(memory[guard] + page) == PAGE_READWRITE, so the whole-region re-arm mutant is pinned. I didn't run it (no Windows here). Your note lists it as failing.refused 0claim are in. The export sits above thestartup_view_alloccomment again.6e8ee394: Windows, gfx1013 and Linux pass (100% tests passed out of 79).git diff --checkis clean, and the diff adds no binary files.No MUST from me.
SHOULD
prpreset.grep -c startup_view_tokenon the Windows job log is still0, so only your machine (RTX 3080 Ti + WARP) has runstartup_view_token_{unset,set}_warp. Adding the two_warptests and thestartup_view_tokentarget would let CI check the guarded path.Merge status: R0Y00's CHANGES_REQUESTED review on
cff24b08is still the review decision. Both of its points are in this head. GitHub blocks the merge until that review is re-done or dismissed.AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-12-01T01:07:26Z.
Closing this for now.
mainfrom 28 Nov, the switch gave +0–3 fps in our startup A/B, within run-to-run noise. The larger cost in that profile wasnote_lockcontention, not the token write itself.mainis 537 commits past this branch's base.d3d12_xs_device.cppalone has +1,081/−142 lines since then, including the content tokens (#3377) that already changed this same token write. A rebase would need new review and new numbers. That review time is better spent on the P0 work.If a later profile shows
note_viewtoken writes as a cost, the branch stays on my fork (runtime/view-token-guarded-write, head6e8ee394) and can be reopened. Issue #3096 has the original reasoning.Thanks to everyone who reviewed it.
Pull request closed