Repository navigation
Conversation
read_capture() wraps its receive buffer in Capture only after SPI transfer and CRC validation. A bus error after a partial or complete receive, or a checksum mismatch, frees the buffer without running Capture's wiping destructor. Construct the wiping owner before the transfer so every subsequent error return clears initialized receive bytes. Keep successful ownership and the existing allocation and input-validation behavior unchanged. Add a host regression using the production read function and destructor with synthetic SPI and allocation boundaries. All nine cases pass; the unpatched source fails the three receive-error cleanup cases. The source tree also builds native arm64 Image, modules and DTBs with LLVM 18 and Rust 1.85. This is buffer-lifetime hardening; no information disclosure to an unprivileged caller has been demonstrated. Fixes: c1240e7 ("soc: apple: add Apple SEP driver (Touch ID and key sealing)") Assisted-by: Codex:GPT-6 Signed-off-by: Matt <[email protected]>
scottjones
left a comment
There was a problem hiding this comment.
The fix looks right to us. At the base, read_capture() only wraps the receive buffer in Capture after the transfer and the CRC check pass, so a bus error or a checksum mismatch (drivers/soc/apple/sensor.rs:815 and :823 on this branch) frees a KVec holding image bytes without running the wiping Drop. Building Capture before sep_sensor_xfer2 (sensor.rs:801) covers both of those and nothing else. The success path returns the same buffer as before, and the length and allocation errors happen before any image bytes exist.
A few things before we merge:
-
tools/aurora-ci/host-tests.json:1112 pins this suite to Rust 1.99.1. Every other suite that pins Rust uses 1.85.0 or 1.93.1, and the commit message says the tree builds with Rust 1.85. The fixture doesn't need anything newer, so please use 1.85.0 and spare CI an extra toolchain install.
-
The PR description doesn't match the bug. Each read allocates a fresh buffer, so there's no data from a previous capture in it, and the callers in sbio.rs (1684, 2743) never see the buffer on error. The real issue is image bytes going back to the allocator unwiped. The commit message gets this right. Could you trim the description down to that and drop the hardware qualification text, which doesn't apply to this change?
-
The only check that ran on this PR is the vouched-author gate, so the new suite hasn't run in CI yet. We'd like a ci:build run before merging.
We read through the fixture. It pulls the real crc16_ansi, Capture, its Drop and read_capture out of sensor.rs, and by our reading the three receive-error cases fail against the base source and pass with the fix. We haven't run it ourselves yet.
Signed-off-by: Matt <[email protected]>
|
Thanks. I pinned Rust to 1.85.0. The description now says what the change does (receive buffers freed without wiping on error) and no longer includes the unrelated hardware notes. The test passes locally, but I haven't run the upstream |
|
The unchanged head is 9e899a8. Kernel CI run 40620659436 still reports action_required. Please apply ci:build/approve the held run as appropriate. Local tests and object compilation do not replace upstream CI. |
scottjones
left a comment
There was a problem hiding this comment.
Thanks, Matt, this looks good to us. The only change since our last pass at 4d07dfd is 9e899a8, which moves the capture wipe suite to Rust 1.85.0 in tools/aurora-ci/host-tests.json and nothing else, and the description now matches the bug. We ran it on our M3 Air in a test kernel with this PR and saw no Touch ID regression: lock-screen unlock worked, a wrong finger was rejected, password fallback worked and the SEP log was clean. On the MacBook Neo one run hit repeated no-matches and a lockout after a suspend, but three later runs on the same kernel were clean (17 unlocks, 0 no-matches, including after a 9-minute sleep), so we think that was intermittent and not this PR. It's small and defensive, and we're happy to see it in the RC once ci:build has run on this head.
A failed sensor transfer or CRC check can free a receive buffer containing fingerprint image bytes without wiping it. Each read allocates a fresh buffer; callers never receive it on error.
Construct the existing
Captureowner before starting the transfer so its wipingDropruns on those error paths. The success path and pre-transfer allocation/length failures keep their existing behavior.Validation: the production-source fixture passes all nine cases with Rust 1.85.0. Against the parent sensor source, the three complete-transfer-error, partial-transfer-error and CRC-rejection cases fail because image bytes are freed unwiped; the other six still pass. The registered suite also passes through
tools/aurora-ci/host-tests.pylocally. Its manifest now uses the existing 1.85.0 CI toolchain.The final SEP Rust object and C shims also compile with Rust 1.85.0 against the archived qualified kernel headers. They emit one inherited unused-constant warning in unchanged
store.rs. This is an object compilation check, not a full kernel build.Upstream
ci:buildis still required before merge. The current contributor has no triage permission; a maintainer must applyci:buildto the final pushed head and approve held Actions runs if necessary. The vouched-author approval check is not a build result.AI-assisted with OpenAI Codex. Signed-off-by trailers carry the contributor's authorized DCO certification.