From f51ce088ade8b3bc0e816c6a3e4947eb826aca4e Mon Sep 17 00:00:00 2001 From: nandithebull Date: Sun, 29 Nov 2026 01:53:09 -0800 Subject: [PATCH] Docs: OnePlus 6T fingerprint investigation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Record the read-only investigation into the 6T's in-display fingerprint reader: our unit is a Silead GSL7000 (sl7000 TA), not Goodix — GPIO 91 reads 0 and /persist carries fresh Silead calibration. Document the extracted stock blobs (staged outside the repo), the TEE+REE software stack and first-pass sl_fp_* command RE, the keymaster/gatekeeper HAT path, a feasibility read, the ordered next steps, and the hardware safety constraints. Not a shipped feature; face unlock remains the working path. Co-Authored-By: Claude Opus 4.8 --- README.md | 3 +- docs/fingerprint.md | 189 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 191 insertions(+), 1 deletion(-) create mode 100644 docs/fingerprint.md diff --git a/README.md b/README.md index 5b7d7c7..0249df2 100644 --- a/README.md +++ b/README.md @@ -108,7 +108,8 @@ goes through `scripts/as-root`, which prefers run0 and falls back to sudo, doas Face unlock, in the style of Howdy, comes with `just install`: then Settings > Session > Face unlock to add a face and use it for the password dialog and sudo (a PAM module; the password always still works). See [docs/face-unlock.md](docs/face-unlock.md), including what 2D face recognition can't -protect against. +protect against. Fingerprint unlock on the OnePlus 6T is an open investigation, not yet working: +[docs/fingerprint.md](docs/fingerprint.md). ## What works diff --git a/docs/fingerprint.md b/docs/fingerprint.md new file mode 100644 index 0000000..49aacbb --- /dev/null +++ b/docs/fingerprint.md @@ -0,0 +1,189 @@ +# Fingerprint unlock on the OnePlus 6T (`fajita`) + +Status: **research / not working yet.** This is a feasibility investigation, not a +shipped feature. It records what the in-display fingerprint hardware on our 6T +actually is, what we extracted from the stock firmware, how the stock software +stack is layered, and the ordered plan to get an enrol/match working under +Chandra. For unlocking *today*, use [face unlock](face-unlock.md) — it already +works; this is a longer project that may still hit a wall (see +[Feasibility](#feasibility)). + +Everything here was gathered **read-only** over USB from the connected handset +(`chandra-6t`, `172.16.42.1`) and by static analysis of extracted blobs on the +desktop. Nothing was written or flashed to the phone. + +## 1. The hardware — it's Silead, not Goodix + +`fajita` shipped with one of two in-display optical sensors, and the stock +detect driver (`drivers/oneplus/drivers/input/fingerprint/fingerprint_detect/`) +reads **TLMM GPIO 91** to tell them apart: + +| GPIO 91 | `sensor_version` | Sensor | TrustZone app | +|---|---|---|---| +| `1` | `0x04` | Goodix GF9508 | `gfp9508` | +| `0` | `0x05` | **Silead GSL7000 (our unit)** | **`sl7000`** | + +On our phone **GPIO 91 reads `0`** → Silead GSL7000. The on-device calibration +state confirms it: + +- `/mnt/vendor/persist/silead/fpcal4.dat` (133 KB), `fpcal5.dat` (33 KB) — + **real, dated 2026-10-16**, header magic `ad1e5100 0f916b58 00126062 …`. +- `/mnt/vendor/persist/data/{BMatrix,caliParamsInfo,chartbase}.so` (Goodix) — + stale 2008-epoch timestamps, i.e. unused. +- `/mnt/vendor/persist/engineermode/fpcalibrationresult`: all SPI / capture / + chart factory tests `PASS`, `SENSOR_VENDOR: O-Flim`, `CHIPID 0x51303147...` + (`"GSL7000"` in ASCII: `51 30 31 47` = `Q01G`…). + +So any port should target the **Silead `sl7000`** path. The Goodix prior art +(`wrobelda/goodix-fp-spi-linux`, `yarons/beryllium_fpc`) is still useful for the +QSEECOM kernel plumbing, but **not** for the TA protocol — ours is a different +vendor. + +### Board wiring (from stock `fajita.dtsi`) + +| Line | Pin | +|---|---| +| Reset | TLMM `35` | +| IRQ | TLMM `121` | +| Enable | TLMM `80` | +| ID (sensor select) | TLMM `91` | +| Supply | `pm8998_l22` (`ldo22`), 3.2 V / 50 mA | + +Mainline `sdm845` has no fingerprint node; these pins are currently unclaimed +(verified live: all four read as plain inputs, `UNCLAIMED` in pinctrl). + +## 2. What we extracted (durable copy) + +Staged to **`~/.local/share/chandra-fp/blobs/`** (outside the repo — these are +proprietary signed blobs and must **not** be committed; re-extract from the phone +if the copy is lost). Provenance (sha256): + +``` +sl7000.elf daa5814d… reassembled Silead TA (from modem_a/image/sl7000.b0*) +gfp9508.elf 4f9765ba… reassembled Goodix TA (unused on our unit) +keymaster_a.mbn 222e7491… keymaster/gatekeeper TA (partition dump) +vendor/libsl_fp_impl.so f780dfa3… Silead HAL +``` + +Plus the rest of `vendor/` (`libsl_fp_algo.so`, `libsl_fp_prepro.so`, +`libsl_fp_nosec.so`, `libsl_fp_impl_util.so`, `goodix.fod.sdm845.so`, +`silead.fod.sdm845.so`, the keymaster/gatekeeper `@qti` impls, `init.oem.rc`, +`init.target.rc`) and the split `.mdt`/`.b0*` TA images under `modem/`. + +The modem partition carries TAs for **both** sensors (`sl7000.*`, `gfp9508.*`) +plus `fpc1228`, `gfp5288`, etc. — OnePlus ships one image for every panel/sensor +variant and selects at runtime. + +## 3. Stock software stack (how the sensor is actually driven) + +``` + Android HAL Linux kernel TrustZone (QSEE) + ─────────── ──────────── ──────────────── + libsl_fp_impl.so ── ioctls ─► /dev/silead_fp (power/reset/IRQ, HBM) + silfp_* (flow) ── SPI ────► /dev/spidev0.0 (REE imaging — Silead does + sl_fp_* (TA cmd) some capture in normal world) + │ ── QSEECom ─► /dev/qseecom ──► sl7000 (templating + match) + ▼ keymaster64 (HAT / key) + libsl_fp_algo.so / libsl_fp_prepro.so (image pre/post-processing, REE) +``` + +Key difference from the Goodix FOD parts: **Silead is a TEE+REE hybrid.** It opens +`/dev/spidev0.0` and does part of the imaging in the normal world +(`libsl_fp_algo.so`, `libsl_fp_prepro.so` carry the capture/denoise/enroll +pipeline), while the `sl7000` trustlet handles secure templating and matching. +That is friendlier than a pure-TEE Goodix part — more of the pipeline is +reachable from Linux without the TA. + +The HAL also owns the optical display requirements directly: `sl_fp_set_hbm_mode` +(High Brightness Mode) and `read_brightness` / `set bright_value` against the +backlight sysfs node, plus the `#00ff00` FOD illumination that the compositor +would draw. + +### RE progress on the `sl_fp_*` command layer (first pass) + +`libsl_fp_impl.so` holds both the HAL flow (`silfp_*`) and the TA/kernel senders +(`sl_fp_*`). The senders split two ways: + +- **Kernel ioctls to `/dev/silead_fp`** — control plane. Recovered opcodes: + `sl_fp_set_hbm_mode` → `0x32`, `sl_fp_set_tpirq_enable` → `0x2`, + `sl_fp_calibrate` loops a sub-op `0x1` over steps 3/4/5, `sl_fp_init` → `0xa`. +- **QSEE commands to `sl7000`** — `sl_fp_capture_image`, `enroll_start/step/end`, + `auth_start/step/end`, `load/verify_enroll_challenge`. These funnel through a + shared buffer-builder before `silfp_qsee_send_modified_command_to_tz_with_ion` + (→ `QSEECom_send_modified_cmd`); the per-command TA opcodes are assembled in + that helper and still need tracing. **This is the main remaining RE task** + (see Step 1 below). A live trace of the stock HAL is the fast way to get it; + the alternative is finishing the static disassembly of the helper + the TA's + dispatcher in `sl7000.elf`. + +## 4. The gatekeeper / keymaster path — crossable here + +The usual wall on mainline Linux is that the fingerprint TA wants a Gatekeeper +hardware-auth-token (HAT) to enrol, and the keymaster/gatekeeper state is never +initialised outside Android. The good news from `keymaster_a.mbn`: + +- Its command table exposes the full HAT-minting chain proven on sister 2018-era + Qualcomm hardware (Pixel 3a / SDM670, `samcday/sam-sargo#11`): + `0x200`/`0x207` (init), `0x20e` `GET_HMAC_SHARING_PARAMS`, + `0x20f` `COMPUTE_SHARING_HMAC`, then `0x1001` `GK_ENROLL` / `0x1002` `GK_VERIFY`. +- Gatekeeper is implemented **inside** `keymaster64` (resident `app_id=1`), KM3-era + — the same design Sam Day drove from Linux to mint real 69-byte HATs. + +QSEECOM itself is alive on our mainline kernel: boot log shows +`qseecom: found qseecom with version 0x1400000`, `SHM Bridge not supported` +(falls back cleanly), with `CONFIG_QCOM_QSEECOM=y` and `CONFIG_QCOMTEE=m` built in. + +## 5. Feasibility + +More promising than a first glance suggests, but still a real project with a +genuine make-or-break step: + +- **For us:** a Silead sensor with valid on-disk calibration, a partly-REE + imaging pipeline, reachable enrol/match TA commands, and a keymaster exposing + the HAT path proven on sister hardware. +- **Against us:** the TA may still refuse enrol without a correctly-minted HAT + (the `beryllium_fpc` Goodix dead-end), and the `sl7000` opcode map isn't fully + recovered yet. + +## 6. Next steps (cheapest / safest first — each gates the next) + +1. **Recover the live `sl7000` command sequence.** Either trace the stock + OxygenOS HAL (`frida`/`LD_PRELOAD` on `libQSEEComAPI.so`, logging every + `QSEECom_send_modified_cmd` to `sl7000`/`keymaster64` during a real enrol + + unlock), or finish the static RE of the shared sender + `sl7000.elf` + dispatcher. This is the biggest unknown and needs no kernel work. +2. **Port a QSEECOM TEE driver** (Wróbel + Sam-Day `qcom-qseecom-tee` series + + supplicant, listeners 10 / 28672) onto `linux-sdm845 7.1`. Success = `sl7000` + loads and answers a no-op over `/dev/tee0`. +3. **HAT bootstrap, RAM-booted** (`fastboot boot`, nothing flashed): run keymaster + `0x200→0x207→0x20e→0x20f` then `GK_ENROLL 0x1001`. **Make-or-break:** it either + mints a HAT (like SDM670) or returns `VERIFICATION_FAILED` (like the Poco). +4. **Only if 3 passes:** Silead optic enrol/match using the on-disk `fpcal4/5.dat` + → Chandra FOD illumination spot + HBM via + [`compositor/shell/backlight.mbt`](../compositor/shell/backlight.mbt), synced to + the touch-down → libfprint + PAM, mirroring + [`face/pam_chandra_face.c`](../face/pam_chandra_face.c) and the existing + [auth dialog](auth-dialog.md). + +## 7. Safety — do not + +- **Do not probe the sensor's SPI GENI SE from Linux** (the TrustZone/XPU-owned + SE). On the Poco F1 any Linux MMIO access to it hung the whole SoC and needed a + power-cycle. The TA owns that bus. +- **Do not enable the mainline-disabled Crypto Engine DT node** + (`crypto@1dfa000`) — it's shared with TZ and triggers a hard reset. +- **Do not write or wipe `persist`.** The Silead `fpcal4/5.dat` are our only + factory optical calibration; regenerating them needs physical calibration + fixtures. Everything above reads `persist` read-only. +- Prefer **RAM-boot** (`fastboot boot`) for every on-device kernel test so nothing + is flashed; a power-cycle returns to the installed system. + +## Prior art + +- [`wrobelda/goodix-fp-spi-linux`](https://github.com/wrobelda/goodix-fp-spi-linux) + — working QSEE enrol/match stack (kernel TEE driver, supplicant, libfprint) on + SM8250. Goodix TA, but the QSEECOM plumbing is reusable. +- [`samcday/sam-sargo#11`](https://github.com/samcday/sam-sargo/issues/11) — HAT + minting on 2018-era QSEE (SDM670), the blueprint for Step 3. +- [`yarons/beryllium_fpc`](https://github.com/yarons/beryllium_fpc) — SDM845 + + Goodix TA loads on mainline 7.x; documents the gatekeeper dead-end.