Repository navigation
nfc: apple-stockholm: opt-in read-only Secure Element probe - #1180
Merged
Merged
Conversation
The controller fronts an embedded Secure Element whose card manager is
not ours. Add a way to look at it without being able to change it.
With se_probe=1 (default off, load time only) the driver creates, in
debugfs/apple-stockholm/<dev>/:
nfcee power up, CORE_RESET/CORE_INIT, NFCEE discovery, park
se_probe the same, then, if an NFCEE takes ISO 7816 APDUs
directly, a logical connection to it and a fixed table
of SELECT by name and GET DATA (CPLC, card data, key
information), then park
apdu_allowlist the command table, without touching the hardware
Commands come only from the compiled-in table. Each one, including the
GET RESPONSE and corrected-Le retries the probe builds, passes
stockholm_se_apdu_allowed() right before it is sent: CLA 00 SELECT by DF
name, CLA 80 GET DATA of tags 9F7F, 0066 and 00E0, GET RESPONSE, nothing
else. No authentication, content or key management, life-cycle or
store command can be sent; a failed GlobalPlatform authentication can
lock a card for good. An NFCEE that the probe enables is disabled again.
The files are 0400 and need CAP_SYS_ADMIN. The report is wiped on
release because CPLC carries the chip serial number.
The receive handler now also queues a copy of every packet while a probe
runs, so notifications (NFCEE discovery, connection credits) and data
packets reach the probe; outside a run nothing changes.
On the J700 (firmware 37010160) the controller reports one NFCEE, 0x01:
the HCI network, disabled, HCI access only. No NFCEE takes APDUs
directly, so se_probe stops after discovery and nothing reaches the
Secure Element. Reaching applets there would need HCI pipes, which
change controller state that macOS shares; this does not do that.
KUnit: the table passes the allowlist; INITIALIZE UPDATE, EXTERNAL
AUTHENTICATE, INSTALL, DELETE, LOAD, PUT KEY, SET STATUS, STORE DATA,
PUT DATA, VERIFY, CHANGE REFERENCE DATA, GET STATUS, MANAGE CHANNEL and
GET CHALLENGE are refused, as are SELECT and GET DATA variants with
other classes, P1/P2, tags or lengths; NFCEE protocol parsing including
the J700 notification.
Signed-off-by: Ryan Murray <[email protected]>
Assisted-by: LLM
RyanTheTide
marked this pull request as ready for review
November 10, 2026 07:25
term-guy
added a commit
to term-guy/linux
that referenced
this pull request
Nov 22, 2026
Scanout and PIODMA share the first register window of disp0's DART, as the J813 tree already describes it. aura's T8142 display handoff admits a display stream only on a DART with exactly one register window: with the second window (0x286314000) it refuses the whole handoff, the internal panel included, and Linux stays on the boot framebuffer. Tested on the J704 (aurora-silicon#1180: refused with two windows; aurora-silicon#1181 on: handoff okay, internal panel on the DCP). Signed-off-by: termg <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is an opt-in debugfs probe that looks inside the embedded Secure Element behind the Stockholm NFC controller. It can't change anything there. It's off unless the module is loaded with
se_probe=1. Userspace decoder:aurora-se-probe(aurora-silicon/aurora-diag PR).What it does
se_probe=1(load time only) creates/sys/kernel/debug/apple-stockholm/<dev>/with these files (0400, CAP_SYS_ADMIN):nfceese_probeapdu_allowlistSafety
stockholm_se_apdu_allowed()checks every command again right before it's sent, including the GET RESPONSE and corrected-Le retries the probe builds. It allows CLA 00 SELECT by DF name (P1 04, P2 00), CLA 80 GET DATA of those three tags, and GET RESPONSE, and nothing else. KUnit checks that INITIALIZE UPDATE, EXTERNAL AUTHENTICATE, INSTALL, DELETE, LOAD, PUT KEY, SET STATUS, STORE DATA, PUT DATA, VERIFY, CHANGE REFERENCE DATA, GET STATUS, MANAGE CHANNEL and GET CHALLENGE are refused, along with variants that use other classes, logical channels, secure messaging, P1/P2, tags or lengths.Results
NFCEE_DISCOVER_RSP 00 01and one NTF,01 01 01 01 00. That is NFCEE 0x01, the HCI network, disabled, protocol HCI access only, no TLVs. No NFCEE takes APDUs directly, sose_probestops atapdu-nfcee none: nothing was sent to the Secure Element and nothing was enabled. VEN parked low after each run (gpio-10 out lo). Stock module restored afterwards.kunit.py run --arch=arm64 --kunitconfig=drivers/nfc9/9 (4 new cases), W=1 clean, checkpatch --strict clean.So on these Macs the eSE is reachable only through the controller's HCI network. Reading applets would mean creating an HCI pipe to the eSE's APDU gate, which writes the controller's HCI registry. This PR stops short of that on purpose. The APDU path stays for parts that offer a direct APDU NFCEE, but it hasn't run on hardware yet. Draft for review of that trade-off.
🤖 Generated with Claude Code