Skip to content

soc: apple: sep: read the pnon digest on the two-to-four-page SEPs - #1761

Closed
RyanTheTide wants to merge 1 commit into
integration/aurorafrom
sepxars/pnon-legacy
Closed

RyanTheTide wants to merge 1 commit into
integration/aurorafrom
sepxars/pnon-legacy

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

The pnon endpoint on M1 Pro, M2 and A18 Pro advertises 2 to 4 pages each way and expects the older mailbox format for its calls. The client from #1734 only spoke the M4 Pro format, so it left those SEPs alone (absent).

  • Two mailbox formats, picked from the discovery layout:
    • 5 to 7 pages (M4 Pro): tag 2, request length in data. The reply has the status in type and the reply length in data. Unchanged.
    • 2 to 4 pages (M1 Pro, M2, A18 Pro): tag 1, request length in bits 16-31, data 0. The reply has the reply length in bits 16-31 and the service result in data.
  • The out-of-line request and reply are the same in both: the 32-byte hcPB header with operation 0x0e, and an 80-byte hrPB reply carrying the 48-byte digest.
  • Buffers on the 2 to 4 page layout: 4 pages each way. Any other layout is still left alone.
  • The format is never retried in the other one. The A18 Pro answered the tag 2 word with tag 2 and data 1, a refusal with no reply bytes. The old decoder read that as a one-byte reply. A tag 2 word can't complete a tag 1 call, and a tag 1 word can't complete a tag 2 call.

Tests

  • KUnit sep.kunitconfig: 601 run, 599 pass, 2 skip. apple_sep_pnon 10/10. The new cases cover the tag 1 request word, tag 1 success and refusal replies, the A18 Pro's tag 2 answer, cross-format words and the layout-to-format mapping.

Assisted-by: LLM (Claude:Opus 5.5)

The pnon endpoint on M1 Pro, M2 and A18 Pro advertises two to four
pages each way and expects the older mailbox format for its calls:
tag 1, the out-of-line length in bits 16-31 and data zero. Its reply
carries the reply length in bits 16-31 and the service result in data.
The A18 Pro answered the tag 2 request with tag 2 and data 1, a refusal
with no reply bytes, which the driver read as a one-byte reply.

The out-of-line request and reply are the same as on M4 Pro: the
32-byte request header with the blessed-digest operation, and an
80-byte reply with the 48-byte digest. Pick the format and the buffer
sizes from the discovery layout (four pages each way on the
two-to-four-page layout) and never retry in the other format. Any
other layout is still left alone.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Blockers: 2.

  1. There is no hardware run, and this changes what every M1 Pro, M2 and Neo boot sends to its SEP. Before, offer() returned None for the two-to-four-page layout and the driver never touched the endpoint. Now pnon.rs:123-140 registers four pages each way and sends a tag-1 call on every boot of those Macs. The tag-1 format, the bits 16-31 length, and data as the result come from the PR text only; the one observation cited is the A18 Pro refusing tag 2. check_reply() fails closed on a wrong reply, so a bad guess only gives a missing digest. But what the enclave does with a malformed call (ignore, error reply, or crash the endpoint or the SEP and take Touch ID and key storage with it) is unknown. That needs a row on each SoC class that newly gets the call before it can merge, given that the payoff is a root-only diag file.
  2. The commit carries an Assisted-by: LLM trailer. Commits should carry only the human Signed-off-by; the Assisted-by line belongs at the end of the PR body (already there).
  3. classify() for Tag1 (pnon.rs:211-214) takes any tag-1 word on the endpoint as the reply while an exchange waits. The Tag2 arm still requires param == 0. If these SEPs send anything else on tag 1 (a notification, a late answer to a timed-out call), it completes the exchange with a garbage status and length. The hrPB check then refuses it, but the real reply is dropped as unexpected. If the reply format has a fixed field (the PR says bits 16-31 are the length; what about the upper half of data?), check it the way the Tag2 arm does.

HW row: on this head, one boot each on an M1 Pro (J316s), an M2 and a Neo J700, plus the J616s to show M4 Pro is unchanged. Pass criteria: diag/local_policy_digest reads 48 bytes that match across two boots and change after a LocalPolicy update only; no pnon refusal or unexpected-message lines; Touch ID match and sep-key sign still work after the call; s2idle x2; 0 AVC, 0 failed units, no new kernel errors.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Replaced by #2810: the same changes with the commit trailers fixed, on the current integration/aurora.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant