nmarshall commited on
Commit
5dedc3d
·
1 Parent(s): c057512

Recover bounded dead-chat policies and delivery formats

Browse files
docs/FINDINGS.md CHANGED
@@ -252,3 +252,9 @@ Bounded qagame paths recover bomb-plant/inactivity correction requests, direct f
252
  **F-056 — Observed native command metadata/filter paths:** both Linux ELF64 engines contain the same eight built-in client-command pairs. Unmatched game forwarding requires its native flag plus server/client states 2/4; sanitation replaces argument CR/LF. Graphs establish weighted budgets 256 for say/say_team/tell and 122 for ut_radio, with extra dollar weighting and a six-dollar guard. Full caller/flood/tokenizer behavior remains open. [CHAT-001](research/CHAT_PATHS.md).
253
 
254
  **F-057 — Observed bounded chat assembly/gates:** helper 180858 checks used+token_length strictly below 1023, appends nonfinal separators and writes NUL; helper 186721 has mute deadline, g_allowChat, ignore-word, recipient-state and team/self gates. Later formatting/dead-chat/queue/lifecycle behavior remains open. The earlier BND-003 third-argument/channel-mode mapping is corrected: all three observed chat callers pass zero third argument and can reach slash/auth checks. [CHAT-002/003 and correction](research/CHAT_PATHS.md).
 
 
 
 
 
 
 
252
  **F-056 — Observed native command metadata/filter paths:** both Linux ELF64 engines contain the same eight built-in client-command pairs. Unmatched game forwarding requires its native flag plus server/client states 2/4; sanitation replaces argument CR/LF. Graphs establish weighted budgets 256 for say/say_team/tell and 122 for ut_radio, with extra dollar weighting and a six-dollar guard. Full caller/flood/tokenizer behavior remains open. [CHAT-001](research/CHAT_PATHS.md).
253
 
254
  **F-057 — Observed bounded chat assembly/gates:** helper 180858 checks used+token_length strictly below 1023, appends nonfinal separators and writes NUL; helper 186721 has mute deadline, g_allowChat, ignore-word, recipient-state and team/self gates. Later formatting/dead-chat/queue/lifecycle behavior remains open. The earlier BND-003 third-argument/channel-mode mapping is corrected: all three observed chat callers pass zero third argument and can reach slash/auth checks. [CHAT-002/003 and correction](research/CHAT_PATHS.md).
255
+
256
+ **F-058 — Observed dead-chat predicates:** raw sender/recipient fields derive five flags with unequal spectator comparisons and two death alternatives. 512 synthetic instruction paths distinguish policy 1's spectator restriction/team exception, policy 2 and default policy; game-type 9 bypasses these policy restrictions. Earlier recipient gates and field/global lifecycle remain open. [DEL-001](research/CHAT_DELIVERY.md).
257
+
258
+ **F-059 — Observed chat formatter arguments:** a guarded five-entry mode table and bounded delivery paths select cchat/tcchat/me, SUB-over-DEAD and independent SPEC labels, private direction markers and byte-25 prefixes. Aligned synthetic objects produce trap-17 slots 3/2. Recorded formatter returns are placeholders, so escaping, formatted commands and rendered output remain unverified. [DEL-002](research/CHAT_DELIVERY.md).
259
+
260
+ **F-060 — Observed delivery call topology:** explicit-target paths suppress redundant self echo and skip sender echo for object flag bit 8; fanout constructs stride-880 slot objects and can invoke cleanup per iteration. Recorded calls do not establish accepted recipients or actual cleanup results. [DEL-003](research/CHAT_DELIVERY.md).
docs/PROVISIONAL_TODO.md CHANGED
@@ -33,7 +33,7 @@ For implementation items, the minimum done condition is a documented contract, a
33
 
34
  ### First research batch
35
 
36
- Progress: [RE-232–234 / TIME-001–003](research/FRAME_TIMING.md) now cover Linux ELF64 elapsed modification, event sources and pause predicates. The [RE-237–239 follow-up](research/EVENT_QUEUES.md) resolves the pause-field address/bot chain and adds queue/journal evidence. The [RE-241–243 announcement pass](research/AUTH_ANNOUNCEMENTS.md) recovers label tables and recipient paths; The [RE-245–247 cvar pass](research/GAME_CVARS.md) adds all 126 main registration rows and resolves auth_verbosity/callers. The [RE-249–251 change pass](research/CVAR_CHANGES.md) adds cache/notification behavior, four numeric correction branches and direct registration coverage. The [RE-253–255 query pass](research/AUTH_QUERIES.md) adds selector helpers, command-role routing and internal authentication modes. The [RE-257–259 bounds/entry pass](research/SELECTOR_BOUNDS.md) adds integer parsing, selector storage/count evidence and native/QVM/chat route connections. The [RE-261–263 chat pass](research/CHAT_PATHS.md) adds native command metadata/filter evidence and bounded message/recipient paths, including the documented argument-mapping correction. PROV-002 remains open for full output/reset coverage. PROV-001 remains open for complete scheduling and platform coverage.
37
 
