<feed xmlns='http://www.w3.org/2005/Atom'>
<title>amd-psp-re.git/fw/decomp/hdcp.summary.json, branch main</title>
<subtitle>AMD PSP reverse engineering, emulator and vulnerability research</subtitle>
<id>https://git.sl0p.foo/amd-psp-re.git/atom/fw/decomp/hdcp.summary.json?h=main</id>
<link rel='self' href='https://git.sl0p.foo/amd-psp-re.git/atom/fw/decomp/hdcp.summary.json?h=main'/>
<link rel='alternate' type='text/html' href='https://git.sl0p.foo/amd-psp-re.git/'/>
<updated>2026-10-01T18:57:17Z</updated>
<entry>
<title>regenerate all 16 modules on one decoder; align the RPC naming so diffs mean something</title>
<updated>2026-10-01T18:57:17Z</updated>
<author>
<name>user</name>
<email>user@clank</email>
</author>
<published>2026-10-01T18:57:17Z</published>
<link rel='alternate' type='text/html' href='https://git.sl0p.foo/amd-psp-re.git/commit/?id=330786f61827747677ba83953a0e9a80c7ec70d3'/>
<id>urn:sha1:330786f61827747677ba83953a0e9a80c7ec70d3</id>
<content type='text'>
Finishes the rebuild that was interrupted earlier and leaves the corpus on a single decoder version
for the first time since the SVC-opcode work started. All 16 modules rebuilt clean, 16/16 self-port
gates PASS, no duplicate names in any of the 99 builds, no address-derived names.

The naming fix from the previous commit is now actually in the artifacts: 1,038 SVC stubs use the
libdump's sysdrv_rpc_&lt;N&gt; convention instead of my own rpc_&lt;N&gt;. Six names persisted in fw/cgnames from
when I wrote them by hand are converted too, otherwise they would have quietly reintroduced the
inconsistency on the next rebuild. The 85 remaining bare rpc_ names are of the form gcp_asd_rpc_202 --
ASD's libdump names ported into other modules through shared code, so that is the libdump's own
convention and correct to leave.

Effect on diffs, which is why this mattered: the 22.0.4.49 -&gt; 22.0.4.50 pair reported 8 functions
added and 8 removed with no firmware change behind it, and now reports 4. The remaining 4 are a
different and smaller problem, now documented in ta_diff.py: a function can carry a richer name in one
build than another, gcp_cmdFE0C against gcp_cmdFE0C_CreateCryptoSession, because the semantic half
comes from a pass that only reaches some builds.

Corpus-wide the diffs are now usable. Adjacent patch versions average 0.5 changed functions in ras,
2.5 in wspe, 3.3 in merit, 4.6 in opm, up to 26 in xgmi where the builds are genuinely far apart.
Added/removed should be read as "look at this" rather than ground truth; changed-function counts are
sound.

Metrics unchanged by the rebuild at 19,487 meaningful names (67.3%) and 75.8% field share, which is
the point -- it confirms the mixed-decoder tree was not inflating anything.
</content>
</entry>
<entry>
<title>replace the SVC-opcode heuristic with a structural rule: 940/940 against known names</title>
<updated>2026-10-01T18:37:34Z</updated>
<author>
<name>user</name>
<email>user@clank</email>
</author>
<published>2026-10-01T18:37:34Z</published>
<link rel='alternate' type='text/html' href='https://git.sl0p.foo/amd-psp-re.git/commit/?id=e8d0e168563a7eb9ed08a1c66b3aba2cff62258a'/>
<id>urn:sha1:e8d0e168563a7eb9ed08a1c66b3aba2cff62258a</id>
<content type='text'>
The previous pass left 102 stubs unnamed because they load more than one in-range constant. The
tempting fix was to take the first immediate, which matches 4 of 4 multi-immediate stubs that carry an
established name -- and that number is worthless, because all four are the same XGMI function in four
builds. It is n=1 dressed up as n=4, and applying it to 102 functions would have been a guess with a
validation figure attached.

