startup-runtime: null read after the user privilege queries (about 75 s) #1160
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows#1160
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@rasptum on GitHub · 2026-11-24 02:04 UTC · original
Problem
With
tools/startup/run.ps1 -Render -FakeUser -GpuMirror -ContinueAsserts 5000on an NVIDIA GeForce RTX 3060 (driver 32.0.15.9636, Windows 10 22H2 19045.6466, debug layer off), one console executable stops at 74.2 s and again at 75.1 s (two runs, same instruction) with a second-chance access violation inside the executable: a read at address 0x68 through an object whose first pointer is null.What precedes it in both runs, from
stderr.txtandfiles.txt:0x0byX2W_FAKE_USER;QueryApiImplcalls for a second provider (answered0x0);The run in #1135 (RDNA4, Windows 11) reached its 150 s timeout, so this may depend on timing, on an answer that leaves an output argument unset, or on the two local changes needed to get this far here (drive mapping and a capped view heap, see the linked issues).
Where to start
S_OKwith an untouched out-pointer is the first suspect.X2W_TRAP_DUMPon the faulting object and--stop-first-chance 1give the caller chain.Done when
The call whose answer leaves the null pointer is identified and answered, or the cause is shown to be outside the runtime proxy and split into a narrower issue.
Context:
docs/startup-runtime.md(#1135). Do not attach game files, dumps or logs that contain addresses or names from an executable; describe results in terms of the component tested.AI-assisted (Claude Code).
@rasptum on GitHub · 2026-11-24 02:04 UTC · original
Claiming this. First step is logging the output arguments of the user-interface calls that precede the fault and getting the caller chain with
--stop-first-chance 1. I will post the answer that leaves the pointer unset, or narrow the issue if the cause is elsewhere.AI-assisted (Claude Code).
@triggered02 on GitHub · 2026-11-24 05:26 UTC · original
A second adapter reaches a null object in the same phase, at a different offset — possibly a second instance rather than the same one.
Measured with
tools/startup/run.ps1 -Render -FakeUser -GpuMirror -ContinueAsserts 1000 -InputScript 4@70on main at857d9731: NVIDIA GeForce GTX 1660 SUPER (driver 32.0.16.1074), Windows 11 build 26200, release build of the stand-ins. Two runs from a cold start stopped at the same instruction at 82.7 s and 86.9 s.What precedes it matches the sequence you describe: the save service is created, the gaming-runtime user-interface calls (method 19 once, then method 20 with small ids) are answered by
X2W_FAKE_USER, a second provider'sQueryApiImplcalls are answered, and the offline mode refuses socket opens. Then the executable reads through a null object.Our stop is a read at 0x10, not 0x68: a predicate test on a flags byte at offset 0x10 of an object whose pointer is null. The pointer arrives with no desktop call failing — I added a hook that logs every failed HRESULT returned through the device stand-in's forwarding paths (the per-slot probes stop after their first few calls, so a late failure was invisible), and in a full 90-second run the only forwarded call that failed was
CreateCommandSignature, which the stand-in already turns into a placeholder and which is not on this path.The null instead comes from inside the executable: a factory routine returns NULL after its own internal check fails, and its caller passes that NULL straight to the routine that then asserts (the run steps over the assert as a soft assert and faults on the second-chance pass). So the first suspect is whatever the factory is waiting for — consistent with your "an
S_OKwith an untouched out-pointer" hypothesis, but one step further back: something the factory queries returned a value it treats as "not ready" rather than an outright failure.Two details that may help distinguish adapters: with the view-heap fallback of #1159 and
s_setpriotreated as a hint (#1241) the run presents 1,852 frames at 28.5 fps with 5,378 translated draws and 4/4 pipelines before it stops, so this is not a translation or descriptor problem. Andtextures uploaded 0in the render totals at the same time, which suggests the texture-upload path never runs before this stop; whether that is a cause or another consequence of the same missing state is not established.An unrelated observation from the same runs, in case it matters to #1147 or #1160:
X2W_FAKE_USERanswers every user-interface method with0x0, including methods where the desktop expects the out-argument filled. That is exactly the shape you flagged, and our runs cannot tell whether the factory above is reading one of those unfilled outputs.@rasptum on GitHub · 2026-11-24 06:16 UTC · original
Progress, and a correction to this issue's framing: on Windows 10 the null read is not caused by the user privilege queries. They just precede it.
Cause, measured on the RTX 3060 / Windows 10 19045 setup above:
CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED | SAMPLER_HEAP_DIRECTLY_INDEXED(0xC00).D3D12SerializeVersionedRootSignature(reached through thed3d12_xsstand-in) returnsE_INVALIDARG.0x68about 75 s in.X2W_D3D12_PERMISSIVE=1), the same run continues past that point to the first-run menus. That's the only change.Fix, two parts, in one commit:
f32b22f2on rasptum/startup/win10-root-flags, on currentmain.0xC00and remembers, per returned blob, which bits it removed.s_load through s10 holding None.PR to follow once I've added a source-built check for the retry.
On the GTX 1660 SUPER report above: Windows 11's runtime accepts these flags, so that stop is probably a second, different cause in the same phase rather than this one.
AI-assisted (Claude Code).
@triggered02 on GitHub · 2026-11-24 07:19 UTC · original
Taking this, since it is the wall every run hits before the loading screen and I have a reproducible setup (offline stand-ins, view-heap clamp on main, 4/4 pipelines translated, run stops at the same instruction every time).
Plan, following the issue's own starting point: log the output arguments of the user-interface methods 19 and 20 and of the second provider's \QueryApiImpl\ calls, so an \S_OK\ with an untouched out-pointer is visible rather than guessed. Then dump the faulting object and walk its callers to name which factory returned NULL, and report whether the missing answer is a privilege value or a provider that never resolves.
One measured fact that narrows this: the stop is not adapter-specific — an RTX 3060 (your report) and a GTX 1660 SUPER (mine) stop at the same place, at ~74 s and ~85 s respectively, with the same 0x10-offset read through a NULL object and no desktop call failing. I will describe results in terms of the components tested and not attach dumps or logs containing executable addresses.
AI-assisted (Claude Code).
@triggered02 on GitHub · 2026-11-24 07:21 UTC · original
Follow-up with one correction to this issue's hypothesis, and a question about which way to take the fix.
Correction: the two user-interface methods this issue suspects do write their outputs. With
X2W_FAKE_USER=1both are implemented and fill the out-arguments:XUserGetAgeGroup) writes3(adult) to its out pointer;XUserCheckPrivilege) writeshas = trueanddeny reason = 0, and returnsS_OK.So "an
S_OKwith an untouched out-pointer" is not what happens on those two paths. Both write, and both were answered that way in every failing run I have. That removes the first suspect and points at whatever the factory gates on downstream of them.What I can see of the mechanism (reported as component behaviour, no addresses attached): the NULL is produced by the executable's own code, not by the runtime. A factory routine returns NULL after an internal boolean check fails; its caller passes that NULL straight into a helper that tests it and takes the soft-assert path, and the fault is a second-chance read through the NULL object when the assert is stepped over. Nothing on the desktop side failed in the same runs — I had every failed HRESULT through the device stand-in's forwarding paths logged, and the only one was
CreateCommandSignature(0x80070057), which is turned into a placeholder and is not on this path.Independent of adapter: RTX 3060 stops at ~74 s, GTX 1660 SUPER at ~85 s, same instruction, same null object, so this is not a timing or GPU quirk. It also survives all the view-heap and pipeline changes (clamp on main, 4/4 pipelines translated, 5,378 translated draws before the stop).
The question: which follow-up do you want, and is this already known?
I have no working x64 disassembler locally, so I would rather instrument the stop than guess at the call target. If you would prefer this stays with you and only wants the measurements, that is fine too — say so and I will stop here rather than open a PR.
The log path also stops before the loading screen, so anything you can tell me about what the factory is expected to have by then shortens this a lot.
@R0Y00 on GitHub · 2026-11-24 07:39 UTC · original
Thanks for confirming both methods write their documented outputs. Please continue with observation first. A small source-built trace of the public stand-in calls, their return codes and whether an output was populated would be useful. On the two affected runs, compare the last successful provider call and the first downstream failure before the assertion. Keep build identifiers and a short call sequence, and leave addresses and raw traces local. If no provider call fails, record that result and keep the factory condition open. The current evidence does not establish a missing privilege or save response.
@triggered02 on GitHub · 2026-11-24 07:47 UTC · original
Observation done, as asked. Short answer: no provider call fails in the whole run, and the last thing before the assertion is a successful-but-not-
S_OKpoll that repeats thousands of times.How the trace was built. An opt-in switch (
X2W_TRACE_API=1) in the proxy dispatch logs one line per provider call: provider id, method slot, return code, whether the answer came from the stand-in or the real runtime, and which of the pointer-shaped arguments was written (compared by snapshotting arguments 1-8 before the call and re-reading after, so a write is seen rather than assumed). It is a small source-built change; I have not opened a PR for it because you asked for observation first — say the word and it goes up.Result over a full run to the assertion (GTX 1660 SUPER, Windows 11 build 26200, 11,478 provider calls):
0x80000000or above). Not one, across every provider.37e56907::slot2returned0x000000015,587 times and37e56907::slot15was answered locally 5,511 times; the last ~20 calls before the stop are that pair alternating. So the assertion is reached immediately after a poll that succeeded withS_FALSE, not after any failure.One hypothesis, explicitly not established: if the factory gates on
hr == S_OK, aS_FALSE(0x00000001) answers "not ready" while still being a success code, which would produce exactly the NULL-returning bool you would expect from the observed NULL. That fits the evidence and no failing call contradicts it, but the trace alone cannot show the comparison.One shape worth naming, also not confirmed: 30 calls answered by the real runtime returned
S_OKwith no sampled argument changed (073b7dcb::slot29,::slot6,::slot3). That is the "success without an output" pattern, but a call with no out-argument among arguments 1-8 cannot be judged by this method, so I am not calling those empty.Caveat on the method:
out=nonemeans none of the pointer-shaped arguments among 1-8 changed. Calls that pass handles and sizes rather than pointers cannot be assessed this way, which is why 5k successful calls showout=noneand it is not itself a finding.Per your instruction: since no provider call fails, I am recording that result and keeping the factory condition open. The question I would like answered to go further: is
37e56907::slot2expected to returnS_FALSEpermanently once its queue is empty, and does the caller treatS_FALSEas success? IfS_FALSEis the gate, the fix is on our side (answerS_OKor the expected item) rather than engine-internal.Addresses and raw traces stayed local; only provider ids, slots, codes and the call sequence are above.
@R0Y00 on GitHub · 2026-11-24 07:57 UTC · original
Thanks for the follow-up. The repeated S_FALSE/S_OK pair narrows the trace, and the return codes alone do not establish which condition causes the null. Please keep the real provider result intact. The next useful evidence is a typed, source-built poll that distinguishes ready with an item, empty/not ready, and failure, plus the documented return and output contract if you can identify the interface. A small optional logging PR is welcome if it records declared outputs only and avoids reading arbitrary pointer-shaped arguments. Keep the factory diagnosis open until a call and the consuming condition can be tied together.
@triggered02 on GitHub · 2026-11-24 08:04 UTC · original
The optional logging PR you welcomed is up: #1324,
X2W_TRACE_API=1, one line per provider call with the return code, whether the answer came from the stand-in or the real runtime, and which declared output argument was written. It reads only the outputs in a small contract table (user add result, id, guest flag, state, gamertag buffer and used count, age group, privilege result and deny reason, connectivity hint); a slot with no declared contract reportsout=?and nothing is read. The real provider result is left intact — nothing overrides or rewrites it.One correction to my previous comment. My "5,555 successes with no sampled argument changed" figure should be withdrawn. With declared outputs, the connectivity hint reports
unchanged3,400 times simply because its four words are constant, so a repeat call leaves identical bytes. "Unchanged" is therefore not evidence that an output was skipped, and that number cannot be read as "anS_OKwith an untouched out-pointer". The new line distinguishes the cases per call instead of leaving it to be inferred.Interface identification, which you asked for: the poll pair is provider
37e56907-2f10-41e8-b72f-36edb185331a, interfacebf2346b2-39af-4658-b5ea-44713c7e83b3.none, cost unknown,initializedset — the "stack initialized, no connectivity" answer already in the code.S_FALSE(0x00000001) there — 5,587 times in the last run, immediately before the assertion.So the typed poll you asked for is the next step and the trace now gives it what it needs: a fixture that asks this interface for connectivity and distinguishes ready-with-item / empty-not-ready / failure, comparing what the real runtime returns for slot 2 against what our hint claims for slot 15.
What I still cannot state from the code is what slot 2 is meant to mean. If you can name the interface method, I will pin the documented return and output values into the fixture rather than inferring them from the code, which is the difference between "we saw S_FALSE" and "S_FALSE here means X".
Keeping the factory diagnosis open, as instructed: the trace ties the last call before the assertion to a
S_FALSEpoll, but has not tied that call to the consuming condition inside the factory.@triggered02 on GitHub · 2026-11-24 08:30 UTC · original
One experiment on the gate, since it is cheap and it changed the number: reporting full internet connectivity instead of "none" (level 3 in the hint words, everything else unchanged) moved the stop from 84-86 s to 106.36 s, at the same instruction, with the same NULL object and the same
0x10read.So connectivity state is a factor in how fast the run gets there, but it is not the gate: the assertion still fires, just later. That fits the S_FALSE poll loop being a wait rather than the trigger, and it means answering "connected" alone will not get past this.
I have reverted the experiment; nothing is committed. If it is useful I can keep it as a switch (for example
X2W_CONNECTIVITY=none|local|internet) so the two timings stay comparable across runs, but I did not want to add a knob with no confirmed meaning.@R0Y00 on GitHub · 2026-11-24 08:44 UTC · original
Thanks for reverting the timing experiment. The same failure at a later time is useful evidence. Please keep the connectivity override out of the diagnostic PR. Once the typed trace is available, prioritize the return that feeds the null-consuming branch and record its expected success/failure and output contract in a source-built control. A poll-loop frequency or a changed startup time alone cannot identify that producer.
@triggered02 on GitHub · 2026-11-24 09:08 UTC · original
Before building the typed trace, an observation that changes this issue's premise: the null-consuming branch no longer fires on current main.
On
c4966c64(which includes#1294 gpu/startup-slot57-blend-hookup) the title now runs past the old stop repeatedly:fac6a522)+0x6eb759after 84–86 s, NULL object,0x10readAnd it is not merely surviving: the flow now reaches the UI.
ACCOUNT PICKER→CONTINUE→UI TEXT SIZE→NAVIGATION EXPERIENCE→LEGAL NOTICES, with correct text rendering (the blend hookup in #1294 is what fixed the glyphs), navigable with A. So the factory that returned NULL either has been fixed or is no longer reached, and theS_FALSEconnectivity poll pair that preceded it is not followed by the assertion any more.Two points for the plan you set:
c4966c64" until someone sees it again.I would rather flag that than build a fixture that exercises a branch the current build never takes.