38
  Start with the open questions raised by the current binary evidence. These tasks depend on the linked reports, not on a working rewrite.
39
 
 
33
 
34
  ### First research batch
35
 
36
+ Progress: [RE-232–234 / TIME-001–003](research/FRAME_TIMING.md) now cover Linux ELF64 elapsed modification, event sources and pause predicates. The [RE-237–239 follow-up](research/EVENT_QUEUES.md) resolves the pause-field address/bot chain and adds queue/journal evidence. The [RE-241–243 announcement pass](research/AUTH_ANNOUNCEMENTS.md) recovers label tables and recipient paths; The [RE-245–247 cvar pass](research/GAME_CVARS.md) adds all 126 main registration rows and resolves auth_verbosity/callers. The [RE-249–251 change pass](research/CVAR_CHANGES.md) adds cache/notification behavior, four numeric correction branches and direct registration coverage. The [RE-253–255 query pass](research/AUTH_QUERIES.md) adds selector helpers, command-role routing and internal authentication modes. The [RE-257–259 bounds/entry pass](research/SELECTOR_BOUNDS.md) adds integer parsing, selector storage/count evidence and native/QVM/chat route connections. The [RE-261–263 chat pass](research/CHAT_PATHS.md) adds native command metadata/filter evidence and bounded message/recipient paths, including the documented argument-mapping correction. The [RE-265–267 delivery pass](research/CHAT_DELIVERY.md) adds bounded dead-chat predicates, formatter argument routing and echo/fanout calls. PROV-002 remains open for full output/reset coverage. PROV-001 remains open for complete scheduling and platform coverage.
37
 
38
  Start with the open questions raised by the current binary evidence. These tasks depend on the linked reports, not on a working rewrite.
39
 
docs/RESEARCH_LEDGER.md CHANGED
@@ -125,3 +125,7 @@ Completed bounded milestones RE-257–259 with `analyze_selector_bounds.py`: 18
125
  ## 2026-10-11 — Native command filters and bounded chat paths
126
 
127
  Completed bounded milestones RE-261–263 with `analyze_chat_paths.py`: paired native command tables, admission/sanitizer/limit graphs/constants, token-join boundary slices and recipient front gates. CHAT-001–003/F-056/057 retain supplied token lengths/team-helper results and distinguish static native graphs from runtime execution. Seven tests cover join separators/NUL, recipient predicates, paired metadata and malformed native string bounds. Corrected the preceding selector analyzer/report/fixtures and BND-003/F-055 notes: local 3356 is the third incoming argument, not channel mode at 3352; all observed chat callers pass zero third argument. RE-260 remains open and RE-264 tracks complete native/chat lifecycle/filter/format/runtime behavior. No original process/full QVM/callee executes.
 
 
 
 
 
125
  ## 2026-10-11 — Native command filters and bounded chat paths
126
 
127
  Completed bounded milestones RE-261–263 with `analyze_chat_paths.py`: paired native command tables, admission/sanitizer/limit graphs/constants, token-join boundary slices and recipient front gates. CHAT-001–003/F-056/057 retain supplied token lengths/team-helper results and distinguish static native graphs from runtime execution. Seven tests cover join separators/NUL, recipient predicates, paired metadata and malformed native string bounds. Corrected the preceding selector analyzer/report/fixtures and BND-003/F-055 notes: local 3356 is the third incoming argument, not channel mode at 3352; all observed chat callers pass zero third argument. RE-260 remains open and RE-264 tracks complete native/chat lifecycle/filter/format/runtime behavior. No original process/full QVM/callee executes.
128
+
129
+ ## 2026-10-11 — Dead-chat policy, formats and delivery calls
130
+
131
+ Completed bounded milestones RE-265–267 with `analyze_chat_delivery.py`: raw flag predicates, 512 dead-chat decision paths, five-entry mode table, exact formatter arguments/control strings, recipient-slot arithmetic and echo/fanout call traces. DEL-001–003/F-058–060 retain provisional field identities and explicit zero callee-return placeholders. Seven tests check branch destinations, policy distinctions, raw field alternatives, format arguments, control bytes and delivery call topology. RE-264 remains open; RE-268 tracks text expansion, raw-field/global lifetime, client consumption and full runtime/platform output. No original process/full QVM or recorded callee was executed.
docs/REVERSE_ENGINEERING_TODO.md CHANGED
@@ -312,3 +312,8 @@ Purpose: turn the supplied installation into an evidence-backed specification of
312
  - [x] RE-262 Recover bounded QVM concatenation whole-token/separator/NUL boundaries and shared-buffer identity ([CHAT-002](research/CHAT_PATHS.md)).
313
  - [x] RE-263 Recover bounded mute, allow-chat, ignore-word, recipient-state and team-comparison front gates ([CHAT-003](research/CHAT_PATHS.md)).
