Analyze server usercmd acceptance and game VM boundaries
Browse files- docs/ASSET_PIPELINE_TODO.md +2 -0
- docs/FINDINGS.md +6 -0
- docs/PROVISIONAL_TODO.md +2 -0
- docs/RESEARCH_LEDGER.md +6 -0
- docs/REVERSE_ENGINEERING_TODO.md +5 -0
- docs/research/README.md +2 -0
- docs/research/USERCMD_ACCEPTANCE.md +52 -0
- docs/research/USERCMD_CALLERS.md +2 -0
- docs/research/usercmd-acceptance.json +0 -0
- scripts/analyze_usercmd_acceptance.py +84 -0
- scripts/test_usercmd_acceptance.py +79 -0
docs/ASSET_PIPELINE_TODO.md
CHANGED
|
@@ -242,3 +242,5 @@ Research progress: [keyed message deltas](research/MESSAGE_DELTA_KEY.md) adds in
|
|
| 242 |
Research progress: [keyed usercmd codecs](research/MESSAGE_USERCMD.md) completes bounded RE-393–395 (time/key dispatch, record fields/narrowing and 204 modeled-tree streams). RE-392/396 retain legal callers, packet baselines/higher-level codecs and actual runtime/platform work; broad networking and rendering milestones remain open.
|
| 243 |
|
| 244 |
Research progress: [usercmd caller/hash/bundle evidence](research/USERCMD_CALLERS.md) completes bounded RE-397–399. RE-396/400 retain state producers, timestamp/VM acceptance, full bundle/netchan/runtime/platform and higher-level codecs; broad game/network/rendering milestones remain open.
|
|
|
|
|
|
|
|
|
| 242 |
Research progress: [keyed usercmd codecs](research/MESSAGE_USERCMD.md) completes bounded RE-393–395 (time/key dispatch, record fields/narrowing and 204 modeled-tree streams). RE-392/396 retain legal callers, packet baselines/higher-level codecs and actual runtime/platform work; broad networking and rendering milestones remain open.
|
| 243 |
|
| 244 |
Research progress: [usercmd caller/hash/bundle evidence](research/USERCMD_CALLERS.md) completes bounded RE-397–399. RE-396/400 retain state producers, timestamp/VM acceptance, full bundle/netchan/runtime/platform and higher-level codecs; broad game/network/rendering milestones remain open.
|
| 245 |
+
|
| 246 |
+
Research progress: [server usercmd acceptance](research/USERCMD_ACCEPTANCE.md) completes bounded RE-401–403. RE-400/404 retain producers/time clamping/QVM effects/full packet/runtime/platform work; game/network/rendering milestones remain open.
|
docs/FINDINGS.md
CHANGED
|
@@ -456,3 +456,9 @@ Bounded qagame paths recover bomb-plant/inactivity correction requests, direct f
|
|
| 456 |
**F-158 — Client usercmd bundles:** native selection caps signed command count at 32, omits commands for count <=0 and gates opcodes 2/3. The 64-record, 24-byte command ring starts from a zero baseline and chains previous commands. Every count 1–32 and ring-wrap fixtures match independent stopped-call formulas. [CALL-002](research/USERCMD_CALLERS.md).
|
| 457 |
|
| 458 |
**F-159 — Server usercmd count and baselines:** signed counts outside 1–32 stop before hash/codec calls; accepted requests use a zero 24-byte baseline then contiguous previous output records. Synthetic supplied codec effects verify the native chain in both engines; timestamp/VM/purity/actual packet behavior remains open. [CALL-003](research/USERCMD_CALLERS.md).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 456 |
**F-158 — Client usercmd bundles:** native selection caps signed command count at 32, omits commands for count <=0 and gates opcodes 2/3. The 64-record, 24-byte command ring starts from a zero baseline and chains previous commands. Every count 1–32 and ring-wrap fixtures match independent stopped-call formulas. [CALL-002](research/USERCMD_CALLERS.md).
|
| 457 |
|
| 458 |
**F-159 — Server usercmd count and baselines:** signed counts outside 1–32 stop before hash/codec calls; accepted requests use a zero 24-byte baseline then contiguous previous output records. Synthetic supplied codec effects verify the native chain in both engines; timestamp/VM/purity/actual packet behavior remains open. [CALL-003](research/USERCMD_CALLERS.md).
|
| 459 |
+
|
| 460 |
+
**F-160 — Post-decode server gates:** supplied purity/client flags and states select stopped game-state, drop-client, enter-world, timestamp-loop or return boundaries. Remaining nonactive paths set client +0x20d28 to 0xffffffff. External effects and field producer semantics remain open. [ACCEPT-001](research/USERCMD_ACCEPTANCE.md).
|
| 461 |
+
|
| 462 |
+
**F-161 — Sequential signed command acceptance:** accepted time must be <= the bundle's final command time and > the stored previous command time; accepted records update all 24 bytes before dispatch. The cap is the final entry, not a computed maximum. Supplied negative/wrap behavior does not establish legal traffic or downstream time clamping. [ACCEPT-002](research/USERCMD_ACCEPTANCE.md).
|
| 463 |
+
|
| 464 |
+
**F-162 — Native command copy and VM boundary:** standalone SV_ClientThink copies 24 bytes in all tested states and requests VM_Call(gvm,7,index) only in state4. Inlined accepted paths agree. Reciprocal arithmetic supports candidate client stride0x2df40 on aligned supplied addresses; allocation and actual callback effects remain unverified. [ACCEPT-003](research/USERCMD_ACCEPTANCE.md).
|
docs/PROVISIONAL_TODO.md
CHANGED
|
@@ -554,3 +554,5 @@ Research progress: [keyed message deltas](research/MESSAGE_DELTA_KEY.md) complet
|
|
| 554 |
Research progress: [keyed usercmd codecs](research/MESSAGE_USERCMD.md) completes bounded RE-393–395 (time/key dispatch, record fields/narrowing and 204 modeled-tree streams). RE-392/396 retain legal callers, packet baselines/higher-level codecs and actual runtime/platform work; broad networking and rendering milestones remain open.
|
| 555 |
|
| 556 |
Research progress: [usercmd caller/hash/bundle evidence](research/USERCMD_CALLERS.md) completes bounded RE-397–399. RE-396/400 retain state producers, timestamp/VM acceptance, full bundle/netchan/runtime/platform and higher-level codecs; broad game/network/rendering milestones remain open.
|
|
|
|
|
|
|
|
|
| 554 |
Research progress: [keyed usercmd codecs](research/MESSAGE_USERCMD.md) completes bounded RE-393–395 (time/key dispatch, record fields/narrowing and 204 modeled-tree streams). RE-392/396 retain legal callers, packet baselines/higher-level codecs and actual runtime/platform work; broad networking and rendering milestones remain open.
|
| 555 |
|
| 556 |
Research progress: [usercmd caller/hash/bundle evidence](research/USERCMD_CALLERS.md) completes bounded RE-397–399. RE-396/400 retain state producers, timestamp/VM acceptance, full bundle/netchan/runtime/platform and higher-level codecs; broad game/network/rendering milestones remain open.
|
| 557 |
+
|
| 558 |
+
Research progress: [server usercmd acceptance](research/USERCMD_ACCEPTANCE.md) completes bounded RE-401–403. RE-400/404 retain producers/time clamping/QVM effects/full packet/runtime/platform work; game/network/rendering milestones remain open.
|
docs/RESEARCH_LEDGER.md
CHANGED
|
@@ -265,3 +265,9 @@ Validation: all preceding composition reports regenerated byte-identically; the
|
|
| 265 |
Completed bounded RE-397–399 with `analyze_usercmd_callers.py`: five verified graphs across both Linux ELF64 engines, 120 evaluated hash probes, 156 server count/key/chain probes, 128 client loop probes, 100 client count/opcode selection probes and six client key derivation probes. CALL-001–003/F-157–159 recover signed-byte weighted hashing and signed shift mixing, 32-byte hash-prefix requests in 128-slot reliable-string rings, full-word XOR keys, client command-count cap/opcode gates, 64-record command ring and server signed 1–32 gate. Client loops generate 2,112 stopped codec requests; server loops generate 1,308. Zero/previous-command baselines are verified by independent address formulas and supplied server child-output byte patterns. Semantic state names and actual producer/time/key domains remain provisional. Hash instructions evaluate supplied memory; caller hash returns and codec child outputs remain explicitly supplied, and client codecs stop at requests. No packet bytes, original process/native callee, netchan/VM/purity or runtime traffic executes. Nine independent tests verify hash arithmetic, server gates/keys/string rings/baseline bytes, every client count and wrapping, count/opcode selection, paired client/server keys and engine outcomes, and verified identities/boundaries. All 407 tests pass; storage, links and whitespace checks pass. RE-396 remains open; RE-400 tracks checksum-feed/acknowledgement/reliable-string producer semantics/sanitation, command generation/server timestamp acceptance/VM dispatch, complete codec/bundle/header/reliability/netchan compositions, real traffic/all-platform validation, entity/player/snapshot and Rust/Bevy/Solari goals.
|
| 266 |
|
| 267 |
Validation: all preceding composition reports regenerated byte-identically; the new caller report reproduced twice byte-identically. Storage policy/filter setup, documentation links and whitespace checks pass.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 265 |
Completed bounded RE-397–399 with `analyze_usercmd_callers.py`: five verified graphs across both Linux ELF64 engines, 120 evaluated hash probes, 156 server count/key/chain probes, 128 client loop probes, 100 client count/opcode selection probes and six client key derivation probes. CALL-001–003/F-157–159 recover signed-byte weighted hashing and signed shift mixing, 32-byte hash-prefix requests in 128-slot reliable-string rings, full-word XOR keys, client command-count cap/opcode gates, 64-record command ring and server signed 1–32 gate. Client loops generate 2,112 stopped codec requests; server loops generate 1,308. Zero/previous-command baselines are verified by independent address formulas and supplied server child-output byte patterns. Semantic state names and actual producer/time/key domains remain provisional. Hash instructions evaluate supplied memory; caller hash returns and codec child outputs remain explicitly supplied, and client codecs stop at requests. No packet bytes, original process/native callee, netchan/VM/purity or runtime traffic executes. Nine independent tests verify hash arithmetic, server gates/keys/string rings/baseline bytes, every client count and wrapping, count/opcode selection, paired client/server keys and engine outcomes, and verified identities/boundaries. All 407 tests pass; storage, links and whitespace checks pass. RE-396 remains open; RE-400 tracks checksum-feed/acknowledgement/reliable-string producer semantics/sanitation, command generation/server timestamp acceptance/VM dispatch, complete codec/bundle/header/reliability/netchan compositions, real traffic/all-platform validation, entity/player/snapshot and Rust/Bevy/Solari goals.
|
| 266 |
|
| 267 |
Validation: all preceding composition reports regenerated byte-identically; the new caller report reproduced twice byte-identically. Storage policy/filter setup, documentation links and whitespace checks pass.
|
| 268 |
+
|
| 269 |
+
## 2026-10-11 — Server usercmd gates, timestamp acceptance and game-VM requests
|
| 270 |
+
|
| 271 |
+
Completed bounded RE-401–403 with `analyze_usercmd_acceptance.py`: four verified graphs across both Linux ELF64 engines, 48 post-decode state/purity gate probes, 184 timestamp-loop probes and 32 standalone SV_ClientThink probes. ACCEPT-001–003/F-160–162 distinguish external game-state/drop/enter-world requests from completed lifecycle effects, final-bundle signed timestamp caps from a computed maximum/server clock, sequential strict-newer filtering from decoder legality, and unconditional standalone 24-byte copies from state4-only VM dispatch. Every ordered command count1–32 and sampled duplicate/descending/unordered/stale/negative/sign-boundary cases match independent accepted-record/final-state oracles. Inlined loops produce 1,370 stopped VM_Call(gvm,7,index) requests; copied records are observed before the boundary. Native reciprocal arithmetic supports candidate stride0x2df40 only on aligned supplied addresses, pending allocation evidence. State/flags/decoded records are supplied; gate helpers stop and VM calls supply return0/retained caller registers with no VM side effects. No original executable/native callee/game VM, packet decode or runtime traffic executes. Eight tests verify gates/sentinel mutation, signed timestamps/all ordered counts, inlined VM arguments/copy order, standalone state behavior, reciprocal/stride arithmetic, canaries/command memory retention, paired outcomes and verified identities. All 415 tests pass; storage, links and whitespace checks pass. RE-400 remains open; RE-404 tracks purity/state producers/client allocation stride, command generation and server/game-side time clamping, selector7 QVM callback/command retrieval/VM mutation effects, complete decoded-bundle acceptance, real packet/runtime/all-platform conformance, higher-level codecs and Rust/Bevy/Solari goals.
|
| 272 |
+
|
| 273 |
+
Validation: all preceding composition reports regenerated byte-identically; the new acceptance report reproduced twice byte-identically. Final suite: 415 passing tests. Storage policy/filter setup, documentation links and whitespace checks pass.
|
docs/REVERSE_ENGINEERING_TODO.md
CHANGED
|
@@ -482,3 +482,8 @@ Purpose: turn the supplied installation into an evidence-backed specification of
|
|
| 482 |
- [x] RE-398 Recover bounded client packet command-count cap/opcode gates, 64-record usercmd ring and zero/previous baselines across every count 1–32 and ring-wrap cases; stop at codec/helper requests. [CALL-002](research/USERCMD_CALLERS.md).
|
| 483 |
- [x] RE-399 Recover bounded server signed 1–32 count gate, key and contiguous zero/previous-command decode chain with explicitly supplied child records. [CALL-003](research/USERCMD_CALLERS.md).
|
| 484 |
- [ ] RE-400 Confirm state-field semantic names and checksum-feed/acknowledgement/reliable-string producers/sanitation; trace command generation and server time acceptance/VM dispatch; compose complete bundles/headers/reliability/netchan/fragments with real codec effects, capture runtime traffic and validate other platforms. Continue entity/player/snapshot codecs and Rust/Bevy/Solari goals.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 482 |
- [x] RE-398 Recover bounded client packet command-count cap/opcode gates, 64-record usercmd ring and zero/previous baselines across every count 1–32 and ring-wrap cases; stop at codec/helper requests. [CALL-002](research/USERCMD_CALLERS.md).
|
| 483 |
- [x] RE-399 Recover bounded server signed 1–32 count gate, key and contiguous zero/previous-command decode chain with explicitly supplied child records. [CALL-003](research/USERCMD_CALLERS.md).
|
| 484 |
- [ ] RE-400 Confirm state-field semantic names and checksum-feed/acknowledgement/reliable-string producers/sanitation; trace command generation and server time acceptance/VM dispatch; compose complete bundles/headers/reliability/netchan/fragments with real codec effects, capture runtime traffic and validate other platforms. Continue entity/player/snapshot codecs and Rust/Bevy/Solari goals.
|
| 485 |
+
|
| 486 |
+
- [x] RE-401 Recover bounded post-decode connection/purity gates, stopped game-state/drop/enter-world requests and delta-state sentinel mutation from both Linux ELF64 engines. [ACCEPT-001](research/USERCMD_ACCEPTANCE.md).
|
| 487 |
+
- [x] RE-402 Recover bounded signed sequential command-time filtering against final-bundle time and stored previous time; verify full accepted records for all ordered counts and duplicate/stale/unordered/negative/boundary fixtures. [ACCEPT-002](research/USERCMD_ACCEPTANCE.md).
|
| 488 |
+
- [x] RE-403 Recover standalone/inlined 24-byte client command copies, state-4-only VM selector7 requests and candidate stride/index arithmetic with independent stopped-boundary checks. [ACCEPT-003](research/USERCMD_ACCEPTANCE.md).
|
| 489 |
+
- [ ] RE-404 Confirm purity/state-field producers and client allocation stride, command generation/server/game time clamping, selector7 QVM callback and command retrieval, VM mutation effects; compose decoded bundles through acceptance and validate real traffic/all-platform behavior before Rust compatibility claims. Continue entity/player/snapshot and rendering work.
|
docs/research/README.md
CHANGED
|
@@ -155,3 +155,5 @@ The extension collector adds five focused tests for native tail calls, command-r
|
|
| 155 |
[Keyed user-command codecs](MESSAGE_USERCMD.md) adds RE-393–395. Reproduce with `python3 scripts/analyze_message_usercmd.py`; check with `python3 scripts/test_message_usercmd.py`. Caller/time/key provenance, packet/entity/player/snapshot and runtime/platform validation remain open.
|
| 156 |
|
| 157 |
[Usercmd caller keys and bundles](USERCMD_CALLERS.md) adds RE-397–399. Reproduce with `python3 scripts/analyze_usercmd_callers.py`; check with `python3 scripts/test_usercmd_callers.py`. Hash instructions are evaluated; caller hash returns and server codec effects are supplied. Full packet/runtime conformance remains open.
|
|
|
|
|
|
|
|
|
| 155 |
[Keyed user-command codecs](MESSAGE_USERCMD.md) adds RE-393–395. Reproduce with `python3 scripts/analyze_message_usercmd.py`; check with `python3 scripts/test_message_usercmd.py`. Caller/time/key provenance, packet/entity/player/snapshot and runtime/platform validation remain open.
|
| 156 |
|
| 157 |
[Usercmd caller keys and bundles](USERCMD_CALLERS.md) adds RE-397–399. Reproduce with `python3 scripts/analyze_usercmd_callers.py`; check with `python3 scripts/test_usercmd_callers.py`. Hash instructions are evaluated; caller hash returns and server codec effects are supplied. Full packet/runtime conformance remains open.
|
| 158 |
+
|
| 159 |
+
[Server usercmd acceptance and VM boundary](USERCMD_ACCEPTANCE.md) adds RE-401–403. Reproduce with `python3 scripts/analyze_usercmd_acceptance.py`; check with `python3 scripts/test_usercmd_acceptance.py`. Supplied state/decoded records and stopped external/VM boundaries do not validate live packets or game simulation.
|
docs/research/USERCMD_ACCEPTANCE.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Server usercmd acceptance and game-VM boundary
|
| 2 |
+
|
| 3 |
+
RE-401–403 / F-160–162. [usercmd-acceptance.json](usercmd-acceptance.json) retains four verified native graphs across the Linux ELF64 engines. Reproduce with `python3 scripts/analyze_usercmd_acceptance.py`; verify with `python3 scripts/test_usercmd_acceptance.py`.
|
| 4 |
+
|
| 5 |
+
This follows [usercmd caller and bundle evidence](USERCMD_CALLERS.md). The script evaluates bounded instructions against supplied server/client state and already-decoded command records. Original processes, native callees and the game VM never run. Gates stop at external calls. Timestamp-loop VM calls have supplied return zero, retained caller registers and **no VM side effects**. Full packet, input generation, callback effects and runtime conformance remain open.
|
| 6 |
+
|
| 7 |
+
## ACCEPT-001 — Post-decode connection and purity gates (RE-401)
|
| 8 |
+
|
| 9 |
+
The inspected gate starts after the decode loop and frame acknowledgement metadata. At client-engine `0x4716e7` / dedicated `0x406d97`, the native path loads `sv_pure` and reads its integer slot at +0x30. Client fields +0x24ed4 and +0x24ed8 are provisionally authentication and received-pure-result flags; producer semantics are not established here.
|
| 10 |
+
|
| 11 |
+
| Supplied condition | Observed stopped boundary |
|
| 12 |
+
| --- | --- |
|
| 13 |
+
| Pure nonzero, +0x24ed4 zero, +0x24ed8 zero, state 4 | Diagnostic then SV_SendClientGameState |
|
| 14 |
+
| Same pure/flag combination, state 2 or 3 | Return without timestamp processing |
|
| 15 |
+
| Above early gate does not apply, state 3 | SV_ClientEnterWorld |
|
| 16 |
+
| After the state-3 branch, pure nonzero and +0x24ed4 zero | SV_DropClient |
|
| 17 |
+
| Remaining state 4 | Timestamp loop |
|
| 18 |
+
| Remaining other tested state | Set client +0x20d28 to 0xffffffff, then return |
|
| 19 |
+
|
| 20 |
+
48 probes (24 per engine) cover states 2/3/4 and all Boolean pure/flag combinations. External calls are not executed. In particular, stopping at SV_ClientEnterWorld does not establish its resulting state, callback effects or the outcome of the subsequent purity recheck. Sending game state or dropping a client is a recorded request, not an action taken by the analysis.
|
| 21 |
+
|
| 22 |
+
The sampled +0x20d28 value starts at 77 and is retained on the other tested boundaries. These findings do not cover the earlier delta-mode argument, packet decoding, count/EOF checks, or complete connection lifecycle.
|
| 23 |
+
|
| 24 |
+
## ACCEPT-002 — Signed time filtering and baseline updates (RE-402)
|
| 25 |
+
|
| 26 |
+
The time slice starts at client-engine `0x4717e4` / dedicated `0x406e94`, after upstream gates, with supplied state 4, count and records. Native signed 32-bit comparisons apply the following rule sequentially:
|
| 27 |
+
|
| 28 |
+
1. Skip a command whose timestamp is greater than the **last command's timestamp in this bundle**.
|
| 29 |
+
2. Skip a command whose timestamp is less than or equal to client +0x2081c, the stored previous command time.
|
| 30 |
+
3. Otherwise copy all 24 command bytes into client +0x2081c, then reach the game-VM boundary when the state remains 4.
|
| 31 |
+
|
| 32 |
+
The stored time advances after each accepted command, so duplicate or older entries are skipped relative to the latest accepted record. The bundle's final timestamp is the cap; it is not a maximum computed over all entries. A descending fixture therefore accepts only its final command. No comparison with a server-clock value is present in this bounded loop; upstream generation and downstream game-side clamping remain open.
|
| 33 |
+
|
| 34 |
+
Per engine, 92 probes cover every ordered count 1–32 and sampled counts 1/2/3/4/5/7/8/16/31/32 for duplicates, descending, unordered, stale, negative and signed-boundary times. Independent sequential signed arithmetic predicts exact records at each VM boundary and the complete final stored record. Each engine produces 685 stopped VM requests. Command memory remains unchanged, and adjacent stored-record canaries remain intact.
|
| 35 |
+
|
| 36 |
+
Negative and sign-boundary probes describe supplied instruction behavior, not legitimate multiplayer timestamps or verified clock wrapping. The earlier short-delta anomaly in [CMD-001](MESSAGE_USERCMD.md) is not declared unreachable or resolved: time generation, codec composition and real traffic must still be traced.
|
| 37 |
+
|
| 38 |
+
## ACCEPT-003 — Standalone copy and VM request contract (RE-403)
|
| 39 |
+
|
| 40 |
+
`SV_ClientThink` entries: dedicated `0x403a16`, client-engine `0x46e366`. This separate native function unconditionally copies three 64-bit words from the supplied command into client +0x2081c/+0x20824/+0x2082c. It requests a tail transfer to `VM_Call` only when client state equals 4; other tested states return after the copy. This is distinct from the upstream timestamp loop's filtering. The same copy and selector operations are inlined in SV_UserMove.
|
| 41 |
+
|
| 42 |
+
The observed VM request has arguments `(gvm, 7, client_index)`. No usercmd pointer is forwarded in these registers. Selector 7 is an observed native boundary; this batch does not execute or fully characterize its QVM callback or the callback's command-retrieval syscall.
|
| 43 |
+
|
| 44 |
+
Index arithmetic subtracts the file-backed `svs+0x10` client-array pointer, arithmetic-shifts the difference by six, then multiplies by 0x352f43fb794105d5 modulo 64 bits. That multiplier is the modular inverse of 0xb7d. Thus **0x2df40 is a candidate client stride**: aligned supplied addresses `base + index*0x2df40` recover indices 0/1/7/63. This is not proof of allocation size, valid maximum clients, arbitrary-pointer division or bounds safety. Array allocation/iteration evidence must confirm the stride independently.
|
| 45 |
+
|
| 46 |
+
32 standalone probes (16 per engine) cover states 0/2/3/4 and those four indices. Native stop locations determine whether a VM request exists; an independent oracle checks that only state 4 dispatches and all states copy the full record. Inlined requests independently recover the same selector/index and show copied bytes already present before the stopped VM call.
|
| 47 |
+
|
| 48 |
+
## Validation and remaining work
|
| 49 |
+
|
| 50 |
+
Eight tests verify connection/purity gates and sentinel mutation, signed sequential timestamps and final-bundle cap, every ordered count, record copy before VM requests, standalone state behavior, reciprocal/stride arithmetic, canaries/source retention, paired engine outcomes and source/disassembly identities. The report records instruction graphs, trace lengths/hashes, complete supplied/accepted records and requested VM arguments.
|
| 51 |
+
|
| 52 |
+
RE-400 remains open for complete producer and packet/runtime work. RE-404 must confirm purity/state-field meanings and client stride through producers/allocation, trace command generation and server/game-side time clamping, connect selector 7 through the QVM callback and command-retrieval syscall, compose actual decoded bundles with acceptance, characterize VM mutation effects and validate real traffic/all-platform behavior. Higher-level entity/player/snapshot codecs, Rust compatibility and Bevy/Solari rendering remain open.
|
docs/research/USERCMD_CALLERS.md
CHANGED
|
@@ -39,3 +39,5 @@ The slice stops before frame acknowledgement metadata, purity/connection-state c
|
|
| 39 |
Nine tests independently verify signed-byte hash arithmetic, server count guards, hash ring/key formulas, server zero/contiguous byte baselines, all client counts/ring wraps, packet count/opcode gates, paired key derivation/outcomes and source identities. Caller request/return boundaries and supplied server output effects remain explicit. No original process, network send, VM call or actual codec callee executes.
|
| 40 |
|
| 41 |
RE-396 remains open for full caller and higher-level validation. RE-400 must trace checksum-feed/acknowledgement/reliable-string producers and sanitation, command generation/time monotonicity, actual server timestamp acceptance/VM dispatch, packet headers/reliable commands/netchan framing and full bundle compositions with the existing codec, then verify captured traffic and other platforms. Entity/player/snapshot codecs, Rust compatibility and Bevy/Solari rendering remain open.
|
|
|
|
|
|
|
|
|
| 39 |
Nine tests independently verify signed-byte hash arithmetic, server count guards, hash ring/key formulas, server zero/contiguous byte baselines, all client counts/ring wraps, packet count/opcode gates, paired key derivation/outcomes and source identities. Caller request/return boundaries and supplied server output effects remain explicit. No original process, network send, VM call or actual codec callee executes.
|
| 40 |
|
| 41 |
RE-396 remains open for full caller and higher-level validation. RE-400 must trace checksum-feed/acknowledgement/reliable-string producers and sanitation, command generation/time monotonicity, actual server timestamp acceptance/VM dispatch, packet headers/reliable commands/netchan framing and full bundle compositions with the existing codec, then verify captured traffic and other platforms. Entity/player/snapshot codecs, Rust compatibility and Bevy/Solari rendering remain open.
|
| 42 |
+
|
| 43 |
+
Follow-up: [server acceptance](USERCMD_ACCEPTANCE.md) recovers bounded post-decode state/purity gates, signed timestamps and native command-copy/VM request boundaries. Producer, decoded-bundle composition, callback effects and runtime validation remain open.
|
docs/research/usercmd-acceptance.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
scripts/analyze_usercmd_acceptance.py
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Bounded server state/time acceptance and stopped game-VM dispatch slices."""
|
| 3 |
+
import itertools
|
| 4 |
+
import gzip
|
| 5 |
+
import json
|
| 6 |
+
from pathlib import Path
|
| 7 |
+
from analyze_bsp_references import global_address,operand,trace_fields
|
| 8 |
+
from analyze_collision_composition import get_word,put_word
|
| 9 |
+
from analyze_engine_control import control_flow
|
| 10 |
+
from analyze_message_widths import run
|
| 11 |
+
from analyze_qvm import write_json
|
| 12 |
+
from analyze_vm_extensions import native_functions,verified
|
| 13 |
+
|
| 14 |
+
FRAME=0x20000
|
| 15 |
+
SOURCE=0x80000
|
| 16 |
+
CLIENT_BASE=0x500000
|
| 17 |
+
CLIENT_STRIDE=0x2df40
|
| 18 |
+
VM=0x90000
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
def vm_memory(graph,m):
|
| 22 |
+
for x in graph['instructions']:
|
| 23 |
+
if '<gvm>' in x['operands']:put_word(m,global_address(x),VM,8)
|
| 24 |
+
if '<svs+0x10>' in x['operands']:put_word(m,global_address(x),CLIENT_BASE,8)
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
def record(time,ordinal):return (time&0xffffffff).to_bytes(4,'little')+bytes((ordinal+j)&255 for j in range(20))
|
| 28 |
+
|
| 29 |
+
def think_probe(g,state,index):
|
| 30 |
+
client=CLIENT_BASE+index*CLIENT_STRIDE;m={};put_word(m,client,state);r=record(1234,17)
|
| 31 |
+
for j,v in enumerate(r):m[SOURCE+j]=v
|
| 32 |
+
for j in range(-1,25):m[client+0x2081c+j]=0xa5
|
| 33 |
+
vm_memory(g,m);ends=[x['address'] for x in g['instructions'] if x['opcode'] in ['rep','retq'] or (x['opcode']=='jmp' and '<VM_Call>' in x['operands'])];t=run(g,g['instructions'][0]['address'],ends,m,{'%rdi':client,'%rsi':SOURCE});boundary=next(x for x in g['instructions'] if x['address']==t['stop']);request=[t['registers'][k] for k in ['rdi','rsi','rdx']] if boundary['opcode']=='jmp' and '<VM_Call>' in boundary['operands'] else None
|
| 34 |
+
return {'state':state,'client_index':index,'source_hex':r.hex(),'stored_hex':bytes(t['memory'][client+0x2081c+j] for j in range(24)).hex(),'canaries':[t['memory'][client+0x2081b],t['memory'][client+0x20834]],'vm_request':request,**trace_fields(t,False)}
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
def gate_probe(g,state,pure,auth,received):
|
| 38 |
+
rows=g['instructions'];start=next(x['address'] for x in rows if x['opcode']=='movq' and '<sv_pure>' in x['operands']);time_start=next(x['address'] for x in rows if x['opcode']=='movl' and operand(x)=='0xc(%rsp), %eax' and x['address']>start);end=next(x['address'] for x in rows if x['opcode']=='movq' and operand(x)=='0x338(%rsp), %rbx');calls={x['address']:i for i,x in enumerate(rows) if x['opcode']=='callq'};m={};cvar=0xa0000;client=CLIENT_BASE;put_word(m,global_address(next(x for x in rows if x['address']==start)),cvar,8);put_word(m,cvar+48,pure);put_word(m,client,state);put_word(m,client+0x24ed4,auth);put_word(m,client+0x24ed8,received);put_word(m,client+0x20d28,77);regs={'%r15':client,'%rsp':FRAME};pc=start;trace=[];requests=[];stop=None
|
| 39 |
+
while True:
|
| 40 |
+
t=run(g,pc,list(calls)+[time_start,end],m,regs);m=t['memory'];regs=t['registers'];trace+=t['trace']
|
| 41 |
+
if t['stop'] in [time_start,end]:stop='time_loop' if t['stop']==time_start else 'return';break
|
| 42 |
+
i=calls[t['stop']];target=rows[i]['operands'];name=target.split('<')[1].split('>')[0];requests.append(name)
|
| 43 |
+
if name=='Com_DPrintf':pass
|
| 44 |
+
elif name in ['SV_DropClient','SV_SendClientGameState','SV_ClientEnterWorld']:stop=name;break
|
| 45 |
+
else:raise ValueError('gate helper '+target)
|
| 46 |
+
pc=rows[i+1]['address']
|
| 47 |
+
return {'state':state,'pure_word':pure,'authentication_word':auth,'received_word':received,'stop':stop,'stopped_calls':requests,'delta_state_word':get_word(m,client+0x20d28),**trace_fields({'trace':trace},False)}
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
def times(count,pattern):
|
| 51 |
+
if pattern=='ordered':return [100+i for i in range(count)],99
|
| 52 |
+
if pattern=='duplicate':return [100]*count,99
|
| 53 |
+
if pattern=='descending':return [200-i for i in range(count)],99
|
| 54 |
+
if pattern=='unordered':return [100+(i*7)%5 for i in range(count)],99
|
| 55 |
+
if pattern=='stale':return [100+i for i in range(count)],100+count
|
| 56 |
+
if pattern=='negative':return [(0xfffffff0+i)&0xffffffff for i in range(count)],0xffffffef
|
| 57 |
+
return [[0x7ffffffe,0x7fffffff,0x80000000,1][i%4] for i in range(count)],0xffffffff
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
def time_probe(g,count,pattern,index):
|
| 61 |
+
rows=g['instructions'];start=next(x['address'] for x in rows if x['opcode']=='movl' and operand(x)=='0xc(%rsp), %eax' and x['address']>next(x['address'] for x in rows if x['opcode']=='movq' and '<sv_pure>' in x['operands']));end=next(x['address'] for x in rows if x['opcode']=='movq' and operand(x)=='0x338(%rsp), %rbx');calls={x['address']:i for i,x in enumerate(rows) if x['opcode']=='callq'};client=CLIENT_BASE+index*CLIENT_STRIDE;ts,old=times(count,pattern);baseline=record(old,0xa0);records=[record(t,i+1) for i,t in enumerate(ts)];m={};put_word(m,client,4);put_word(m,FRAME+12,count)
|
| 62 |
+
for j,v in enumerate(baseline):m[client+0x2081c+j]=v
|
| 63 |
+
m[client+0x2081b]=m[client+0x20834]=0x7b
|
| 64 |
+
for i,r in enumerate(records):
|
| 65 |
+
for j,v in enumerate(r):m[FRAME+16+i*24+j]=v
|
| 66 |
+
vm_memory(g,m);regs={'%r15':client,'%rsp':FRAME};pc=start;trace=[];requests=[];stored=[]
|
| 67 |
+
while True:
|
| 68 |
+
t=run(g,pc,list(calls)+[end],m,regs);m=t['memory'];regs=t['registers'];trace+=t['trace']
|
| 69 |
+
if t['stop']==end:break
|
| 70 |
+
i=calls[t['stop']]
|
| 71 |
+
if '<VM_Call>' not in rows[i]['operands']:raise ValueError('time helper '+rows[i]['operands'])
|
| 72 |
+
requests.append([regs[k] for k in ['rdi','rsi','rdx']]);stored.append(bytes(m[client+0x2081c+j] for j in range(24)).hex());regs['rax']=0;pc=rows[i+1]['address']
|
| 73 |
+
if len(requests)>count:raise ValueError('time dispatch bound')
|
| 74 |
+
return {'count':count,'pattern':pattern,'client_index':index,'initial_record_hex':baseline.hex(),'command_records_hex':[r.hex() for r in records],'vm_requests':requests,'records_at_vm_boundary':stored,'final_record_hex':bytes(m[client+0x2081c+j] for j in range(24)).hex(),'canaries':[m[client+0x2081b],m[client+0x20834]],'commands_unchanged':all(bytes(m[FRAME+16+i*24+j] for j in range(24))==r for i,r in enumerate(records)),**trace_fields({'trace':trace},False)}
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
def main():
|
| 78 |
+
out={'native':{},'client_stride_candidate':CLIENT_STRIDE,'limitations':'Verified static graphs and bounded supplied-state Linux ELF64 instruction slices only; no original executable/native callee/game VM executes. Entry/state/purity/decoded records supplied; gate effects stop at external calls, timestamps start after upstream gates, VM calls supply return0 and preserve caller registers, with no VM side effects. No message decode/EOF/overflow/netchan/time-generation/full caller/runtime/all-platform validation. Client stride candidate inferred from reciprocal arithmetic for aligned supplied addresses.'}
|
| 79 |
+
for label in ['linux--Quake3-UrT-Ded.x86_64','linux--Quake3-UrT.x86_64']:
|
| 80 |
+
r=json.loads(Path(f'docs/research/native/{label}.json').read_text());verified((Path('.cache/UrbanTerror43')/r['source']['path']).read_bytes(),r['source']['sha256']);a=r['artifacts']['disassembly.txt'];fs=native_functions(verified(gzip.open(a['path'],'rb').read(),a['uncompressed_sha256']).decode());graphs={n:control_flow(fs[n]) for n in ['SV_UserMove','SV_ClientThink']};fixtures=[(n,'ordered',n%8) for n in range(1,33)]+[(n,p,n%8) for n,p in itertools.product([1,2,3,4,5,7,8,16,31,32],['duplicate','descending','unordered','stale','negative','signed_boundary'])];out['native'][label]={'source':r['source'],'disassembly_sha256':a['uncompressed_sha256'],'graphs':graphs,'gate_probes':[gate_probe(graphs['SV_UserMove'],*v) for v in itertools.product([2,3,4],[0,1],[0,1],[0,1])],'time_probes':[time_probe(graphs['SV_UserMove'],*v) for v in fixtures],'think_probes':[think_probe(graphs['SV_ClientThink'],state,index) for state,index in itertools.product([0,2,3,4],[0,1,7,63])]}
|
| 81 |
+
write_json(Path('docs/research/usercmd-acceptance.json'),out);print('Recovered bounded server gates timestamp acceptance and stopped VM dispatch')
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
if __name__=='__main__':main()
|
scripts/test_usercmd_acceptance.py
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Independent server gates, signed timestamp and VM-boundary oracles."""
|
| 3 |
+
import hashlib
|
| 4 |
+
import json
|
| 5 |
+
from pathlib import Path
|
| 6 |
+
import unittest
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
def timestamp(raw):
|
| 10 |
+
v=int.from_bytes(bytes.fromhex(raw)[:4],'little');return v if v<2**31 else v-2**32
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
def accepted(p):
|
| 14 |
+
last=timestamp(p['initial_record_hex']);cap=timestamp(p['command_records_hex'][-1]);records=[]
|
| 15 |
+
for r in p['command_records_hex']:
|
| 16 |
+
t=timestamp(r)
|
| 17 |
+
if t<=cap and t>last:records.append(r);last=t
|
| 18 |
+
return records
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
class UsercmdAcceptanceTests(unittest.TestCase):
|
| 22 |
+
@classmethod
|
| 23 |
+
def setUpClass(cls):cls.r=json.loads(Path('docs/research/usercmd-acceptance.json').read_text())
|
| 24 |
+
|
| 25 |
+
def test_purity_connection_gates_and_delta_reset(self):
|
| 26 |
+
for n in self.r['native'].values():
|
| 27 |
+
self.assertEqual(len(n['gate_probes']),24)
|
| 28 |
+
for p in n['gate_probes']:
|
| 29 |
+
state=p['state'];pure=p['pure_word'];auth=p['authentication_word'];received=p['received_word'];delta=77
|
| 30 |
+
if pure and not auth and not received:stop='SV_SendClientGameState' if state==4 else 'return'
|
| 31 |
+
elif state==3:stop='SV_ClientEnterWorld'
|
| 32 |
+
elif pure and not auth:stop='SV_DropClient'
|
| 33 |
+
elif state==4:stop='time_loop'
|
| 34 |
+
else:stop='return';delta=0xffffffff
|
| 35 |
+
self.assertEqual(p['stop'],stop);self.assertEqual(p['delta_state_word'],delta)
|
| 36 |
+
if stop=='SV_SendClientGameState':self.assertEqual(p['stopped_calls'],['Com_DPrintf',stop])
|
| 37 |
+
|
| 38 |
+
def test_signed_timestamp_order_final_cap_duplicate_stale_and_wrap(self):
|
| 39 |
+
for n in self.r['native'].values():
|
| 40 |
+
self.assertEqual(len(n['time_probes']),92)
|
| 41 |
+
self.assertEqual({p['count'] for p in n['time_probes'] if p['pattern']=='ordered'},set(range(1,33)))
|
| 42 |
+
for p in n['time_probes']:
|
| 43 |
+
records=accepted(p);self.assertEqual(p['records_at_vm_boundary'],records);self.assertEqual(p['final_record_hex'],records[-1] if records else p['initial_record_hex'])
|
| 44 |
+
if p['pattern']=='ordered':self.assertEqual(len(records),p['count'])
|
| 45 |
+
if p['pattern'] in ['duplicate','descending']:self.assertEqual(len(records),1)
|
| 46 |
+
if p['pattern']=='stale':self.assertEqual(records,[])
|
| 47 |
+
|
| 48 |
+
def test_inlined_copy_before_vm_and_client_selector(self):
|
| 49 |
+
for n in self.r['native'].values():
|
| 50 |
+
for p in n['time_probes']:self.assertEqual(p['vm_requests'],[[0x90000,7,p['client_index']]]*len(accepted(p)))
|
| 51 |
+
|
| 52 |
+
def test_standalone_think_copies_all_states_dispatches_only_four(self):
|
| 53 |
+
for n in self.r['native'].values():
|
| 54 |
+
self.assertEqual(len(n['think_probes']),16)
|
| 55 |
+
for p in n['think_probes']:
|
| 56 |
+
self.assertEqual(p['stored_hex'],p['source_hex']);self.assertEqual(p['vm_request'],[0x90000,7,p['client_index']] if p['state']==4 else None)
|
| 57 |
+
|
| 58 |
+
def test_candidate_stride_reciprocal_from_native_operands(self):
|
| 59 |
+
self.assertEqual(self.r['client_stride_candidate'],0x2df40)
|
| 60 |
+
for n in self.r['native'].values():
|
| 61 |
+
rows=n['graphs']['SV_ClientThink']['instructions'];constants=[int(x['operands'].split(',')[0][1:],0) for x in rows if x['opcode']=='movabsq'];self.assertEqual(constants,[0x352f43fb794105d5]);self.assertEqual((constants[0]*(0x2df40//64))&((1<<64)-1),1);self.assertTrue(any(x['opcode']=='sarq' and '$0x6,' in x['operands'] for x in rows))
|
| 62 |
+
|
| 63 |
+
def test_canaries_and_supplied_command_memory_retention(self):
|
| 64 |
+
for n in self.r['native'].values():
|
| 65 |
+
for p in n['time_probes']:self.assertEqual(p['canaries'],[0x7b]*2);self.assertTrue(p['commands_unchanged'])
|
| 66 |
+
for p in n['think_probes']:self.assertEqual(p['canaries'],[0xa5]*2)
|
| 67 |
+
|
| 68 |
+
def test_paired_engine_outcomes(self):
|
| 69 |
+
a,b=self.r['native'].values()
|
| 70 |
+
def clean(rows):return [{k:v for k,v in p.items() if k not in ['trace_sha256','trace_length']} for p in rows]
|
| 71 |
+
for kind in ['gate_probes','time_probes','think_probes']:self.assertEqual(clean(a[kind]),clean(b[kind]))
|
| 72 |
+
|
| 73 |
+
def test_source_and_disassembly_identities_and_explicit_vm_boundary(self):
|
| 74 |
+
for label,n in self.r['native'].items():
|
| 75 |
+
data=(Path('.cache/UrbanTerror43')/n['source']['path']).read_bytes();self.assertEqual(hashlib.sha256(data).hexdigest(),n['source']['sha256']);original=json.loads(Path('docs/research/native',label+'.json').read_text());self.assertEqual(original['source'],n['source']);self.assertEqual(original['artifacts']['disassembly.txt']['uncompressed_sha256'],n['disassembly_sha256']);self.assertTrue(any(x['opcode']=='jmp' and '<VM_Call>' in x['operands'] for x in n['graphs']['SV_ClientThink']['instructions']))
|
| 76 |
+
self.assertIn('no VM side effects',self.r['limitations'])
|
| 77 |
+
|
| 78 |
+
|
| 79 |
+
if __name__=='__main__':unittest.main()
|