Commit graph fingerprintd/README.md
Author SHA1 Message Date
ac0a147e95
standby unlock: a locked session unlocks by finger without PAM
Phosh's lock screen cannot take a fingerprint: its PAM conversation
answers every prompt with the password. So the daemon follows the seat
session that is locked and in front (logind LockedHint + Active), runs a
verify of its own while the display is on (backlight bl_power), and
answers a match with logind's Session.Unlock.

Only fingers named in that session owner's map unlock. The map is
re-read at every arm and verdict, and a delete cancels a running standby
verify, so a finger deleted while locked stops counting at once. A
verdict from an earlier lock or another session is dropped. no-unlock
rules and FingerMatched apply as for a client match. A client Claim
cancels standby, and its Release, or a claim that fails while pending,
re-arms it. --standby-unlock=off disables it.

Tested on the dev phone before the review fixes (map re-read,
front-session tracking, cancel ordering, pending-claim re-arm): under
Phosh, six unlocks by two fingers and an unnamed template refused; under
Plasma, kscreenlocker's pam_fprintd unlocks while standby yields and
re-arms. With the fixes: suites 8/8, and a daemon restart under a lock
screen picks the locked session up. Not exercised: standby's own
Session.Unlock on kscreenlocker, user switching.
2026-09-23 17:53:11 +02:00
845c658786 Merge branch 'main' of https://forgejo.catcrafts.net/Catcrafts/fingerprintd
All checks were successful
package / package (push) Successful in 1m30s
2026-09-08 16:50:32 +02:00
c29eb99ecb Update README.md
All checks were successful
package / package (push) Successful in 1m37s
2026-09-06 13:56:44 +00:00
7a0a86a7f0 packaging: cross-compile for the FP6's own cores
The phone is one SoC, 4x Cortex-A520 + 4x Cortex-A720, and the package is
built for nothing else, so build for it: -march=armv8.6-a+fp16fml+aes+sha3+sm4
-mtune=cortex-a720 instead of the generic Armv8 baseline, for the daemon, the
agent and libqcomtee alike. That is gcc's own -march=native expansion on the
phone, re-based on armv8.6-a so clang can express the same set; 8.6 is the
highest level whose mandatory set the phone exposes (8.7 would assume WFxT,
9.x SVE2 - neither is in its hwcaps, and SVE2 code would SIGILL). Same string
as the fp6-img aports and kernel.
2026-09-06 00:02:41 +02:00
09b50bdabf readme
All checks were successful
package / package (push) Successful in 1m30s
2026-09-05 22:35:23 +02:00
e6fcdb3a0d readme
Some checks failed
package / package (push) Has been cancelled
2026-09-05 22:34:39 +02:00
20bd4aa975 readme
All checks were successful
package / package (push) Successful in 1m41s
2026-09-05 19:58:35 +02:00
2da03d1595 readme
Some checks failed
package / package (push) Has been cancelled
2026-09-05 19:58:09 +02:00
ba882ee47b Learning off by default: it makes matching worse on this hardware
Jorijn asked for the control that settles it -- a fresh template, tested with
learning off -- and ran it twice.

  fresh template, 0 folds     30/30, two consecutive blocks of fifteen
  same lineage, 40 folds      12/15
  same lineage, 185 folds     total failure, 108 consecutive rejections

Every one of those measured with learning switched off during the measurement
itself, so nothing moved underneath the numbers, and the fresh-template result is
replicated back to back. Three points, monotonic in fold count.

The mechanism has been visible since the 185-fold collapse: the frames one press
contributes are near-duplicates of a single image from one finger position, so
folding them spends the template's ninety-six slots on that position and evicts
the diversity a twenty-sample enrolment put there. Stock's updates are spread
across many separate presses hours apart, which is where diversity actually comes
from.

And there is nothing on the other side of the scale. A plain enrolment measures
thirty out of thirty, so learning has no headroom to improve anything, and it has
never once been observed to raise a rate under conditions worth defending -- the
run that once looked like proof was confounded by a freshly wiped sensor and a
user learning the technique, both of which Jorijn identified himself while the
numbers were still climbing.