314
  - [ ] RE-264 Validate native caller/flood/tokenizer execution and full chat/dead-chat/ignore/mute lifecycle, formatting, reliable-queue admission and rendered recipient/output fixtures.
 
 
 
 
 
 
312
  - [x] RE-262 Recover bounded QVM concatenation whole-token/separator/NUL boundaries and shared-buffer identity ([CHAT-002](research/CHAT_PATHS.md)).
313
  - [x] RE-263 Recover bounded mute, allow-chat, ignore-word, recipient-state and team-comparison front gates ([CHAT-003](research/CHAT_PATHS.md)).
314
  - [ ] RE-264 Validate native caller/flood/tokenizer execution and full chat/dead-chat/ignore/mute lifecycle, formatting, reliable-queue admission and rendered recipient/output fixtures.
315
+
316
+ - [x] RE-265 Recover raw chat status predicates and 512 bounded dead-chat policy paths, including spectator/team/game-type exceptions ([DEL-001](research/CHAT_DELIVERY.md)).
317
+ - [x] RE-266 Recover mode jump table, exact formatter argument routing, labels/control bytes and signed recipient-slot calculation ([DEL-002](research/CHAT_DELIVERY.md)).
318
+ - [x] RE-267 Recover explicit-recipient self/flag-bit echo gates and count/cleanup fanout call paths ([DEL-003](research/CHAT_DELIVERY.md)).
319
+ - [ ] RE-268 Recover radio/text expansion helper 186435 and key lookup 185212, all chat flag/global writers, full prefix/copy/escaping behavior, private-message callers and client command consumption; validate output/queues/lifecycle across original runtime and target platforms.
docs/research/CHAT_DELIVERY.md ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Chat policy, formats and delivery calls
2
+
3
+ Static pass, 2026-10-11. Reproduce with `python3 scripts/analyze_chat_delivery.py`; check with `python3 scripts/test_chat_delivery.py`. [Generated evidence](chat-delivery.json) includes the verified qagame hash, function partitions, initialized-data mode table, 512 policy paths and bounded argument/field/call traces. No original process or complete QVM executes. Recorded CALLs return zero placeholders; formatting, cleanup and delivery callees are not entered. These slices extend the [recipient front gates](CHAT_PATHS.md), without composing a complete recipient decision.
4
+
5
+ ## DEL-001: classification and dead-chat policy
6
+
7
+ Helper 186721 derives five boolean locals from sender/recipient record pointers at object offset 520. Exact raw predicates are:
8
+
9
+ | Flag used below | Local | Record predicate |
10
+ | --- | ---: | --- |
11
+ | S, label-supported SUB interpretation | 56 | sender offset 3740 equals 1 |
12
+ | P, label-supported SPEC interpretation | 44 | sender offset 3096 equals 3 |
13
+ | D, label-supported DEAD interpretation | 60 | sender offset 4 equals 3 OR offset 4324 is nonzero |
14
+ | T, recipient spectator-like predicate | 64 | recipient offset 3096 is signed >=3 |
15
+ | U, recipient dead-like predicate | 68 | recipient offset 4 equals 3 OR offset 4324 is nonzero |
16
+
17
+ Names are provisional field interpretations. In particular, recipient T accepts values greater than 3 whereas sender P requires exactly 3. Offset 4324 supplies an alternative condition rather than replacing the offset-4 comparison. Five bounded raw-field fixtures exercise each flag and both death alternatives. Global 34999596 can skip classification and policy before this slice; its identity, initialized flag values and lifecycle remain open.
18
+
19
+ At instruction 187058, nonzero global **34999652** bypasses the following policy. Otherwise registered **g_deadchat** integer mirror **34067996** selects these acceptance predicates. Let A = S OR P OR D, G = game-type mirror 34090788 equals 9, and M = incoming channel mode equals 1:
20
+
21
+ | g_deadchat | Acceptance within this policy slice |
22
+ | --- | --- |
23
+ | 1 | (NOT P OR T OR G) AND (NOT A OR T OR U OR M OR G) |
24
+ | 2 | NOT P OR T OR G |
25
+ | Other observed values 0 and 3 | NOT A OR T OR U OR G |
26
+
27
+ Mode 1's exception in policy 1 does not override the first spectator restriction. For example, spectator-to-nonspectator remains rejected even if the recipient satisfies U; a dead nonspectator-to-live nonspectator can pass mode 1. Game-type value 9 permits every tested combination at this slice. It does not override earlier mute/ignore/state/team gates.
28
+
29
+ The collector enumerates policies 0/1/2/3, modes 0/1, game types 0/9 and all 32 flag vectors. Accepted counts are respectively **114/109/112/114**, out of 128 per policy. Each trace reaches actual acceptance instruction 187154 or rejection instruction 187379. This is bounded instruction evidence with synthetic memory, not a runtime server capture or a claim about every cvar domain.
30
+
31
+ ## DEL-002: modes, labels and formatter arguments
32
+
33
+ Send helper 187381 reads a five-entry table at VM address **29376**. Modes 0/1/2/3/4 dispatch to instructions **187423/187476/187565/187423/187643**. Signed values outside 0–4 take the mode-0 target. These are name/prefix construction destinations, distinct from the later formatting decisions in delivery helper 186721.
34
+
35
+ The delivery formatter selects an integer channel value: mode 3 forces 3; otherwise sender-record offset 3096 equal to 2 or 1 produces 2 or 1, with other values producing 0. Exact string templates and argument routing are:
36
+
37
+ | Mode | Template / routing |
38
+ | --- | --- |
39
+ | 0, ordinary | `%s "%d" "%s%s%s%c%c%s"`, command `cchat` |
40
+ | 1, team | Same template, command `tcchat` |
41
+ | 2, private | `cchat "%d" "%s[pm] %s %s%s%c%c%s"` |
42
+ | 3 | Ordinary template, command `tcchat`, integer channel 3 |
43
+ | 4, emote | `me "%d" "%s%c%c%s"` |
44
+
45
+ Ordinary arguments after the command/channel are SUB-or-DEAD label, SPEC label, name prefix, caret byte 94, supplied color byte and text pointer. `(SUB) ` takes precedence over `(DEAD) ` when both flags are set; `(SPEC) ` is independent. Missing labels use the actual empty string. Private arguments include `^3`, direction **`->` for sender-to-self** or **`<-` for a different recipient**, `^7`, name prefix, caret/color and text. Emote forwards name prefix/caret/color/text without those ordinary labels.
46
+
47
+ Prefix strings at VM addresses 77696/77653/77619/77589 contain **byte 25 (0x19)**: respectively `%s%c%c\x19: `, `%s%c%c\x19\x19: `, `\x19%s%c%c\x19: ` and `*%s%c%c\x19 `. The JSON preserves the control bytes. Their client parsing/rendering meaning remains open; do not normalize them to spaces or confuse them with the cleanup helper's byte 31.
48
+
49
+ Seven fixtures record exact formatter-70458 argument words. The following trap **17**, encoded CALL target **-18**, receives signed recipient index `(object - 34091368) / 880`. Aligned fixture objects verify recipient slot 3 and sender echo slot 2. Its command pointer is **zero only because the evaluator supplies a placeholder formatter return**; no formatted command, string escaping, actual NULL send or rendered output is established.
50
+
51
+ ## DEL-003: explicit recipient echo and slot fanout
52
+
53
+ The explicit-recipient tail first calls delivery helper 186721 with the recipient and prefix at local 196. Sender-to-self receives one call. A different recipient receives a second call toward the sender, using prefix local 264, unless **sender object offset 424 AND 8** is nonzero. The fixtures yield call counts 1/2/1 for self / other with zero flags / other with bit 8. The bit's full field identity and every flag mutation remain open.
54
+
55
+ The fanout tail visits `34091368 + i * 880` for indices below signed count global **34992524**, calling 186721 per visited slot. Count-zero and count-three fixtures record zero/three delivery calls. With cleanup local 192 zero, text pointer is local 40. With it nonzero, helper 70241 is called **per iteration**, and its placeholder zero return is forwarded to delivery. These observations do not establish effective recipients: each recorded delivery callee can reject through its own gates. Count lifetime, ownership, real cleanup mutation, reliable queues and client rendering remain incomplete.
56
+
57
+ ## Remaining work
58
+
59
+ RE-265–267 record these bounded milestones. RE-264 stays open for the complete chat contract; RE-268 adds specific follow-ups: text-expansion helper 186435 and key lookup 185212, all raw flag/global writers, prefix construction/copy/escaping, private-message callers and client command consumption, plus original-runtime and macOS/Linux comparison fixtures. Rust/Bevy behavior should be specified from these predicates while retaining the unresolved field identities and output contracts as explicit dependencies.
docs/research/CHAT_PATHS.md CHANGED
@@ -42,3 +42,5 @@ The previous BND-003 fixture incorrectly treated local **3356** as the chat chan
42
  ## Completion and remaining work
