Skip to content

lock: re-arm fingerprint reader with a fresh PAM context per attempt - #12426

Closed
slr01 wants to merge 4 commits into
omacom:quattrofrom
slr01:lock/fingerprint-rearm-factory
Closed

slr01 wants to merge 4 commits into
omacom:quattrofrom
slr01:lock/fingerprint-rearm-factory

Conversation

@slr01

@slr01 slr01 commented Sep 18, 2026 •

Copy link
Copy Markdown

Closed

The stock A/B capture (issue comment) refuted this PR's premise: authenticating clears normally under stock and the 250 ms loop re-arms correctly — the dead-reader state is daemon/driver-side (thermal gating + a genuine fprintd SIGSEGV), not a stuck flag. A per-attempt factory does not change that symptom, and the leak this branch fixed only exists because of the factory's createObject(root) parenting.

The load-bearing fix is the blank gating, kept in #12420: stop arming the reader while the display is blank so the overnight self-heating cycle that trips the thermal gate never starts. Closing this in favor of that.

@llstrk

llstrk commented Sep 25, 2026

Copy link
Copy Markdown

Automated AI review

Community review: Independent automated community review, unaffiliated with the Omarchy team, intended to help prepare PRs for their review.

Outcome: The per-attempt PamContext lifecycle is mechanically sound, but Quickshell's source does not support the stated root cause, so the factory is unlikely to change the reported CV3 symptom. The change also breaks one existing shell test, and the new "stop fingerprint during password check" behavior is not enforced for the whole check. Reviewed head: c4291018 (the factory commit, read together with the stacked #12420 commit).

Verified (source):

  • Inside the onCompleted/onError handler functions, this is the PamContext instance, so the ctx === fingerprintPamInstance check matches the live instance.
  • Every path (start failure, completion, error, stop, unlock) destroys its instance. Destroying an active context kills and reaps its PAM subprocess. No instance leak or orphaned subprocess was found.
  • The change applies cleanly to current quattro. Upstream's later Service.qml edits (video poster) do not interact with the fingerprint code.

Stated root cause is not supported by Quickshell's PamContext

Quickshell clears active before it emits completed or error, so a PAM error in the middle of identification cannot leave the context active. This ordering has been unchanged in src/services/pam/qml.cpp since 2024, so it holds for every packaged release (inspected at v0.3.1 and current master).

Base code, PAM error reported by the subprocess (Quickshell qml.cpp, onError):
  abortConversation()        -> active = false
  emit error(e)              -> base onError: retry timer restarted
  emit completed(Error)      -> handleFingerprintFinished: retry timer restarted
  250 ms later: startFingerprint() sees active == false -> start() -> new PAM conversation
  • start() does not fail synchronously for PAM results. A code 9 (PAM_AUTHINFO_UNAVAIL) also arrives asynchronously over the subprocess pipe, just like the "mid-identification" error.
  • active stays set only while pam_authenticate has not returned. In that case the PR waits in exactly the same way, because startFingerprint() returns while fingerprintPamInstance is set. pam_fprintd, configured by Omarchy with no options, bounds that wait with its default 30 s timeout.

Impact: The PR does not demonstrate that it fixes the 15:01:45/15:01:55 capture. The actual cause of that stall is not established. Possible causes include pam_fprintd still waiting on fprintd, re-arm attempts that fail before reaching the driver, or #12420's blank gating.

Suggested change: Capture diagnostics during the stall that show which case the reader is in:

  • the Quickshell PAM log (Error while authenticating ... (code N), with QT_LOGGING_RULES="quickshell.service.pam.debug=true" for subprocess exits),
  • qs ipc call lock status (whether authenticating stays true),
  • fprintd debug output.

Then adjust the description and the fix to the mechanism those diagnostics show.

test/shell.d/lock-blank-fingerprint-test.sh no longer passes

