runtime: report the memory region for a traced access violation (RT-STARTUP-TRACE) #1096

Closed
Moriz82 wants to merge 1 commit from upstream-pr/1096 into main
Moriz82 commented 2026-11-24 18:21:16 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Moriz82 on 2026-11-24T18:21:16Z.


Claimed in the coordination issue as: RT-STARTUP-TRACE (claim).

Part of the split of #984 into small pull requests.

Depends on: none
Overlaps: #984 (integration source). #41 adds caller information for a null target. #638 handles breakpoint skipping. Neither records the faulting address's memory region.

What and why

The opt-in startup trace records the address and operation of an access violation. Those fields alone cannot distinguish an unallocated range from a committed read-only page or a mapped view. When VirtualQuery succeeds, the exception event now includes the region base, allocation base, size, state, protection and type. A failed query leaves the rest of the event available. The handler continues exception processing as before.

Startup tracing remains off by default. Enable it with gta6rt --trace FILE.

Tested

Cross-built with clang-cl 23 and the xwin SDK. Ran the synthetic exception fixture under Proton Experimental (Wine 11) on CachyOS Linux 7.3, Ryzen 5 5600X and 16 GB RAM.

cmake --build runtime/build/boot --target gta6rt startup_trace_test -j6
ctest --test-dir runtime/build/boot -j1 -R '^startup_trace$' --output-on-failure
python3 -I scripts/check_no_game_data.py runtime/shims/startup_trace.h runtime/test/startup_trace_test.cpp
git diff --check
  • Base 3aa975421 with the new assertion passed 26/27 checks. The trace lacked the faulting page's region.
  • Child passed 27/27 checks and 1/1 CTest. The synthetic access violation reported free memory. The test also checks the access kind, exception location and stack.
  • Native Windows and AMD/Intel GPU runs were not performed.

GPUs tested: none. The fixture exercises CPU memory and exception tracing.
AI-assisted: yes

Checklist

  • Based on current upstream main at the cut. Merge check passed against the subsequently fetched main.
  • One topic with a synthetic regression test.
  • Content guard and whitespace check passed.
  • No translator rule changed.