43
 
44
  RE-261–263 cover native table/admission/filter evidence, bounded concatenation boundaries and recipient front gates. RE-264 tracks native caller/flood/tokenizer execution, complete chat/dead-chat/ignore/mute lifecycle and formatting/queue/rendered-output fixtures. RE-260 remains open for the broader native filtering and chat runtime contract. Original assets remain in ignored cache; only code/documentation and generated analysis evidence are added.
 
 
 
42
  ## Completion and remaining work
43
 
44
  RE-261–263 cover native table/admission/filter evidence, bounded concatenation boundaries and recipient front gates. RE-264 tracks native caller/flood/tokenizer execution, complete chat/dead-chat/ignore/mute lifecycle and formatting/queue/rendered-output fixtures. RE-260 remains open for the broader native filtering and chat runtime contract. Original assets remain in ignored cache; only code/documentation and generated analysis evidence are added.
45
+
46
+ The [DEL-001–003 follow-up](CHAT_DELIVERY.md) recovers bounded dead-chat policy, formatter arguments and echo/fanout calls. It narrows the later-path questions above; complete lifecycle and runtime output remain open under RE-264/268.
docs/research/README.md CHANGED
@@ -36,10 +36,11 @@ python3 scripts/test_cvar_changes.py
36
  python3 scripts/test_auth_queries.py
