runtime: check that adjacent title ranges pack for the shader lookup #1533
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1540"
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 Asimmimx on 2026-11-24T13:47:38Z.
Change
era_title_va::shader_ranges(src/era_title_va.{h,cpp}) packs aTable's ranges into the words the shader-side title lookup reads. It refuses ranges that are unsorted or overlap. Adjacent ranges are valid:Table::addaccepts them, andera_title_gpu::shader_viewpackstable.ranges().No device-free test packs two adjacent ranges. A mutant that turns the overlap check
ranges[i - 1].title_end > range.title_begininto>=left all fourera_title_va_*tests passing; that mutant also rejects adjacent ranges. Onlygpu_alias_lookup_warp,gpu_alias_lookup_writes_warpandgpu_alias_registry_warpfailed, and only because Windows placed their allocations next to each other.docs/experiments.mdnotes that placement varies, and those tests skip (77) without existing-heap support.This adds a hand-worked case to the existing
era_title_va_shaderscenario. Two adjacent ranges,[0xffff'f000, 0x1'0000'0000)and[0x1'0000'0000, 0x1'0000'1000), which also meet on the 4 GiB line, must pack to{0xfffff000, 0, 0, 1, slot 0, reserved 0}and{0, 1, 0x1000, 1, slot 1, reserved 0}.Only
tests/era_title_va_check.cppand one sentence in theera_title_va_shaderrow ofdocs/experiments.mdchange. There is no new CTest.Verification
Commit
309cfede(main) plus this change,devpreset (Debug), Windows 11 Pro build 26300.9974, MSVC 19.51.36260, Windows SDK 10.0.26100.0, WARP 10.0.26100.9818.These 12 tests passed with no skips, at baseline and after the change:
era_title_va_{translate,bounds,registry,shader}era_title_gpu_allocgpu_alias_warp,gpu_alias_window_warp,gpu_alias_lookup_warp,gpu_alias_lookup_writes_warpandgpu_alias_registry_warpdxr_address_ranges_warpanddxr_placed_build_warptests/docs_links_check.py,tests/bidi_controls_check.pyandgit diff --checkpassed.Mutation probe
I applied each mutation to
src/era_title_va.{h,cpp}alone, rebuilt, ran the 12 tests, then reverted. None of this is committed.translatedrops the offset>→>=)& 3→& 7ranges[0]reservedset to the slot indexnext->first < title_end→<=last >= title_end→>>=→>Two survivors are left alone on purpose. The ranges that reach
shader_rangescome fromTable::ranges(), which are always page-aligned, sorted and disjoint, so no real caller can observe the 8-byte-alignment or the first-range overlap fault. If you want the documented 4-byte start rule pinned anyway, for example a start of0x10004being accepted, I can add that case.Checklist
AI-assisted (Claude Code).