367 files, from working commit b1a079a. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
46 lines
2.4 KiB
Python
46 lines
2.4 KiB
Python
"""Observe an engine-owned deferred buffer at its genuine ResumeComms drain.
|
|
|
|
No packet storage is followed; only CDataStore identity and scalar bounds.
|
|
This is calling-contract evidence, not a callable implementation.
|
|
"""
|
|
import os,struct
|
|
from engine_channel_state import inspect,NETCLIENT
|
|
ENTRY=0x141e4918b
|
|
PREFIX=bytes.fromhex('440fb64710488d5718488b5f')
|
|
|
|
def inspect_deferred(read,r):
|
|
if r.rip!=ENTRY or read(ENTRY,len(PREFIX))!=PREFIX:raise ValueError('Deferred boundary differs')
|
|
owner,node=r.rsi,r.rdi
|
|
if not owner or not node or struct.unpack('<Q',read(NETCLIENT,8))[0]!=owner:raise ValueError('Deferred owner differs')
|
|
channels=inspect(read,owner)
|
|
if channels['state']!=5:raise ValueError('Deferred owner not connected')
|
|
# The real handler has already promoted its new instance connection and
|
|
# cleared suspension before calling NetClientSend for this owned list node.
|
|
found=None
|
|
for route in range(2):
|
|
head=owner+0x1e8+route*0x18
|
|
first=struct.unpack_from('<Q',read(head,16),8)[0]
|
|
if first==node:found=route
|
|
if found is None or channels['channels'][found]['suspended']:raise ValueError('Deferred head not active')
|
|
table=struct.unpack('<Q',read(node+0x18,8))[0]
|
|
capacity,length,cursor=struct.unpack('<3I',read(node+0x28,12))
|
|
requested=read(node+0x10,1)[0]
|
|
if table!=0x144c69b00 or requested>3 or cursor!=16 or not 20<=length<=capacity<=1048592:raise ValueError('Deferred data-store contract differs')
|
|
return dict(kind='genuine-resume-deferred-buffer-contract',route=found,requested_route=requested,
|
|
store_vtable=hex(table),store_offset_in_node=24,cursor=cursor,storage_length=length,
|
|
packet_length=length-cursor,capacity=capacity,
|
|
owner_connected=True,head_owned=True,channel_suspended=False,
|
|
send_call='0x141e46a80',destroy_call='0x141e4e950',release_call='0x14452a5d0',
|
|
engine_calls_made=False,packet_bodies_read=False,packet_storage_followed=False)
|
|
|
|
def capture(pid,registers):
|
|
fd=os.open(f'/proc/{pid}/mem',os.O_RDONLY)
|
|
try:
|
|
def read(address,size):
|
|
if not 0<size<=32:raise ValueError('Fixed deferred metadata bound')
|
|
raw=os.pread(fd,size,address)
|
|
if len(raw)!=size:raise ValueError('Incomplete deferred metadata')
|
|
return raw
|
|
return inspect_deferred(read,registers)
|
|
finally:os.close(fd)
|