SIGFM verify crashes fprintd: fp_print_equal() asserts on FPI_PRINT_SIGFM
Summary
Any fingerprint verify through a driver using SIGFM (FPI_PRINT_SIGFM) crashes fprintd. On a Chipsailing CS9711 this means every unlock attempt kills the daemon: the reader captures the finger, then the process dies before it can report a match.
Root cause
fp_print_equal() in libfprint/fp-print.c switches on the print type and handles FPI_PRINT_RAW and FPI_PRINT_NBIS only. FPI_PRINT_SIGFM was added to FpiPrintType by 82d44df ("feat: add basics of sigfm impl") but never given a case, so a SIGFM print falls through to:
case FPI_PRINT_UNDEFINED:
g_assert_not_reached ();
g_return_val_if_reached (FALSE); follows, but the assert aborts first.
fpi-device.c already skips FPI_PRINT_NBIS for both equality sanity checks, because a freshly scanned print is never equal to the enrolled template it matched. SIGFM has the same property and is missing from those exclusions:
libfprint/fpi-device.c:2173(verify result check)libfprint/fpi-device.c:2273(gallery check in the identify/verify report path)
So the verify path calls fp_print_equal() on every SIGFM scan, reaches the assert, and aborts.
Reproduction
- Driver sets
img_class->algorithm = FPI_PRINT_SIGFM(ascs9711.cdoes). - Enroll a finger.
fprintd-verify <finger> <user>.
Result: the daemon dies.
file ../libfprint-CS9711/libfprint/fp-print.c: line 636 (fp_print_equal): should not be reached
Driver reported a match providing a scanned print that is not matching any in the gallery.
systemd[1]: fprintd.service: Main process exited, code=dumped, status=4/ILL
With assertions compiled out the failure is a SIGSEGV in fp_context_finalize during the teardown that follows, so it is not a debug-build-only problem:
#0 fp_context_finalize (libfprint-2.so.2 + 0x153a3)
#1 g_object_unref
#2 fprintd + 0xd049
Suggested fix
Do not define SIGFM equality — the comparison is meaningless for this type. Exempt SIGFM from both checks in fpi-device.c, exactly as NBIS already is:
fpi_print_get_type (print) != FPI_PRINT_NBIS &&
fpi_print_get_type (print) != FPI_PRINT_SIGFM &&
and give fp_print_equal() an explicit SIGFM arm that warns and returns FALSE rather than asserting, naming fpi_print_sigfm_match() as the correct comparison.
Both changes exist in danielrod36/libfprint-CS9711 commit 74b1e90 ("fpi-device,fp-print: stop comparing SIGFM prints for equality"), verified live: verify-match succeeds with a clean journal, where the unfixed build crashed on every attempt.
Scope
Not CS9711-specific. Any driver with algorithm = FPI_PRINT_SIGFM hits this. It is not an upstream libfprint issue — SIGFM does not exist in gitlab.freedesktop.org/libfprint/libfprint (upstream FpiPrintType is UNDEFINED, RAW, NBIS only), so this fork is the only place the type is reachable.