🤖 Generated with Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5477898640 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1096). Originally posted by [Moriz82](https://github.com/Moriz82) on 2026-11-24T18:21:16Z. --- Claimed in the coordination issue as: RT-STARTUP-TRACE ([claim](https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7140523327)). Part of the split of #984 into small pull requests. Depends on: none Overlaps: #984 (integration source). #41 adds caller information for a null target. #638 handles breakpoint skipping. Neither records the faulting address's memory region. ### What and why The opt-in startup trace records the address and operation of an access violation. Those fields alone cannot distinguish an unallocated range from a committed read-only page or a mapped view. When `VirtualQuery` succeeds, the exception event now includes the region base, allocation base, size, state, protection and type. A failed query leaves the rest of the event available. The handler continues exception processing as before. Startup tracing remains off by default. Enable it with `gta6rt --trace FILE`. ### Tested Cross-built with clang-cl 23 and the xwin SDK. Ran the synthetic exception fixture under Proton Experimental (Wine 11) on CachyOS Linux 7.3, Ryzen 5 5600X and 16 GB RAM. ```sh cmake --build runtime/build/boot --target gta6rt startup_trace_test -j6 ctest --test-dir runtime/build/boot -j1 -R '^startup_trace$' --output-on-failure python3 -I scripts/check_no_game_data.py runtime/shims/startup_trace.h runtime/test/startup_trace_test.cpp git diff --check ``` - Base `3aa975421` with the new assertion passed 26/27 checks. The trace lacked the faulting page's region. - Child passed 27/27 checks and 1/1 CTest. The synthetic access violation reported free memory. The test also checks the access kind, exception location and stack. - Native Windows and AMD/Intel GPU runs were not performed. GPUs tested: none. The fixture exercises CPU memory and exception tracing. AI-assisted: yes ### Checklist - [x] Based on current upstream main at the cut. Merge check passed against the subsequently fetched main. - [x] One topic with a synthetic regression test. - [x] Content guard and whitespace check passed. - [x] No translator rule changed. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Plaaasma commented 2026-11-24 18:38:16 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Plaaasma on 2026-11-24T18:38:16Z.


Native Windows check, AI-assisted (Claude Code). Windows 11, i9-13900K, 64 GB, RTX 4070 Ti 12 GB (NVIDIA 630.20), MSVC 2022 (VS 17 generator, Release), Vulkan.

Head 51868dfbe. Built startup_trace_test, then ctest -C Release -R "^startup_trace" --output-on-failure --timeout 300:

  • startup_trace: passed, 0.14 s (27 check(s), 0 failed)

1 passed, 0 failed.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7140924728 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1096#issuecomment-7140924728). Originally posted by [Plaaasma](https://github.com/Plaaasma) on 2026-11-24T18:38:16Z. --- Native Windows check, AI-assisted (Claude Code). Windows 11, i9-13900K, 64 GB, RTX 4070 Ti 12 GB (NVIDIA 630.20), MSVC 2022 (VS 17 generator, Release), Vulkan. Head `51868dfbe`. Built `startup_trace_test`, then `ctest -C Release -R "^startup_trace" --output-on-failure --timeout 300`: - `startup_trace`: **passed**, 0.14 s (`27 check(s), 0 failed`) 1 passed, 0 failed.
abnalstlll-byte commented 2026-11-24 18:41:21 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-24T18:41:21Z.

Review: APPROVED


Audited and verified. Enriches access violation diagnostic logging in
untime/shims/startup_trace.h with VirtualQuery memory region details (ase, llocation_base, size, state, protect, ype). Verified in
untime/test/startup_trace_test.cpp. Clean-room compliant. Approved.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6045221959 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1096#pullrequestreview-6045221959). Originally posted by [abnalstlll-byte](https://github.com/abnalstlll-byte) on 2026-11-24T18:41:21Z. **Review:** APPROVED --- Audited and verified. Enriches access violation diagnostic logging in untime/shims/startup_trace.h with VirtualQuery memory region details (ase, llocation_base, size, state, protect, ype). Verified in untime/test/startup_trace_test.cpp. Clean-room compliant. Approved.
abnalstlll-byte commented 2026-11-24 18:51:06 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-24T18:51:06Z.

Review: APPROVED


Clean-Room Audit — PR #1096 (RT-STARTUP-TRACE Access Violation Region Info)

Very helpful diagnostic improvement in runtime/shims/startup_trace.h: logging VirtualQuery region metadata (base, allocation_base, size, state, protect, type) on access violations makes unmapped/guard/free-memory stops immediately diagnosable. Cleanly verified in runtime/test/startup_trace_test.cpp; 0 game data.

Verdict: APPROVED

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6045356456 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1096#pullrequestreview-6045356456). Originally posted by [abnalstlll-byte](https://github.com/abnalstlll-byte) on 2026-11-24T18:51:06Z. **Review:** APPROVED --- ### Clean-Room Audit — PR #1096 (`RT-STARTUP-TRACE` Access Violation Region Info) Very helpful diagnostic improvement in `runtime/shims/startup_trace.h`: logging `VirtualQuery` region metadata (`base`, `allocation_base`, `size`, `state`, `protect`, `type`) on access violations makes unmapped/guard/free-memory stops immediately diagnosable. Cleanly verified in `runtime/test/startup_trace_test.cpp`; 0 game data. **Verdict: APPROVED**
Deedlyy commented 2026-11-24 20:18:25 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Deedlyy on 2026-11-24T20:18:25Z.


Recommendation: [MERGE]

Reasoning: Adds the VirtualQuery memory region to the opt-in startup trace's access-violation event (+10 lines), part of the #984 split. Diagnostic only, behind an opt-in trace. Verified natively on Windows by Plaaasma (startup_trace passes). CI (label, change-scope, no-game-data and the Runtime jobs) is still queued awaiting maintainer workflow approval, so nothing has run in CI yet; GitHub reports no merge conflict with main. Merge once the queued checks are green.

Impact level: 2/10

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7143339567 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1096#issuecomment-7143339567). Originally posted by [Deedlyy](https://github.com/Deedlyy) on 2026-11-24T20:18:25Z. --- **Recommendation:** [MERGE] **Reasoning:** Adds the `VirtualQuery` memory region to the opt-in startup trace's access-violation event (+10 lines), part of the #984 split. Diagnostic only, behind an opt-in trace. Verified natively on Windows by Plaaasma (`startup_trace` passes). CI (label, change-scope, no-game-data and the Runtime jobs) is still queued awaiting maintainer workflow approval, so nothing has run in CI yet; GitHub reports no merge conflict with `main`. Merge once the queued checks are green. **Impact level:** 2/10
whoalin1 commented 2026-11-24 21:49:26 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by whoalin1 on 2026-11-24T21:49:26Z.


GPU verification (AI-assisted, independent worker on the shared test box) — head 51868dfbe. Note: this PR is based on 3aa975421, not current origin/main (58be9cdf8).

Change is 8 lines in runtime/shims/startup_trace.h (VirtualQuery region info appended to the logged access-violation record) plus one new check in startup_trace_test.cpp.

Host tests (ctest -R 'startup_trace|run_startup', TEMP/TMP pointed at a user-writable dir — agent shells otherwise default to C:\Windows and these tests fail with 0xc0000409, environmental): 2/2 passed — startup_trace (26 checks incl. the new "region" assertion: base 0x0, state MEM_FREE for the null dereference) and run_startup_cmdline.

GPU suite py -3.14 -I scripts/run_gpu_tests.py --build runtime/build on the AMD Radeon iGPU (gfx1035, driver 24.10.24, Vulkan 1.3.280): VK_LOADER_DRIVERS_SELECT=*amd-vulkan* LEONIDA_VK_DEVICE=radeon VK_LOADER_LAYERS_DISABLE=~implicit~ LEONIDA_VK_VALIDATION=1 LEONIDA_PC_TAIL_UBO=1, LLVM_MC=wsl -d Ubuntu -e /usr/lib/llvm-21/bin/llvm-mc → 230/252 passed, 20 skipped, 2 failed: ms_clip and ms_wave_info_s3, byte-identical to the origin/main baseline on this machine — known AMD LLPC issue (#802/#808). 261 shaders translated, 261 pass spirv-val. No validation errors.

Verdict: PASS — low-risk instrumentation; host coverage and a full validated GPU pass show no regressions.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7145435689 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1096#issuecomment-7145435689). Originally posted by [whoalin1](https://github.com/whoalin1) on 2026-11-24T21:49:26Z. --- GPU verification (AI-assisted, independent worker on the shared test box) — head `51868dfbe`. Note: this PR is based on `3aa975421`, not current `origin/main` (`58be9cdf8`). Change is 8 lines in `runtime/shims/startup_trace.h` (VirtualQuery region info appended to the logged access-violation record) plus one new check in `startup_trace_test.cpp`. Host tests (`ctest -R 'startup_trace|run_startup'`, `TEMP`/`TMP` pointed at a user-writable dir — agent shells otherwise default to `C:\Windows` and these tests fail with 0xc0000409, environmental): **2/2 passed** — `startup_trace` (26 checks incl. the new `"region"` assertion: base 0x0, state MEM_FREE for the null dereference) and `run_startup_cmdline`. GPU suite `py -3.14 -I scripts/run_gpu_tests.py --build runtime/build` on the AMD Radeon iGPU (gfx1035, driver 24.10.24, Vulkan 1.3.280): `VK_LOADER_DRIVERS_SELECT=*amd-vulkan* LEONIDA_VK_DEVICE=radeon VK_LOADER_LAYERS_DISABLE=~implicit~ LEONIDA_VK_VALIDATION=1 LEONIDA_PC_TAIL_UBO=1`, `LLVM_MC=wsl -d Ubuntu -e /usr/lib/llvm-21/bin/llvm-mc` → **230/252 passed, 20 skipped, 2 failed**: `ms_clip` and `ms_wave_info_s3`, byte-identical to the `origin/main` baseline on this machine — known AMD LLPC issue (#802/#808). 261 shaders translated, 261 pass spirv-val. No validation errors. Verdict: PASS — low-risk instrumentation; host coverage and a full validated GPU pass show no regressions.
Moriz82 commented 2026-11-25 03:41:08 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Moriz82 on 2026-11-25T03:41:08Z.


Current main already reports the memory region for a traced access violation and includes the same startup-trace test. #984 brought in both. A rebase leaves a single source comment describing that behavior.

For the check alert on 51868df, Runtime, No Game Data, and CI ran zero jobs while waiting for maintainer approval. The label job was cancelled before a runner picked it up. A trial merge against 5129be10 adds just the comment. The trace fields and test are already in #984.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7152147518 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1096#issuecomment-7152147518). Originally posted by [Moriz82](https://github.com/Moriz82) on 2026-11-25T03:41:08Z. --- Current main already reports the memory region for a traced access violation and includes the same startup-trace test. #984 brought in both. A rebase leaves a single source comment describing that behavior. For the check alert on `51868df`, Runtime, No Game Data, and CI ran zero jobs while waiting for maintainer approval. The label job was cancelled before a runner picked it up. A trial merge against `5129be10` adds just the comment. The trace fields and test are already in #984. AI-assisted.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
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
ProjectLeonida/mandy!1096
No description provided.