37
  python3 scripts/test_selector_bounds.py
38
  python3 scripts/test_chat_paths.py
 
39
  python3 scripts/storage_policy.py check --require-setup
40
  ```
41
 
42
- The pipeline runs `fetch_analysis_references.py`, `analyze_qvm.py`, `analyze_native.py`, `analyze_vm_abi.py`, `analyze_native_dispatch.py`, `analyze_vm_extensions.py`, `analyze_native_metadata.py`, `analyze_native_coverage.py`, `analyze_auth_drop.py`, `analyze_deferred_auth.py`, `analyze_engine_control.py`, `analyze_frame_timing.py`, `analyze_event_queues.py`, `analyze_auth_announcements.py`, `analyze_game_cvars.py`, `analyze_cvar_changes.py`, `analyze_auth_queries.py`, `analyze_selector_bounds.py`, and `analyze_chat_paths.py` in that order. Python 3.9+ and **LLVM objdump** with x86 ELF/COFF/Mach-O support are required. This pass used Apple LLVM 17.0.0 on macOS arm64; it disassembled x86 images without running them. Upstream references are downloaded only if absent, checked against the committed SHA-256 manifest, and cached under `.cache/research/upstream/`. A clone also needs `git lfs pull` to obtain the derived artifacts/extracted members.
43
 
44
  Generated JSON/JSONL and compressed evidence are regenerated in place; keep prose notes in Markdown. Rerunning the four analysis stages reproduced every generated report and gzip artifact byte-for-byte on the same toolchain. gzip timestamps and stored filenames are fixed. Different objdump versions can produce different disassembly text, so tool version and uncompressed evidence hashes are recorded. Reports are UTF-8 normal Git text, with individual files below the storage policy's 2 MiB limit.
45
 
@@ -79,3 +80,5 @@ The extension collector adds five focused tests for native tail calls, command-r
79
  [Selector conversion, storage and entry routes](SELECTOR_BOUNDS.md) adds RE-257–259: integer overflow/slot compositions, copy/match/count bounds and native/QVM/chat dispatcher connections. Reproduce with `python3 scripts/analyze_selector_bounds.py`; check with `python3 scripts/test_selector_bounds.py`.
80
 
81
  [Native command admission and chat paths](CHAT_PATHS.md) adds RE-261–263: native tables/filter evidence, bounded concatenation capacity and recipient front gates. It also corrects the preceding chat third-argument/channel-mode mapping. Reproduce with `python3 scripts/analyze_chat_paths.py`; check with `python3 scripts/test_chat_paths.py`.
 
 
 
36
  python3 scripts/test_auth_queries.py
37
  python3 scripts/test_selector_bounds.py
38
  python3 scripts/test_chat_paths.py
39
+ python3 scripts/test_chat_delivery.py
40
  python3 scripts/storage_policy.py check --require-setup
41
  ```
42
 
43
+ The pipeline runs `fetch_analysis_references.py`, `analyze_qvm.py`, `analyze_native.py`, `analyze_vm_abi.py`, `analyze_native_dispatch.py`, `analyze_vm_extensions.py`, `analyze_native_metadata.py`, `analyze_native_coverage.py`, `analyze_auth_drop.py`, `analyze_deferred_auth.py`, `analyze_engine_control.py`, `analyze_frame_timing.py`, `analyze_event_queues.py`, `analyze_auth_announcements.py`, `analyze_game_cvars.py`, `analyze_cvar_changes.py`, `analyze_auth_queries.py`, `analyze_selector_bounds.py`, `analyze_chat_paths.py`, and `analyze_chat_delivery.py` in that order. Python 3.9+ and **LLVM objdump** with x86 ELF/COFF/Mach-O support are required. This pass used Apple LLVM 17.0.0 on macOS arm64; it disassembled x86 images without running them. Upstream references are downloaded only if absent, checked against the committed SHA-256 manifest, and cached under `.cache/research/upstream/`. A clone also needs `git lfs pull` to obtain the derived artifacts/extracted members.
44
 
45
  Generated JSON/JSONL and compressed evidence are regenerated in place; keep prose notes in Markdown. Rerunning the four analysis stages reproduced every generated report and gzip artifact byte-for-byte on the same toolchain. gzip timestamps and stored filenames are fixed. Different objdump versions can produce different disassembly text, so tool version and uncompressed evidence hashes are recorded. Reports are UTF-8 normal Git text, with individual files below the storage policy's 2 MiB limit.