The structural rule earns the names instead: track MOV/MOVW/MOVS immediates per register, then return
whichever register is stored to [SP,#0], which is the first word of the frame R1 is pointed at before
the supervisor call. Against the 940 stubs the libdump already names *_rpc_N it matches 940 and
disagrees on 0, with no abstentions, and it resolves all 102 stubs the count heuristic could not.

So the weaker rule is superseded rather than patched, and the audit records both along with why the
4/4 figure was rejected -- that reasoning is the part worth keeping.

Regenerated gcp, hdcp, merit, opm and asd. Corpus 19,405 -&gt; 19,433 meaningful names (67.1%), no
duplicate names in any of the 99 builds, address-derived still 0.
</content>
</entry>
<entry>
<title>generalise SVC-opcode naming corpus-wide after validating it: 501 stubs, corpus to 67.0%</title>
<updated>2026-10-01T18:28:07Z</updated>
<author>
<name>user</name>
<email>user@clank</email>
</author>
<published>2026-10-01T18:28:07Z</published>
<link rel='alternate' type='text/html' href='https://git.sl0p.foo/amd-psp-re.git/commit/?id=7437f776849d117d27ba4e0eedc7438debeab652'/>
<id>urn:sha1:7437f776849d117d27ba4e0eedc7438debeab652</id>
<content type='text'>
The opcode decode that closed dtm and csu last commit is not module-specific, so I measured its reach
and validated it before applying it anywhere.

Validation came free: the libdump already names 299 single-immediate SVC stubs *_rpc_N, which is
independent ground truth for exactly this decode. The decoded immediate matches the established
number in 296 of 299. The three exceptions are one XGMI function across three builds whose libdump
name uses a different numbering scheme, not a bad decode.

Applied as a pipeline pass, keyed on bytes rather than addresses so it survives database rebuilds,
and only where exactly one in-range immediate survives -- 102 ambiguous stubs stay unnamed rather
than guessed. 501 stubs named: hdcp 87 -&gt; 96, fp 92 -&gt; 95, gcp 87 -&gt; 91, opm 62 -&gt; 75, merit 76 -&gt; 79,
xgmi 75 -&gt; 76, ras 35 -&gt; 38, asd 64 -&gt; 65, powerplay and wspe smaller. Corpus 19,134 -&gt; 19,405
meaningful names, 66.1% -&gt; 67.0%.

A second corroboration turned up after the fact: HDCP's newly decoded hdcp_rpc_161 carries the same
service number as ASD's independently libdump-named asd_rpc_161, so two modules calling the same
SYS_DRV entry agree without either having been told about the other.

Names are uniquified per build; no build contains a duplicate name, checked across all 99.

Worth noting what made this possible: the claim being overturned was my own, that these stubs "carry
no semantic information whatsoever". It was right about the shared thunks and wrong about the
per-module ones, and I had written it down as settled.
</content>
</entry>
<entry>
<title>name all five GP entry-point slots from the image header: TMZ reaches 100%</title>
<updated>2026-10-01T18:14:27Z</updated>
<author>
<name>user</name>
<email>user@clank</email>
</author>
<published>2026-10-01T18:14:27Z</published>
<link rel='alternate' type='text/html' href='https://git.sl0p.foo/amd-psp-re.git/commit/?id=be8f302f9c02216f7b3d754fcb5b23744737852c'/>
<id>urn:sha1:be8f302f9c02216f7b3d754fcb5b23744737852c</id>
<content type='text'>
ta_entry_points read the trampoline's +0xA0 (Create) and +0xB0 (Invoke) slots and threw away the
three between them. Those are TA_DestroyEntryPoint, TA_OpenSessionEntryPoint and
TA_CloseSessionEntryPoint. That is the whole reason TMZ sat at 50% named: it has six functions and
three of the unnamed ones were entry stubs the header identifies exactly.

The slot order is read off GCP rather than assumed from the GP spec. GCP has all five named
independently and its table reads Create, nullsub(destroy), OpenSession, CloseSession, Invoke, with
WSPE and HDCP agreeing and the types agreeing too -- slots 0, 2, 4 return a status, slots 1 and 3 are
void. Running the new derivation against GCP reproduces GCP's own names exactly, which is the check
that makes this evidence rather than convention.

Applied to every module, only where porting left the address unnamed. Per-module: tmz 50 -&gt; 100,
rap 76 -&gt; 98, csu 70 -&gt; 92, oc 90 -&gt; 97, dtm 75 -&gt; 89. Corpus 19,038 -&gt; 19,126 meaningful names
(65.8% -&gt; 66.1%), field share 75.5% -&gt; 75.8%.

RAS disagrees and is deliberately left alone. Its libdump names TA_CreateEntryPoint and
TA_DestroyEntryPoint at addresses the header assigns to OpenSession and CloseSession, a systematic
two-slot shift across all 18 builds. My first run wrote the header names anyway, which left RAS
asserting two different Create entry points -- a contradiction I introduced and then caught by
checking for duplicated roles. A guard now refuses to add a second holder of a role, so the conflict
is reported on every build and nothing is written. No build has a duplicated entry-point role.

Which source is right for RAS stays open: the obvious tiebreaker, argument count, is not decisive on
functions IDA never prototyped.
</content>
</entry>
<entry>
<title>type hdcp2_tx_RepeaterAuth_Stream_Manage: 24 raw dereferences per build down to 1</title>
<updated>2026-10-01T17:02:49Z</updated>
<author>
<name>user</name>
<email>user@clank</email>
</author>
<published>2026-10-01T17:02:49Z</published>
<link rel='alternate' type='text/html' href='https://git.sl0p.foo/amd-psp-re.git/commit/?id=cc6df8f1a2886d1835bd49ed56ea077e30bb8647'/>
<id>urn:sha1:cc6df8f1a2886d1835bd49ed56ea077e30bb8647</id>
<content type='text'>
Two errors of mine found by measuring the typing residue per build instead of summed across builds.

First, the per-function table in AUDIT-TA-STRUCTS.md summed each function's dereferences over all
builds, which made the residue look concentrated -- asd_link_sub_C930 appeared to hold 158 when it
holds 14 in any single build. Measured per (build, function) pair, which is what a reader actually
opens, the distribution is flat: median 2, mean 2.7, p90 4, max 33 across 1,360 pairs. The max is
GCP's start, the entry stub, where raw pointer arithmetic is correct and typing would be wrong.

Second, that measurement surfaced one real target, and it had been excluded for a wrong reason. The
recorded note said its dereferences "go through a local (v10), not a1, so typing a1 would not reach
them". The body says "v10 = a1". The note was wrong, and because it read as a settled finding it was
never rechecked -- the same failure mode as the thunks-only and GCP-only claims.

The real disqualifier was the documented padding rule: offsets 0x1-0x3, 0xD, 0xF9, 0x106 and 0x250
landed inside declared pad arrays. Per union-never-intersection those offsets belong in the layout,
so pad00, pad08, pad55 and pad24E are split to name them. Struct size is unchanged at 0x26C and all
ten observed offsets now resolve to named fields, verified by walking the declaration offset by
offset before applying it.

In the artifacts, across all 7 HDCP builds: 24 raw dereferences per build to 1, with 22 typed field
accesses. Corpus named-only field share 74.5% to 75.6%, raw dereferences 3,661 to 3,506. Named count
unchanged, and HDCP's gate still passes.
</content>
</entry>
<entry>
<title>type and name the HDCP1 authentication handler, the hardware-confirmed overflow site</title>
<updated>2026-10-01T15:41:53Z</updated>
<author>
<name>user</name>
<email>user@clank</email>
</author>
<published>2026-10-01T15:41:53Z</published>
<link rel='alternate' type='text/html' href='https://git.sl0p.foo/amd-psp-re.git/commit/?id=469c4f403cadfa7573c72548a67fcbc64325a2dd'/>
<id>urn:sha1:469c4f403cadfa7573c72548a67fcbc64325a2dd</id>
<content type='text'>
hdcp1_first_part_authentication carries the HDCP overflow that AUDIT-TA-MEMSAFETY-HUNT records
as confirmed on hardware at 0x402cde, with the copy length taken from a byte struct field. It
was still "int a1" with eleven vN locals.

hdcp1_auth_req is derived from the accesses across all seven builds: a dword at 0x00, a dword at
0x04, bytes 0x08..0x0E and halfwords at 0x10 and 0x12, closing at 0x14. The block is what the
invoke entry passes as v7 + 12, i.e. hdcp_req.argA, which is consistent with the request layout
already derived.

The first dword is named session_idx on direct evidence rather than by analogy: the handler reads
it, bounds it with "&lt;= 7", and then indexes a stride-652 table as
"dword_40237C + 652 * session_idx". Eight sessions of 652 bytes.

Typing a2 was already in place from the earlier argN work; a1 now joins it, and
hdcp1_first_part_authentication's locals session_idx and status are named.

Recorded limitation rather than smoothed over: the documented bug site loads its length from
[r5, #0x38], and r5 is NOT v12 in this build -- register allocation differs between the build the
memsafety audit used and the reference here. The local names are therefore keyed on what each
local demonstrably does in this build, and the two that do not correspond are left alone rather
than mapped by assumption.

Also honest about the measured effect: HDCP's field share moves only 70.0% to 70.2%, because
Hex-Rays keeps the explicit "*(_DWORD *)a1" cast at several of these sites even with the pointer
typed, so the signature improves while those particular lines do not. The win here is the
signature and the session_idx/652-stride relationship being legible, not the metric.
</content>
</entry>
<entry>
<title>correct two mislabelled GCP handlers, and stop emitting stale pseudocode</title>
<updated>2026-10-01T15:35:34Z</updated>
<author>
<name>user</name>
<email>user@clank</email>
</author>
<published>2026-10-01T15:35:34Z</published>
<link rel='alternate' type='text/html' href='https://git.sl0p.foo/amd-psp-re.git/commit/?id=08856659e933722835add5d5aeb8e86aaf60e453'/>
<id>urn:sha1:08856659e933722835add5d5aeb8e86aaf60e453</id>
<content type='text'>
Two GCP handlers were mislabelled in the libdump symbol set and the mislabels had been
propagating into every artifact. The duplicate name was the tell: FE0B and FE0D were both called
DestroyAuthenticatedSession.

The code settles it without needing the documents. gcp_cmdFE0C iterates ctx-&gt;crypto, zero-fills a
0x58 gcp_crypto_session and sets crypto-&gt;state and crypto-&gt;key, so it creates a CRYPTO session.
gcp_cmdFE0D computes "(char *)ctx + 88 * HIBYTE(arg10)" -- stride 88, the crypto array at
ctx+0x800 -- while gcp_cmdFE0B uses stride 80, the auth array at ctx+0x300. AUDIT-NEW-TAS-RE.md
states exactly that split, and the hardware findings agree: FINDING-GCP-ACQUIRE-GATE-BYPASS
records 0xFE0C as CreateCryptoSession.

Worth distinguishing from the FE07 case: that one claimed the wrong COMMAND and the dispatcher
cross-check caught it automatically. These two claim the right command and the wrong SEMANTICS,
so no command-id check can see them -- only reading what the code touches. The corrections are
applied by name through a RENAME_FIX table so they hold for every build.

While verifying them, the dispatcher kept printing the old callee name in four builds after the
rename had demonstrably succeeded. Hex-Rays caches pseudocode per function and
remote_ops.rename refreshes only the function it renamed, never its callers, so a stale cache was
reading as a failed rename. Every function's cached text is now invalidated before the artifacts
are emitted.

That turned out to matter far beyond the two names. Applied TYPES were also being hidden behind
stale text: GCP's field share goes 59% to 83.4%, its typed field accesses 1716 to 3081 and its raw
dereferences 1193 to 612, with no new structure added -- the types had been applied all along and
the emitted artifacts were showing pre-typing output. WSPE lands at 91%, HDCP 70%, XGMI 69%,
POWERPLAY 67%. Corpus field share 65.9% -&gt; 66.4%, held down by ASD, which dominates the corpus and
barely moved.

This is the sixth consecutive pass whose main finding was that something already done was not
visible in the output. The remaining low scores are now informative rather than suspect: merit at
0% and opm at 19% are low because their structures are mostly opaque body arrays, not because
typing failed.
</content>
</entry>
<entry>
<title>type the structures that arrive as a2, which the arg1 machinery could never reach</title>
<updated>2026-10-01T15:22:18Z</updated>
<author>
<name>user</name>
<email>user@clank</email>
</author>
<published>2026-10-01T15:22:18Z</published>
<link rel='alternate' type='text/html' href='https://git.sl0p.foo/amd-psp-re.git/commit/?id=df41892b971d6eb24d364c2e479842f505556e76'/>
<id>urn:sha1:df41892b971d6eb24d364c2e479842f505556e76</id>
<content type='text'>
Two of the three largest remaining dereference groups in named functions were not blocked by
analysis at all: hdcp2_process_auth_message_v2 with 161 and hdcp1_create_session with 49 both take
their structure as the SECOND argument, and every typing path built so far rewrites only the first
parameter. retype_arg1 is generalised to retype_arg with a 1-based index, with the old name kept as
an alias so the existing call sites are untouched, and a per-module ARGN_BY_TA table drives it.

hdcp2_auth_msg is contiguous dwords 0x04..0x24 followed by an 8-byte read at 0x28, which is
8-aligned, so it closes at 0x30.

hdcp1_session_req is sparser, and its 8-byte read at 0x04 is NOT 8-aligned. It is declared as two
dwords rather than a 64-bit field: declaring the wide read as one member would force alignment
padding and shift every later offset, which is the same trap asd_link_cfg's unaligned 0x14 qword
read presented. Size verified at 0x20.

HDCP field share 62.8% -&gt; 68.9%, corpus 65.2% -&gt; 65.9%, raw dereferences 7192 -&gt; 6982.

Arg-based typing in named functions is now effectively exhausted, and the numbers say so rather
than my asserting it: the total has gone 2201 -&gt; 1507 -&gt; 1163 across three passes, and every group
still standing touches one or two offsets. A structure for a function that reads two offsets is a
one-field structure, which buys nothing a raw offset did not already show, so the remaining
dereferences are deliberately left alone rather than dressed up.
</content>
</entry>
<entry>
<title>wire in the HDCP signature rule that was measured and then forgotten</title>
<updated>2026-10-01T15:20:15Z</updated>
<author>
<name>user</name>
<email>user@clank</email>
</author>
<published>2026-10-01T15:20:15Z</published>
<link rel='alternate' type='text/html' href='https://git.sl0p.foo/amd-psp-re.git/commit/?id=a4695e17edbf703a8931f34aa1977a44fbd67f06'/>
<id>urn:sha1:a4695e17edbf703a8931f34aa1977a44fbd67f06</id>
<content type='text'>
Re-running the concentration analysis after last pass's fix left
hdcp2_rx_RepeaterAuth_ReceiverID_List at 135 raw dereferences while its signature plainly showed
"struct hdcp2_session *a1". Both facts were true: it is typed in 4 of 7 builds and unnamed in the
other 3, and the name-keyed rule cannot reach a function it cannot find by name.

A signature rule for exactly this case was measured when hdcp2_session was first derived -- 3
unnamed functions, 135 dereferences, zero false positives among the named -- and then never
implemented. It is now wired in through a generic SIG_BY_TA table rather than another
module-specific branch, since ASD already had its own copy of this idea.

The predicate requires every a1 offset to fall inside the structure's declared FIELDS rather than
anywhere within its extent. Accesses landing in padding are treated as disqualifying, because
padding means the layout does not describe that function -- which is the check that would have
caught the hdcp2_tx_RepeaterAuth_Stream_Manage mistype earlier without needing to be reasoned
about by hand.

Checking that condition also found two offsets, 0x222 and 0x224, that real accesses touch while
hdcp2_session had them as padding. Both are now fields; 0x224 is a single byte rather than a
halfword because 0x225 begins the next run, and the size is re-verified at 0x26C.

Two process notes worth keeping. The insertion failed silently the first time -- the anchor text
did not match, the assertion fired inside a heredoc whose output was swallowed by the following
command, and the pipeline then ran happily without the new rule. It was caught only by grepping
for SIG_BY_TA in the generated file rather than trusting that the edit had landed, which is the
same class of silent no-op as the last four passes.
</content>
</entry>
<entry>
<title>make derived names durable in the repository instead of only inside the .i64 files</title>
<updated>2026-10-01T15:10:17Z</updated>
<author>
<name>user</name>
<email>user@clank</email>
</author>
<published>2026-10-01T15:10:17Z</published>
<link rel='alternate' type='text/html' href='https://git.sl0p.foo/amd-psp-re.git/commit/?id=4cf2cb833295692ea6c72a768361aa5e793fe7a7'/>
<id>urn:sha1:4cf2cb833295692ea6c72a768361aa5e793fe7a7</id>
<content type='text'>
This pass fixes a fragility that was actively destroying work rather than adding coverage.

Four IDA databases have now come back corrupted with "worker exited with status 1", and the only
remedy is to delete and rebuild them. Every name derived by fw/ta_cgname.py lived solely in those
databases, so a rebuild discarded them -- GCP silently fell from 83% to 74% named when I wiped its
databases for the dispatcher fix, and I only noticed because I happened to re-measure per module.
Worse, those names cannot be re-derived: once a callee has a name it stops being a sub_* candidate,
so re-running the tool on an already-processed build reports nothing to do.

Three changes:

  * fw/ta_cgname.py persists every name it applies to fw/cgnames/&lt;ta&gt;.json, keyed by build and
    address.
  * fw/ta_re.py re-applies that map at the start of each build, before anything reads names, so a
    rebuilt database comes back with its derived names intact.
  * fw/ta_snapshot_names.py recovers the names applied before the map existed. They are read out
    of fw/decomp/*.index.json, which records name, address and tier per function, and only the
    IDA tier is snapshotted. EXACT, MNEM, FUZZY and DISPATCH are deliberately excluded because
    fw/ta_re.py re-derives them every run; persisting those would bake a derived result into the
    repository and hide a future regression in the porting itself.

1476 names are now durable across 15 modules, including ASD's 847, which would otherwise have
needed a 40-minute wipe-and-rederive to recover.

Verified by doing the thing that caused the loss: XGMI's databases were deleted and rebuilt. It
came back at 238 of 334 named against 239 before, so a full database loss now costs one function
instead of nine percentage points. The single remaining loss is not chased down here, but it is
recorded rather than rounded away.

GCP is restored to 84% and HDCP re-derived cleanly to 86% with a complete map. Corpus naming
stands at 67.0%.
</content>
</entry>
</feed>
