aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoruser <user@clank>2026-09-29 12:01:29 +0200
committeruser <user@clank>2026-09-29 12:01:29 +0200
commit2b39dfe0d86e7ecccb942d97b116598bdcd553ff (patch)
tree78fbc7cc3f931df58a0445c7e1e3d7e57f790f54
parentfw: carve PSP firmware from AMD Windows drivers; 10 TA types the Linux corpus... (diff)
downloadamd-psp-re-2b39dfe0d86e7ecccb942d97b116598bdcd553ff.tar.gz
amd-psp-re-2b39dfe0d86e7ecccb942d97b116598bdcd553ff.tar.xz
amd-psp-re-2b39dfe0d86e7ecccb942d97b116598bdcd553ff.zip
LOAD_TA sweep [HW]: this Navi 31 accepts 13 Windows TAs, 9 of types never audited
The Windows containers carry no ASIC tag, so which ones target Navi 31 could not be read out of the files. LOAD_TA answers it, since the PSP verifies the signature against this part's keys, and it does so without invoking anything. Both controls passed: a TA carved from the machine's own psp_13_0_0_ta.bin loads, and a junk buffer is rejected with 0x34. Without the first an all-reject sweep would be indistinguishable from a broken harness; without the second an accept would mean nothing. Successful loads were unloaded immediately because each allocates a session and this rig has a known session-exhaustion wall. Thirteen of sixteen TA containers authenticate: ASD, DTM, HDCP and RAS as expected, plus RAP, AUC, FP, GCP, MERIT, OPM, TMZ, WSPE and XGMI, none of which this project has ever had in scope. Three are refused -- RAS 27.0.0.21 and POWERPLAY with 0xffff0000, XGMI 32.0.0.2 with TEE_ERROR_NOT_SUPPORTED -- and notably the PSP discriminates between builds of the same TA, since XGMI 32.0.0.13 and RAS 27.0.0.22 both load. The three sys_drv modules are rejected, as expected for a driver-class module submitted to LOAD_TA. Re-running the sweep in reverse order reproduces the identical 13 accepts and the same three reject codes, so this is not an artefact of ordering or accumulated session state. Consequence: the "exactly four TAs" result was a fact about linux-firmware that this repo had been using as a fact about the platform. Measured on hardware, the platform accepts at least thirteen, which is unaudited PSP-resident surface reachable through the ordinary LOAD_TA path on stock firmware with signed AMD images. Not established, and deliberately left for a separate step: whether the accepted TAs respond to commands. Loading a signed AMD TA is passive; invoking unknown commands in TMZ or XGMI is not.
-rw-r--r--fw/AUDIT-WINDOWS-DRIVER-CORPUS.md74
-rw-r--r--fw/carve_driver.py3
-rw-r--r--hw/loadta_windows_sweep.py151
3 files changed, 228 insertions, 0 deletions
diff --git a/fw/AUDIT-WINDOWS-DRIVER-CORPUS.md b/fw/AUDIT-WINDOWS-DRIVER-CORPUS.md
index 29daeca..4d41c9a 100644
--- a/fw/AUDIT-WINDOWS-DRIVER-CORPUS.md
+++ b/fw/AUDIT-WINDOWS-DRIVER-CORPUS.md
@@ -92,3 +92,77 @@ certainly for other parts. The `sys_drv` blobs *are* tagged, and only one of the
3. Diff the new ASD/HDCP/DTM build lines (`x.0.4.y`) against the Linux ones (`x.0.0.y`)
— a different branch of the same component is exactly where a fixed-but-undisclosed
bug shows up.
+
+================================================================================
+# LOAD_TA sweep [HW]: 13 of 16 Windows TAs AUTHENTICATE on this Navi 31
+
+The containers carry no ASIC tag, so "which of these target Navi 31" could not be read
+out of the files. The PSP answers it directly: `LOAD_TA` verifies the signature against
+this part's keys, so the status separates "not for this silicon" from "a TA this PSP will
+accept" — without invoking anything.
+
+## Controls (both required, both passed)
+
+```
+POS ctrl: TA carved from this machine's own psp_13_0_0_ta.bin -> ACCEPTED
+NEG ctrl: junk 0xa5 * 0x2000 -> signature verify failed (0x34)
+```
+
+Without the positive control an all-reject sweep would be indistinguishable from a broken
+harness; without the negative, "accepted" would mean nothing. Every successful load was
+immediately unloaded (successes allocate a PSP session and this rig has a known
+session-exhaustion wall, `hw/loadta_ring_exhaustion.py`).
+
+## Result
+
+| container | TA | verdict |
+|---|---|---|
+| `asd 33.0.16.144` | AMD-TEE ASD Driver | **ACCEPTED** |
+| `ta 7.0.0.19` | **RAP** | **ACCEPTED** |
+| `ta 16.0.0.9` | **AUC** | **ACCEPTED** |
+| `ta 18.0.4.19` | DTM | **ACCEPTED** |
+| `ta 19.0.0.8` | **FP** | **ACCEPTED** |
+| `ta 22.0.4.49` | **GCP** | **ACCEPTED** |
+| `ta 23.0.4.49` | HDCP | **ACCEPTED** |
+| `ta 24.0.4.42` | **MERIT** | **ACCEPTED** |
+| `ta 25.0.4.47` | **OPM** | **ACCEPTED** |
+| `ta 27.0.0.22` | RAS | **ACCEPTED** |
+| `ta 29.0.0.3` | **TMZ** | **ACCEPTED** |
+| `ta 30.0.4.27` | **WSPE** | **ACCEPTED** |
+| `ta 32.0.0.13` | **XGMI** | **ACCEPTED** |
+| `ta 27.0.0.21` | RAS (older) | rejected `0xffff0000` |
+| `ta 32.0.0.2` | XGMI (older) | rejected `0xffff000a` = `TEE_ERROR_NOT_SUPPORTED` |
+| `ta 34.0.0.9` | POWERPLAY | rejected `0xffff0000` |
+| `sys_drv` x3 (`NV13`/`NV33`/`MI02`) | – | all rejected `0x34` (LOAD_TA is the wrong command for a driver module) |
+
+**Ordering control:** the sweep was re-run in reverse order and produced the *identical*
+13 accepts and the same three rejects with the same status codes, so the result is not an
+artefact of load order or accumulated session state.
+
+Note the two version pairs: `XGMI 32.0.0.13` loads while `32.0.0.2` returns
+`NOT_SUPPORTED`, and `RAS 27.0.0.22` loads while `27.0.0.21` returns `0xffff0000` — the
+PSP is discriminating between builds of the same TA, not just between TA types.
+
+## Why this matters
+
+This project has audited **four** TAs (ASD, HDCP, DTM, RAS) because that is what
+`psp_13_0_0_ta.bin` ships. The sweep shows this silicon will also authenticate and load
+**nine TA types that were never in scope**: RAP, AUC, FP, GCP, MERIT, OPM, TMZ, WSPE,
+XGMI.
+
+That is unaudited, PSP-resident attack surface reachable through the ordinary
+`GFX_CMD_ID_LOAD_TA` path any driver can use — and it is reachable *today*, on stock
+firmware, with signed AMD images. TMZ (trusted memory zone) and GCP in particular are
+security-relevant by name.
+
+**Scope correction, stated plainly:** the earlier "exactly 4 TAs" result was a fact about
+linux-firmware, and this repo used it as a fact about the platform. It is now measured on
+hardware that the platform accepts at least 13.
+
+**Not yet established:** whether the accepted TAs *respond to commands* (load ≠ usable
+command surface), and what their command sets are. `INVOKE_CMD` probing is the next step
+and is deliberately separated from this measurement — loading a signed AMD TA is passive,
+invoking unknown commands in TMZ/XGMI is not.
+
+Artifacts: `hw/loadta_windows_sweep.py`, containers in `psp_out/versions_win/`.
+Card healthy after the sweep: GRBM `0x302c`, PSP `0x310036`, heartbeat advancing.
diff --git a/fw/carve_driver.py b/fw/carve_driver.py
index 847ba4c..30e46b2 100644
--- a/fw/carve_driver.py
+++ b/fw/carve_driver.py
@@ -124,6 +124,9 @@ def carve(data, src):
rec.update(verdict='headerless', guess=None, body_base=None)
rec.update(identify(body))
rec['_body'] = body
+ # the FULL signed container (header + body + trailer) -- this is what
+ # LOAD_TA must be given, since the PSP authenticates the signature.
+ rec['_container'] = data[cont:cont + 0x200 + n]
out.append(rec)
return out
diff --git a/hw/loadta_windows_sweep.py b/hw/loadta_windows_sweep.py
new file mode 100644
index 0000000..2cdfa99
--- /dev/null
+++ b/hw/loadta_windows_sweep.py
@@ -0,0 +1,151 @@
+#!/usr/bin/env python3
+"""Which of the Windows-driver TAs does THIS Navi 31 PSP accept?
+
+`fw/AUDIT-WINDOWS-DRIVER-CORPUS.md` extracted 19 PSP module containers from the Windows
+Adrenalin 22.12.1 package, including ten TA types the linux-firmware bundle never ships
+(OPM, MERIT, GCP, WSPE, TMZ, AUC, FP, XGMI, RAP, POWERPLAY). Those containers carry
+`apu_family_id = 0xffffffff`, so nothing in the file says which ASIC they target.
+
+The PSP answers that for us: `LOAD_TA` authenticates the container against this part's
+keys, so the status separates "wrong part / not for this silicon" from "a TA this PSP
+will actually accept" — without invoking anything.
+
+Controls, both required:
+ POS a TA carved from this machine's own `psp_13_0_0_ta.bin` must load (status 0).
+ Without it, an all-reject result would be indistinguishable from a broken harness.
+ NEG a junk buffer must be rejected, so "accept" means something.
+
+Any *successful* load allocates a PSP session and this rig has a known
+session-exhaustion wall (`hw/loadta_ring_exhaustion.py`), so every success is unloaded
+immediately.
+
+usage: PYTHONPATH=/root/psp/tinygrad loadta_windows_sweep.py --dir /root/psp/cont22
+"""
+import argparse
+import glob
+import os
+import struct
+import sys
+import time
+
+STATUS = {0x00: 'ACCEPTED', 0x34: 'signature verify failed',
+ 0x01: 'invalid cmd', 0x02: 'invalid params'}
+
+
+def main():
+ ap = argparse.ArgumentParser()
+ ap.add_argument('--dir', default='/root/psp/cont22')
+ ap.add_argument('--reverse', action='store_true',
+ help='sweep in reverse order: results must not depend on ordering')
+ ap.add_argument('--ta-bin', default='/lib/firmware/amdgpu/psp_13_0_0_ta.bin')
+ args = ap.parse_args()
+
+ from tinygrad import Device
+ import tinygrad.runtime.autogen.am.am as am
+ sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
+
+ adev = Device["AMD"].iface.dev_impl
+ psp = adev.psp
+ cmd_pa = adev.mm.palloc(0x10000, align=0x1000, zero=True, boot=False)
+ mcc = adev.paddr2mc(cmd_pa)
+ app_pa = adev.mm.palloc(0x80000, align=0x1000, zero=True, boot=False)
+
+ def load_ta(blob):
+ n = (len(blob) + 3) & ~3 # USB4 needs 4-byte aligned size
+ adev.vram.view(app_pa, n)[:] = blob + b'\x00' * (n - len(blob))
+ adev.gmc.flush_hdp()
+ mc = adev.paddr2mc(app_pa)
+ c = am.struct_psp_gfx_cmd_resp(cmd_id=am.GFX_CMD_ID_LOAD_TA)
+ t = c.cmd.cmd_load_ta
+ t.app_phy_addr_lo, t.app_phy_addr_hi = mc & 0xFFFFFFFF, mc >> 32
+ t.app_len = len(blob)
+ t.cmd_buf_phy_addr_lo, t.cmd_buf_phy_addr_hi = mcc & 0xFFFFFFFF, mcc >> 32
+ t.cmd_buf_len = 0x10000
+ try:
+ r = psp._ring_submit(c)
+ return r.resp.status & 0xFFFFFFFF, r.resp.session_id
+ except Exception as e:
+ try:
+ return int(str(e).strip().split()[-1]) & 0xFFFFFFFF, None
+ except Exception:
+ return -1, None
+
+ def unload(sid):
+ c = am.struct_psp_gfx_cmd_resp(cmd_id=am.GFX_CMD_ID_UNLOAD_TA)
+ c.cmd.cmd_unload_ta.session_id = sid
+ try:
+ psp._ring_submit(c)
+ return True
+ except Exception:
+ return False
+
+ def show(tag, st, sid, extra=''):
+ name = STATUS.get(st, 'status %#x' % st)
+ print(' %-34s -> %-24s %s%s'
+ % (tag, name, ('sid=%#x' % sid) if st == 0 and sid else '', extra),
+ flush=True)
+
+ # ---- POSITIVE control: a TA from this machine's own firmware bundle ----
+ import subprocess
+ tab = args.ta_bin
+ if not os.path.exists(tab) and os.path.exists(tab + '.zst'):
+ subprocess.run(['zstd', '-d', '-f', '-o', '/tmp/ta.bin', tab + '.zst'],
+ check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
+ tab = '/tmp/ta.bin'
+ pos_ok = False
+ if os.path.exists(tab):
+ data = open(tab, 'rb').read()
+ # same carve rules as fw/carve_driver.py
+ pos = 0
+ while True:
+ m = data.find(b'$PS1', pos)
+ if m < 0:
+ break
+ pos = m + 4
+ cont = m - 0x10
+ if cont < 0:
+ continue
+ n = struct.unpack_from('<I', data, cont + 0x14)[0]
+ if not (0 < n < 0x400000) or cont + 0x200 + n > len(data):
+ continue
+ body = data[cont + 0x100: cont + 0x200 + n]
+ if body[:4] != b'\x00\x02\x00\x00':
+ continue
+ st, sid = load_ta(data[cont:cont + 0x200 + n])
+ show('POS ctrl: bundle TA @%#x' % cont, st, sid)
+ if st == 0:
+ pos_ok = True
+ if sid:
+ unload(sid)
+ break
+ if not pos_ok:
+ print(' POSITIVE CONTROL FAILED -- a bundle TA did not load, so a')
+ print(' sweep of rejects below would prove nothing. Stopping.')
+ return 1
+
+ # ---- NEGATIVE control ----
+ st, sid = load_ta(b'\xa5' * 0x2000)
+ show('NEG ctrl: junk 0x2000', st, sid)
+ if st == 0:
+ print(' NEGATIVE CONTROL FAILED -- junk accepted. Stopping.')
+ return 1
+
+ # ---- the sweep ----
+ print('\nWindows-driver containers:')
+ accepted = []
+ for p in sorted(glob.glob(os.path.join(args.dir, '*.bin')), reverse=args.reverse):
+ blob = open(p, 'rb').read()
+ st, sid = load_ta(blob)
+ show(os.path.basename(p), st, sid)
+ if st == 0:
+ accepted.append(os.path.basename(p))
+ if sid:
+ unload(sid)
+ time.sleep(0.05)
+
+ print('\nACCEPTED by this PSP: %d %s' % (len(accepted), accepted))
+ return 0
+
+
+if __name__ == '__main__':
+ raise SystemExit(main())