The assertion at lines 24-27 expects the one-line handler form:

 onAuthenticatingPasswordChanged: {
   if (!lockRequested) return
-  if (authenticatingPassword) idleBlankTimer.stop()
-  else armBlankTimer()
+  if (authenticatingPassword) {
+    idleBlankTimer.stop()
+    fingerprintRetryTimer.stop()
+    if (root.fingerprintPamInstance) root.stopFingerprintPam()
+  } else {
+    armBlankTimer()
+  }

The test's regex matches the merge-base, #12420 and current quattro, but not the head or the head merged into quattro. The other lock tests that read Service.qml still match.

Impact: ./test/shell would report this test as failing, because the test exits at the first failed assertion. This is a test-contract mismatch only. The behavior it protects (blank timer held off during password entry and re-armed afterwards) is preserved.

Suggested change: Update the regex to accept the braced form. Alternatively, keep the one-line handler and move the fingerprint stop into a helper.

Fingerprint can restart during a password check

onAuthenticatingPasswordChanged(true) now stops the fingerprint session, which the base did not do. It is a one-time teardown when the check starts, and nothing keeps fingerprint stopped for the rest of the check:

submitPassword()
  runWake()                          authenticatingPassword still false
    -> startFingerprint()            may create + start a new PamContext
  authenticatingPassword = true
    -> stopFingerprintPam()          destroys it again (subprocess killed)
  passwordPam.start()
  ... during the check, startFingerprint() has no authenticatingPassword guard:
    fingerprintCheckProc.onExited    (e.g. a slow fprintd-list probe from beginLock)
    fingerprintRetryTimer            (restarted by result handlers)
    sessionLock.onSecureStateChanged (only if the lock is confirmed after submission)
    -> a new fingerprint session runs alongside the password check

Impact: There is no leak or stuck state, and a concurrent session matches the base behavior. However, the stop-on-password behavior does not hold throughout the check, and each password submission can fork and immediately kill a pam_fprintd child. That is extra claim/release churn on a reader the description calls fragile. The description also presents this as re-routing an existing call ("password prompt in flight"), though the base had no fingerprint stop on this path.

Suggested change: If stopping fingerprint during a password check is intended:

  • add if (authenticatingPassword) return to startFingerprint(), which covers all callers (a failed password already re-arms through handlePasswordFailure() → runWake()),
  • set authenticatingPassword before runWake() in submitPassword(), or skip the fingerprint start there,
  • mention the behavior change in the description.

Optional: stopFingerprintPam() calls destroy() without abort(). Until the deferred delete runs, a stopped context stays connected, and both result handlers still reset fingerprintAuthenticating and restart the retry timer for a context that is no longer current. The base's abort() disconnected synchronously. This window was identified from source only and was not reproduced. Calling p.abort() before p.destroy(), and returning early from the handlers when ctx !== fingerprintPamInstance, closes it.

Stacked #12420 note: runBlank() stops only the retry timer. A fingerprint session already running when the display blanks keeps scanning until it ends or times out. The new stopFingerprintPam() could stop it there, with runWake() re-arming on wake. This comes from the #12420 commit, not the factory change.


Review information

Test scope: Source review of shell/plugins/lock/Service.qml at the head, #12420, the merge-base and current quattro, plus Quickshell PAM service source (v0.3.1 and master), fprintd/pam_fprintd source and Qt 6.11 qtdeclarative source. Executed in isolation:

  • a merge of the head onto current quattro in a disposable repository,
  • a direct evaluation of the lock tests' regex assertions against each revision. The test script itself was not run.

Not run: QML, the lock screen, PAM, fprintd or fingerprint hardware. The CV3 symptom was not reproduced.

AI process: Opus 5.5 Medium coordination and synthesis, independent Opus 5.5 Xhigh and GPT 6 Sol Xhigh technical assessments with targeted follow-up questions, Opus 5.5 Medium editorial check.

Opt out: To stop receiving these reviews, reply to this comment saying so.

Gate the runWake() re-arm on an actual blank so fingerprints do not restart
on every pointer move or key press, and re-arm the reader when the panel set
changes (onScreensChanged), which previously cleared the blank flag without
ever restarting a scan. Re-arm the blank timer there too so a panel that is
still dark re-blanks instead of scanning with the panels off.
The lock screen reused one PamContext for every fingerprint attempt. After a
session that started and then errored mid-identification, PamContext.active
stayed set, so startFingerprint() never started another scan: a single miss
could disable the reader until password unlock (see the late-identify
capture in the linked issue).

Create a fresh PamContext per attempt via a Component factory and destroy it
when the attempt finishes or errors, and suspend fingerprinting while a
password prompt is in flight.
…-attempt teardown

- startFingerprint() refuses while a password check is in flight, and
  submitPassword() sets authenticatingPassword before runWake(), so a check
  stops fingerprint for its full duration instead of for one event
- re-arm fingerprint when a password check finishes, covering the
  failed-password path that runWake no longer re-arms once the display is
  already awake
- stopFingerprintPam() aborts before destroying, and the result/error handlers
  return when the completing context is no longer current, so a stopped
  context cannot reset state or restart the retry timer
- sync lock-blank-fingerprint-test.sh with the braced handler
@slr01
slr01 force-pushed the lock/fingerprint-rearm-factory branch from c429101 to 91e13fa Compare September 26, 2026 00:04
@slr01

slr01 commented Sep 26, 2026

Copy link
Copy Markdown
Author

Closed with evidence; see #12420 for the fix that addresses the reported symptom.

@slr01 slr01 closed this Sep 26, 2026
@slr01
slr01 deleted the lock/fingerprint-rearm-factory branch September 26, 2026 00:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants