[PR #1828] startup trace: a null transfer names its caller only when the call is proven (OLD-7189, carries #41) #1839

Open
opened 2026-11-26 21:19:08 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1828
Author: @potatoe0100
Created: 11/25/2026
Status: 🔄 Open

Base: main ← Head: carry/old-7189


📝 Commits (4)

  • cd88535 startup trace: a call through a null pointer names its caller
  • 07af9e2 registry: no module lookup for an address in the null page
  • 22effa8 startup trace: a null transfer is attributed to a call only when the call is proven
  • ea67094 startup_trace_test: find the null transfers by their faulting address, not a runs entry

📊 Changes

4 files changed (+170 additions, -5 deletions)

View changed files

📝 runtime/README.md (+1 -1)
📝 runtime/shims/registry.cpp (+4 -1)
📝 runtime/shims/startup_trace.h (+81 -3)
📝 runtime/test/startup_trace_test.cpp (+84 -0)

📄 Description

Claimed in the coordination issue as: OLD-7189 (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7162808978)

What and why

Carries forward old-pr/7189 (draft #41) by @rafaelpssz, rebased on main 0d80bc5df with the author's three commits unchanged in content. An access violation at a null-page address is a fetch fault with nothing to unwind from, so the startup trace now names who got there: null_call_from when the instruction before the top-of-stack frame is an indirect call whose operand, with the fault's registers, is the faulting address, otherwise null_transfer_return (a tail jump). registry skips the module lookup below 0x10000, so a fault at 0 is 0x0 under Wine too. This helps world-start debugging, where null calls show up in the trace.

Rebase notes:

  • runtime/shims/startup_trace.h conflicted with main's register dump (regs), the tls_index0 event and dump_transient_pool. Kept all of main's, put the null-transfer handling after regs (on the same CONTEXT copy, so regs still shows the registers at the fault), and renumbered the example events in the header comment.
  • One extra commit of mine on top: startup_trace_test looked for null transfers with "at":"0x0" anywhere in the line, and main's runs entries also carry "at":"0x0", so the read fault inside the image matched as a fifth null transfer. It now matches "at":"0x0","access".

Supersedes draft #41 (its branch can be deleted once this lands).

Tested

VS 2022 (MSVC 19.44) RelWithDebInfo + Ninja, Vulkan SDK 1.4.363.0.

  • startup_trace_test: 43 checks, 0 failed (9 failed before the test fix above, all from the extra match).
  • Full ctest -j 6: 415 tests, all pass. xmem, xmem_* and xs_proxy_mock failed once while three other builds ran at the same time and pass 3 of 3 on their own.

GPUs tested: NVIDIA GeForce RTX 4060, driver 621.14, Windows 11 Pro 26H2 (build 26300)

AI-assisted: yes (Claude Code), by a non-developer tester.

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change)

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/1828 **Author:** [@potatoe0100](https://github.com/potatoe0100) **Created:** 11/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `carry/old-7189` --- ### 📝 Commits (4) - [`cd88535`](https://github.com/ubiquitarianism/leonida/commit/cd885359ffb4089e8833318d2f92e283417114dd) startup trace: a call through a null pointer names its caller - [`07af9e2`](https://github.com/ubiquitarianism/leonida/commit/07af9e221115a4b8f84b34ba34d4efea54b67ef7) registry: no module lookup for an address in the null page - [`22effa8`](https://github.com/ubiquitarianism/leonida/commit/22effa8dafc7a9cf984d28b0bc7813ab36acc74f) startup trace: a null transfer is attributed to a call only when the call is proven - [`ea67094`](https://github.com/ubiquitarianism/leonida/commit/ea67094294dac05fb112ad408a94d60f9ec0abb4) startup_trace_test: find the null transfers by their faulting address, not a runs entry ### 📊 Changes **4 files changed** (+170 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `runtime/README.md` (+1 -1) 📝 `runtime/shims/registry.cpp` (+4 -1) 📝 `runtime/shims/startup_trace.h` (+81 -3) 📝 `runtime/test/startup_trace_test.cpp` (+84 -0) </details> ### 📄 Description Claimed in the coordination issue as: OLD-7189 (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7162808978) ### What and why Carries forward `old-pr/7189` (draft #41) by @rafaelpssz, rebased on `main` `0d80bc5df` with the author's three commits unchanged in content. An access violation at a null-page address is a fetch fault with nothing to unwind from, so the startup trace now names who got there: `null_call_from` when the instruction before the top-of-stack frame is an indirect call whose operand, with the fault's registers, is the faulting address, otherwise `null_transfer_return` (a tail jump). `registry` skips the module lookup below 0x10000, so a fault at 0 is `0x0` under Wine too. This helps world-start debugging, where null calls show up in the trace. Rebase notes: - `runtime/shims/startup_trace.h` conflicted with `main`'s register dump (`regs`), the `tls_index0` event and `dump_transient_pool`. Kept all of `main`'s, put the null-transfer handling after `regs` (on the same `CONTEXT` copy, so `regs` still shows the registers at the fault), and renumbered the example events in the header comment. - One extra commit of mine on top: `startup_trace_test` looked for null transfers with `"at":"0x0"` anywhere in the line, and `main`'s `runs` entries also carry `"at":"0x0"`, so the read fault inside the image matched as a fifth null transfer. It now matches `"at":"0x0","access"`. Supersedes draft #41 (its branch can be deleted once this lands). ### Tested VS 2022 (MSVC 19.44) RelWithDebInfo + Ninja, Vulkan SDK 1.4.363.0. - `startup_trace_test`: 43 checks, 0 failed (9 failed before the test fix above, all from the extra match). - Full `ctest -j 6`: 415 tests, all pass. `xmem`, `xmem_*` and `xs_proxy_mock` failed once while three other builds ran at the same time and pass 3 of 3 on their own. GPUs tested: NVIDIA GeForce RTX 4060, driver 621.14, Windows 11 Pro 26H2 (build 26300) AI-assisted: yes (Claude Code), by a non-developer tester. ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [x] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: no translator change) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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.

Dependencies

No dependencies set

Reference
starred/leonida#1839
No description provided.