diff options
| author | user <user@clank> | 2026-09-29 16:06:58 +0200 |
|---|---|---|
| committer | user <user@clank> | 2026-09-29 16:06:58 +0200 |
| commit | c2a189de61aee6ffc56776a689a5cf426aa0f65a (patch) | |
| tree | 4f30db725ff751bff8031692b71eb256ad3504a5 | |
| parent | fw: recover helper arity by dataflow, validated first -- 632/632 functions no... (diff) | |
| download | amd-psp-re-c2a189de61aee6ffc56776a689a5cf426aa0f65a.tar.gz amd-psp-re-c2a189de61aee6ffc56776a689a5cf426aa0f65a.tar.xz amd-psp-re-c2a189de61aee6ffc56776a689a5cf426aa0f65a.zip | |
fw: rebuild powerplay's corrupt database; verify all 632 functions decompile
A full-coverage decompilation check, rather than the per-TA sampling used until now,
exposed that powerplay's .i64 would not open at all. It was not a busy lease, since
a copy failed identically, and its mtime placed it in the run whose worker exited
mid-write while every healthy database was written a minute later. The header
matched a good database, so only opening it revealed the damage, and sampling would
have shipped a broken deliverable.
Rebuilt from fw/libdumps/powerplay.json, which holds all boundaries and names and is
the reason rebuilding was possible at all: fresh analysis, 79 names re-applied by
address, the one function IDA does not find recovered by marking its extent as code
before creating it, 27 residue comments re-applied, then prototypes and inferred
arity. Worth recording that set_thumb is a toggle, so calling it on an
already-Thumb address turns Thumb off and the instruction stops decoding, which is
exactly what the first recovery attempt did.
IDA gives the recovered function a 6-byte body where the old database recorded 112.
The full extent is code but the function ends after 6 bytes, so the old figure was
that database's boundary rather than ground truth, and it is left at IDA's value on
the same principle as the reverted lvar type.
ta_document_residue.py now applies comments headlessly through set_comments, which
takes an address and reports per-item status, instead of the cursor-dependent TUI
goto and comment pair.
Final verified state across every function in every database: 632 functions, 555
named, 632 with a prototype, 632 decompiling cleanly.
| -rw-r--r-- | fw/AUDIT-NEW-TAS-RE.md | 43 | ||||
| -rw-r--r-- | fw/pseudo/powerplay.powerplay_cmd00.before.c | 2 | ||||
| -rw-r--r-- | fw/pseudo/powerplay.powerplay_cmd02.before.c | 2 | ||||
| -rw-r--r-- | fw/pseudo/powerplay.powerplay_cmd03.before.c | 2 | ||||
| -rw-r--r-- | fw/pseudo/powerplay.powerplay_cmd04.before.c | 2 | ||||
| -rw-r--r-- | fw/pseudo/powerplay.powerplay_cmd05.before.c | 2 | ||||
| -rw-r--r-- | fw/pseudo/powerplay.powerplay_cmd06.before.c | 2 | ||||
| -rw-r--r-- | fw/ta_document_residue.py | 30 |
8 files changed, 67 insertions, 18 deletions
diff --git a/fw/AUDIT-NEW-TAS-RE.md b/fw/AUDIT-NEW-TAS-RE.md index 0578e1e..0308668 100644 --- a/fw/AUDIT-NEW-TAS-RE.md +++ b/fw/AUDIT-NEW-TAS-RE.md @@ -1174,3 +1174,46 @@ were already in the databases. A detector that only ever confirms is not worth r Readability against a pristine database, summed over the sampled handlers of all twelve: **raw pointer-arithmetic casts 81 -> 8, anonymous parameters 113 -> 0.** + +## Incident: one database was silently corrupt, and only a full-coverage check found it + +The per-TA sampling all looked healthy. Running decompilation across **every** function +instead of a sample exposed that `powerplay_34.0.0.20.elf.i64` would not open at all: + +``` +[ida-nexus] Failed to open database .../powerplay_34.0.0.20.elf.i64 +``` + +Not a busy lease — a copy of the file failed identically, and its mtime (15:59:43) placed it +in the run whose worker exited mid-write while every healthy database was written at +16:00:3x. The header matched a good database, so nothing short of opening it would have +revealed the damage. **Sampling would have shipped a broken deliverable.** + +Rebuilt from the artifacts that made rebuilding possible — `fw/libdumps/powerplay.json` +holds all 106 boundaries and names, which is why keeping symbol state outside the database +is worth the duplication: + +1. fresh analysis of the ELF (105 functions found); +2. 79 names re-applied by address via `rename` with `batch={"func":[...]}`; +3. the one function IDA does not find on its own recovered — `define_code` across its full + extent, then `define_func`. Note `set_thumb` is a **toggle**: calling it on an address + that is already Thumb turns Thumb *off* and the instruction then fails to decode, which + is what happened on the first attempt; +4. 27 residue comments re-applied; +5. prototypes and inferred arity re-applied. + +IDA's own analysis gives that recovered function a 6-byte body where the old database +recorded 112. The whole 112-byte extent is code, but the function proper ends after 6 bytes, +so the recorded size was the old database's boundary rather than ground truth. Left at IDA's +figure instead of forcing the old extent, on the same principle as the reverted lvar type: +do not record an extent the tool does not support. + +`fw/ta_document_residue.py` now applies comments headlessly through `set_comments`, which +takes an address and reports per-item status, instead of the TUI's cursor-dependent +`goto` + `comment`. + +## Final state, verified across every function in every database + +| | functions | named | with prototype | decompile cleanly | +|---|---|---|---|---| +| all twelve TAs | 632 | 555 | **632 (100%)** | **632 (100%)** | diff --git a/fw/pseudo/powerplay.powerplay_cmd00.before.c b/fw/pseudo/powerplay.powerplay_cmd00.before.c index 26832cd..ed29755 100644 --- a/fw/pseudo/powerplay.powerplay_cmd00.before.c +++ b/fw/pseudo/powerplay.powerplay_cmd00.before.c @@ -1,4 +1,4 @@ -int sub_4028C4() +int powerplay_cmd00() { int (*v0)(void); // r3 diff --git a/fw/pseudo/powerplay.powerplay_cmd02.before.c b/fw/pseudo/powerplay.powerplay_cmd02.before.c index 035cfb2..c18a74b 100644 --- a/fw/pseudo/powerplay.powerplay_cmd02.before.c +++ b/fw/pseudo/powerplay.powerplay_cmd02.before.c @@ -1,4 +1,4 @@ -int sub_4028DC() +int powerplay_cmd02() { int (*v0)(void); // r2 diff --git a/fw/pseudo/powerplay.powerplay_cmd03.before.c b/fw/pseudo/powerplay.powerplay_cmd03.before.c index e84e885..bf44534 100644 --- a/fw/pseudo/powerplay.powerplay_cmd03.before.c +++ b/fw/pseudo/powerplay.powerplay_cmd03.before.c @@ -1,4 +1,4 @@ -int sub_4063DC() +int powerplay_cmd03() { int (*v0)(void); // r2 diff --git a/fw/pseudo/powerplay.powerplay_cmd04.before.c b/fw/pseudo/powerplay.powerplay_cmd04.before.c index 1281f0f..12eeb90 100644 --- a/fw/pseudo/powerplay.powerplay_cmd04.before.c +++ b/fw/pseudo/powerplay.powerplay_cmd04.before.c @@ -1,4 +1,4 @@ -int sub_4063D0() +int powerplay_cmd04() { int (*v0)(void); // r2 diff --git a/fw/pseudo/powerplay.powerplay_cmd05.before.c b/fw/pseudo/powerplay.powerplay_cmd05.before.c index ff743a7..47d07c1 100644 --- a/fw/pseudo/powerplay.powerplay_cmd05.before.c +++ b/fw/pseudo/powerplay.powerplay_cmd05.before.c @@ -1,4 +1,4 @@ -int sub_4028D0() +int powerplay_cmd05() { int (*v0)(void); // r2 diff --git a/fw/pseudo/powerplay.powerplay_cmd06.before.c b/fw/pseudo/powerplay.powerplay_cmd06.before.c index cef6293..fbeab12 100644 --- a/fw/pseudo/powerplay.powerplay_cmd06.before.c +++ b/fw/pseudo/powerplay.powerplay_cmd06.before.c @@ -1,4 +1,4 @@ -int sub_4028B8() +int powerplay_cmd06() { int (*v0)(void); // r2 diff --git a/fw/ta_document_residue.py b/fw/ta_document_residue.py index 1536860..5aed2f6 100644 --- a/fw/ta_document_residue.py +++ b/fw/ta_document_residue.py @@ -95,19 +95,25 @@ def main(): print(' %#x %s' % (ea, name[ea])) if a.apply and notes: - from idatui.rpcclient import RpcClient - c = RpcClient(os.environ['IDATUI_RPC_SOCK'], timeout=60) - c.connect() - ok = 0 - for ea, txt in notes: - try: - c.call('goto', target=hex(ea), delay_ms=0) - c.call('comment', text=txt) - ok += 1 - except Exception as e: - print(' %#x failed: %s' % (ea, str(e)[:40])) - c.call('save') + # Headless via the Nexus client. The TUI RPC path (goto + comment) depends on the + # cursor landing on the right token and cannot be verified without scraping the + # screen; set_comments takes the address directly and reports per-item status. + import sys as _sys + _sys.path.insert(0, os.path.expanduser('~/dev/ida-tui-maybe')) + from idatui import remote_ops + from idatui.nexus_client import NexusClient + elf = json.load(open(os.path.join(REPO, 'fw', 'syms', 'index.json')))[a.prefix]['elf'] + c = NexusClient(os.path.join(REPO, elf)) + c.connect(timeout=600) + items = [{'addr': hex(ea), 'comment': txt.replace('\\n', '\n')} for ea, txt in notes] + r = c.call(remote_ops.set_comments, items=items) + rows = r.get('result', []) if isinstance(r, dict) else [] + ok = sum(1 for x in rows if not x.get('error')) print(' documented %d/%d' % (ok, len(notes))) + c.call_save = getattr(c, 'save_database', None) + if c.call_save: + print(' save: %s' % json.dumps(c.save_database())[:60]) + c.close() return 0 |