46
 
 
80
  [Selector conversion, storage and entry routes](SELECTOR_BOUNDS.md) adds RE-257–259: integer overflow/slot compositions, copy/match/count bounds and native/QVM/chat dispatcher connections. Reproduce with `python3 scripts/analyze_selector_bounds.py`; check with `python3 scripts/test_selector_bounds.py`.
81
 
82
  [Native command admission and chat paths](CHAT_PATHS.md) adds RE-261–263: native tables/filter evidence, bounded concatenation capacity and recipient front gates. It also corrects the preceding chat third-argument/channel-mode mapping. Reproduce with `python3 scripts/analyze_chat_paths.py`; check with `python3 scripts/test_chat_paths.py`.
83
+
84
+ [Chat policy, formats and delivery calls](CHAT_DELIVERY.md) adds RE-265–267: 512 bounded policy paths, mode/formatter/control-byte evidence and echo/fanout calls. Reproduce with `python3 scripts/analyze_chat_delivery.py`; check with `python3 scripts/test_chat_delivery.py`. Field/global lifetime, actual formatted output and runtime delivery remain open.
docs/research/chat-delivery.json ADDED
The diff for this file is too large to render. See raw diff
 
scripts/analyze_binaries.py CHANGED
@@ -14,7 +14,7 @@ def main():
14
  'analyze_deferred_auth.py', 'analyze_engine_control.py', 'analyze_frame_timing.py',
15
  'analyze_event_queues.py', 'analyze_auth_announcements.py', 'analyze_game_cvars.py',
16
  'analyze_cvar_changes.py', 'analyze_auth_queries.py', 'analyze_selector_bounds.py',
17
- 'analyze_chat_paths.py'):
18
  subprocess.run([sys.executable, str(Path('scripts')/script)], check=True)
19
 
20
 
 
14
  'analyze_deferred_auth.py', 'analyze_engine_control.py', 'analyze_frame_timing.py',
15
  'analyze_event_queues.py', 'analyze_auth_announcements.py', 'analyze_game_cvars.py',
16
  'analyze_cvar_changes.py', 'analyze_auth_queries.py', 'analyze_selector_bounds.py',
17
+ 'analyze_chat_paths.py', 'analyze_chat_delivery.py'):
18
  subprocess.run([sys.executable, str(Path('scripts')/script)], check=True)
19
 
20
 