The code stays behind --learn=1. The finding is about this trustlet's algorithm,
not about the idea.
2026-09-05 02:11:43 +02:00
c5fc3afc77 Add fplearn.sh, because a cumulative measurement is a protocol not three commands
Learning rewrites the template on every matched press, so run two is not a
repeat of run one and an A/B against a moving template is not an A/B. The order
is the measurement:

  enrol   a fresh template at 20 samples with no position prompts, which is also
          the outstanding replication of the best result this lane has seen
  base    learning off: the clean number for that template, and the only figure
          comparable to every rate already recorded
  trend   learning on, three times: the rate should climb, with the container
          size as an independent witness that it is the template moving

A rate that climbs while the body grows is learning. A rate that moves while the
body does not is noise, and the daemon's own learn: lines say which. Run one of
the trend is not evidence that learning helped; it starts on the template the
baseline ended on.

One limit the script states rather than letting someone discover it: learning
only fires on a press that matched, so a template that never matches never
improves. That is why the protocol re-enrols instead of building on a template
already measured at 0 of 10.
2026-09-03 17:46:33 +02:00
82ceae988e README: what real use taught about the verify loop, and the revert 2026-09-02 23:19:24 +02:00
1368b2f474 README: it works end to end through fprintd's own clients 2026-09-02 22:29:59 +02:00
93692c9505 Add the cross-build sysroot recipe, verified on the device
packaging/make-sysroot.sh populates a minimal Alpine aarch64 rootfs with
apk-tools-static, so a cross build needs no root, no qemu and no phone. Adapted
from imsd's, plus glib-dev for the bus layer that is coming.

Building against a real Alpine sysroot means the binary links dynamically
against the phone's own musl and libc++ -- libc++, libc++abi, libunwind and
libgcc_s are all already on pmOS. The harness this daemon replaces had to be
built -static, but only because it was built with the host's glibc toolchain;
that constraint was never about the target.

The pipeline is proven end to end rather than assumed: the cross-built binary
runs on the phone, and all five core suites pass there too -- on the real
hardware, not just under qemu-aarch64. That matters for modules that are almost
entirely little-endian field packing and offset arithmetic.
2026-09-02 17:34:27 +02:00
1a54b5480c README: the core is complete 2026-09-02 17:22:51 +02:00
1d26852a6b Initial commit: the gpfile wire format, pinned by two real containers
fingerprintd will own the FP6's fingerprint sensor: the rail, the QTEE session,
the storage callbacks QTEE makes back into the normal world, and
net.reactivated.Fprint so pam_fprintd and the desktop need no changes. None of
that runs yet. What is here is the first core module and the machinery around
it.

Fingerprintd:Sfs is the gpfile listener's frame -- the callback that carries
47 of 66 storage requests during an enrolment. It is parse, reply and root
mapping only: no file I/O, no TEE, no allocation of the shared buffer. The
daemon shell supplies those, which is what lets every byte-level decision be
tested on a dev box with no phone.

The module exists mainly to hold one fact. READ answers at req+0x00c and WRITE
reads its payload from req+0x110, because the frame is a union: a WRITE still
needs its path while the payload is copied out, so it sits past the 256-byte
path field, while a READ has consumed the path and packs its reply over it.
Conflating them is wrong in both directions with the same symptom -- the
container does not round-trip, QTEE's HMAC check fails, and the file is
unlinked as tampered on the next session.

So the tests do not assert the constants against themselves. They load two real
containers off the phone -- one written correctly, one written with the offsets
conflated -- and re-derive the bug: the broken one opens with ASCII path text
rather than a binary HMAC, that text is the group name from character 8 because
the read offset is 8 bytes into the path field, and the real container sits
exactly 0x104 further in. Then a write-store-read round trip must be the
identity, and the same round trip through a single offset must not be.

O_TRUNC gets a static_assert of its own. QTEE writes a container as
write(0,4096), write(4096,N), write(0,4096), so truncating on open leaves 4096
bytes where a 258850-byte template belongs; it unlinks a file it means to
shorten rather than relying on the opener.

Verified by mutation: conflating the offsets, making DataOffset return the read
offset for writes, and setting O_TRUNC each fail the suite.
2026-09-02 16:02:46 +02:00