scripts/analyze_chat_delivery.py ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Recover chat modes, dead-chat decisions and bounded delivery/echo calls."""
3
+ import itertools
4
+ import json
5
+ from pathlib import Path
6
+ from analyze_auth_announcements import recover_table
7
+ from analyze_deferred_auth import partition_function, trace_slice
8
+ from analyze_game_cvars import vm_string
9
+ from analyze_qvm import decode,write_json
10
+ from analyze_vm_extensions import verified
11
+
12
+
13
+ def policy_allows(policy,mode,gametype,sub,spec,dead,target_spec,target_dead,bypass=0):
14
+ """Independent readable interpretation checked against instruction traces."""
15
+ if bypass:return True
16
+ if policy==1:
17
+ if spec and not target_spec and gametype!=9:return False
18
+ return not(sub or spec or dead) or target_spec or target_dead or mode==1 or gametype==9
19
+ if policy==2:return not spec or target_spec or gametype==9
20
+ return not(sub or spec or dead) or target_spec or target_dead or gametype==9
21
+
22
+
23
+ def main():
24
+ q=json.loads(Path('docs/research/qvm/qagame.json').read_text())
25
+ data=verified(Path(q['source']['member']['output']).read_bytes(),q['sha256']);h,ins=decode(data)
26
+ reg=json.loads(Path('docs/research/game-cvars.json').read_text())
27
+ if reg['sha256']!=q['sha256']:raise ValueError('registry provenance mismatch')
28
+ deadchat=next(r for r in reg['registry']['rows'] if r['name']=='g_deadchat')
29
+ if deadchat['mirror_address']+12!=34067996:raise ValueError('deadchat identity changed')
30
+ table=recover_table(data,h,ins,29376,0,4,187381,187911)
31
+ targets={r['value']:r['target_instruction'] for r in table['rows']}
32
+ memory={r['vm_address']:r['target_instruction'] for r in table['rows']}
33
+ switches=[{'mode':m,'target':targets.get(m,187423),
34
+ 'trace':trace_slice(ins,187403,targets.get(m,187423),memory,{436:m})} for m in range(-1,6)]
35
+ policies=[]
36
+ for policy,mode,gt,flags in itertools.product([0,1,2,3],[0,1],[0,9],itertools.product([0,1],repeat=5)):
37
+ sub,spec,dead,ts,td=flags
38
+ accepted=bool(policy_allows(policy,mode,gt,*flags))
39
+ t=trace_slice(ins,187058,187154 if accepted else 187379,
40
+ {34999652:0,34067996:policy,34090788:gt},{56:sub,44:spec,60:dead,64:ts,68:td,124:mode})
41
+ policies.append({'policy':policy,'mode':mode,'gametype':gt,'flags':list(flags),'accepted':accepted,
42
+ 'instructions':t['trace']})
43
+ bypass=trace_slice(ins,187058,187154,{34999652:1},{})
44
+ sender,recipient,sr,rr=34091368+2*880,34091368+3*880,0x30000,0x40000
45
+ derived=[]
46
+ for sub,st,sd,sover,rt,rd,rover in [(0,1,0,0,1,0,0),(1,1,0,0,1,0,0),(0,3,0,0,3,0,0),
47
+ (0,1,3,0,1,3,0),(0,1,0,1,4,0,1)]:
48
+ t=trace_slice(ins,186920,187058,{sender+520:sr,recipient+520:rr,sr+3740:sub,sr+3096:st,
49
+ sr+4:sd,sr+4324:sover,rr+3096:rt,rr+4:rd,rr+4324:rover},{116:sender,120:recipient})
50
+ derived.append({'raw_fields':[sub,st,sd,sover,rt,rd,rover],'trace':t})
51
+ formats=[]
52
+ for mode,team,sub,spec,dead,self_target in [(0,1,0,0,0,False),(1,2,1,1,1,False),
53
+ (0,0,0,1,1,False),(2,1,0,0,0,False),(2,1,0,0,0,True),(3,2,0,0,0,False),(4,2,0,0,0,False)]:
54
+ target=sender if self_target else recipient
55
+ t=trace_slice(ins,187154,187379,{sender+520:sr,sr+3096:team},
56
+ {116:sender,120:target,124:mode,128:51,132:0x50000,136:0x60000,56:sub,44:spec,60:dead})
57
+ formats.append({'mode':mode,'sender_team':team,'flags':[sub,spec,dead],'same_object':self_target,
58
+ 'trace':t})
59
+ echoes=[]
60
+ for same,flags in [(True,0),(False,0),(False,8)]:
61
+ t=trace_slice(ins,187712,187909,{sender+424:flags},
62
+ {428:sender,432:sender if same else recipient,436:2,260:51,192:0})
63
+ echoes.append({'same_object':same,'sender_flags_raw':flags,'trace':t})
64
+ fanouts=[]
65
+ for count,clean in [(0,0),(3,0),(3,1)]:
66
+ t=trace_slice(ins,187834,187909,{34992524:count},{428:sender,436:0,260:51,192:clean},limit=1000)
67
+ fanouts.append({'count':count,'clean_flag':clean,'trace':t})
68
+ addresses=[77798,77792,77785,77777,77776,77768,77765,77762,77725,77722,77696,77653,77619,77589,
69
+ 77828,77805,77728]
70
+ output={'source':q['source'],'sha256':q['sha256'],'deadchat_registry':deadchat,'mode_table':table,
71
+ 'mode_switch_traces':switches,'deadchat_policy_traces':policies,'bypass_trace':bypass,
72
+ 'derived_flag_traces':derived,'format_argument_traces':formats,'echo_traces':echoes,'fanout_traces':fanouts,
73
+ 'strings':{str(a):vm_string(data,h,a) for a in addresses},
74
+ 'functions':{str(e):partition_function(ins,e,data,h) for e in [186435,186721,187381]},
75
+ 'limitations':'Static qagame and bounded synthetic slices, not complete QVM/game execution. Calls '
76
+ 'are recorded with zero placeholder returns. Format arguments/pointers are evidence, not formatted '
77
+ 'commands. Field identities are provisional except supplied strings/cvar mappings. Earlier recipient '
78
+ 'gates are excluded from the policy matrix; global lifetime, text expansion, reliable queues and '
79
+ 'rendered/platform conformance remain open.'}
80
+ write_json(Path('docs/research/chat-delivery.json'),output)
81
+ print(f'Recovered {len(policies)} deadchat policy paths, mode/format and echo/fanout evidence')
82
+
83
+
84
+ if __name__=='__main__':main()
scripts/test_chat_delivery.py ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Check bounded delivery traces against raw branches and independent expectations."""
3
+ import json
4
+ from pathlib import Path
5
+ import unittest
6
+
7
+
8
+ class ChatDeliveryTests(unittest.TestCase):
9
+ @classmethod
10
+ def setUpClass(cls):
11
+ cls.r=json.loads(Path('docs/research/chat-delivery.json').read_text())
12
+ cls.ins={i['index']:i for f in cls.r['functions'].values() for i in f['instructions']}
13
+
14
+ def test_table_and_default_guards(self):
15
+ self.assertEqual([x['target_instruction'] for x in self.r['mode_table']['rows']],
16
+ [187423,187476,187565,187423,187643])
17
+ for x in self.r['mode_switch_traces']:
18
+ last=self.ins[x['trace']['trace'][-1]]
19
+ if last['opcode']=='JUMP':
20
+ # Computed dispatch preceded by the table load.
21
+ self.assertIn(187419,x['trace']['trace'])
22
+ else:self.assertEqual(last['operand'],x['target'])
23
+
24
+ def test_policy_matrix_reaches_claimed_branch(self):
25
+ rows=self.r['deadchat_policy_traces']
26
+ self.assertEqual(len(rows),512)
27
+ self.assertEqual(len({(x['policy'],x['mode'],x['gametype'],tuple(x['flags'])) for x in rows}),512)
28
+ self.assertEqual([sum(x['accepted'] for x in rows if x['policy']==p) for p in range(4)],
29
+ [114,109,112,114])
30
+ for x in rows:
31
+ last=self.ins[x['instructions'][-1]]
32
+ destination=self.ins[x['instructions'][-2]]['operand'] if last['opcode']=='JUMP' else last['operand']
33
+ self.assertEqual(destination,187154 if x['accepted'] else 187379)
34
+ if x['gametype']==9:self.assertTrue(x['accepted'])
35
+ self.assertEqual(self.ins[self.r['bypass_trace']['trace'][-1]]['operand'],187154)
36
+
37
+ def test_policy_distinguishes_spectators_and_team_exception(self):
38
+ def accepted(p,m,flags):
39
+ return next(x['accepted'] for x in self.r['deadchat_policy_traces']
40
+ if (x['policy'],x['mode'],x['gametype'],x['flags'])==(p,m,0,flags))
41
+ self.assertFalse(accepted(1,1,[0,1,0,0,1]))
42
+ self.assertTrue(accepted(0,1,[0,1,0,0,1]))
43
+ self.assertTrue(accepted(1,1,[0,0,1,0,0]))
44
+ self.assertFalse(accepted(0,1,[0,0,1,0,0]))
45
+ self.assertTrue(accepted(2,0,[1,0,1,0,0]))
46
+ self.assertFalse(accepted(2,0,[0,1,0,0,0]))
47
+
48
+ def test_raw_field_classification(self):
49
+ actual=[[x['trace']['memory'][str(0x40000000+i)] for i in [56,44,60,64,68]]
50
+ for x in self.r['derived_flag_traces']]
51
+ self.assertEqual(actual,[[0,0,0,0,0],[1,0,0,0,0],[0,1,0,1,0],[0,0,1,0,1],[0,0,1,1,1]])
52
+
53
+ def test_format_arguments_and_recipient_slots(self):
54
+ t=self.r['format_argument_traces'];a=[x['trace']['calls'][0]['args'] for x in t]
55
+ self.assertEqual([x['8'] for x in a],[77805,77805,77805,77728,77728,77805,77828])
56
+ self.assertEqual([a[i]['12'] for i in [0,1,2,5]],[77792,77798,77792,77798])
57
+ self.assertEqual([a[i]['16'] for i in [0,1,2,5]],[1,2,0,3])
58
+ self.assertEqual([a[i]['20'] for i in [0,1,2]],[77776,77785,77777])
59
+ self.assertEqual([a[3]['20'],a[4]['20']],[77762,77765])
60
+ self.assertEqual(a[6]['12'],2)
61
+ for i,x in enumerate(t):
62
+ formatter,send=x['trace']['calls']
63
+ self.assertEqual(formatter['target'],70458)
64
+ self.assertEqual(send['target'],-18)
65
+ self.assertEqual(send['args'],{'8':2 if i==4 else 3,'12':0})
66
+
67
+ def test_control_bytes_and_format_strings(self):
68
+ s=self.r['strings']
69
+ self.assertEqual([s[str(a)].count('\x19') for a in [77696,77653,77619,77589]],[1,2,2,1])
70
+ self.assertEqual(s['77728'],'cchat "%d" "%s[pm] %s %s%s%c%c%s"')
71
+ self.assertEqual(s['77828'],'me "%d" "%s%c%c%s"')
72
+ self.assertEqual([s[str(a)] for a in [77785,77777,77768]],['(SUB) ','(DEAD) ','(SPEC) '])
73
+
74
+ def test_echo_and_fanout_call_boundaries(self):
75
+ e=self.r['echo_traces']
76
+ self.assertEqual([len(x['trace']['calls']) for x in e],[1,2,1])
77
+ self.assertEqual(e[1]['trace']['calls'][1]['args']['12'],34091368+2*880)
78
+ f=self.r['fanout_traces']
79
+ self.assertEqual(f[0]['trace']['calls'],[])
80
+ for x in f[1:]:
81
+ sends=[c for c in x['trace']['calls'] if c['target']==186721]
82
+ self.assertEqual([c['args']['12'] for c in sends],[34091368+i*880 for i in range(3)])
83
+ self.assertEqual(len([c for c in x['trace']['calls'] if c['target']==70241]),3*x['clean_flag'])
84
+ self.assertEqual([c['args']['28'] for c in sends],
85
+ [0 if x['clean_flag'] else 0x40000000+40]*3)
86
+
87
+
88
+ if __name__=='__main__':unittest.main()