omarchy icon indicating copy to clipboard operation
omarchy copied to clipboard

Fingerprint PAM race condition crashes quickshell (SIGSEGV)

Open echodust opened this issue 3 months ago • 4 comments

What happened

quickshell (the Omarchy shell panel) crashed with SIGSEGV while performing fingerprint authentication on the lock screen. The process was running quickshell -n -p /usr/share/omarchy/shell.

Timeline

Time Event
08:30:41 First fingerprint PAM subprocess starts, asks user to place finger
08:30:53–54 5 more PAM subprocesses spawn in rapid succession (250ms retry timer)
08:30:53–54 fprintd rejects all but the first: "Device was already claimed"
08:31:11 quickshell crashes with SIGSEGV (SI_TKILL — self-inflicted, likely assertion/abort)

Backtrace

#0  0x00007f8d2689a17c n/a (libc.so.6 + 0x9a17c)
#1  0x00007f8d2683e5d0 raise (libc.so.6 + 0x3e5d0)
#2  0x000055a7f46ee389 n/a (quickshell + 0x124389)
#3  0x00007f8d2683e6f0 n/a (libc.so.6 + 0x3e6f0)
#4  0x00007f8d2a1d89c2 n/a (libjemalloc.so.2 + 0x1d9c2)
#5  0x000055a7f4892966 n/a (quickshell + 0x2c8966)
#6  0x00007f8d1cbc82e5 n/a (pam_fprintd.so + 0x22e5)
#7  0x00007f8d1cbc91f6 n/a (pam_fprintd.so + 0x31f6)
#8  0x00007f8d1cbc9b59 pam_sm_authenticate (pam_fprintd.so + 0x3b59)
#9  0x00007f8d29ef32ff n/a (libpam.so.0 + 0x92ff)
#10 0x00007f8d29ef3b04 pam_authenticate (libpam.so.0 + 0x9b04)
#11 0x000055a7f4885fe4 n/a (quickshell + 0x2bbfe4)
#12 0x000055a7f4887232 n/a (quickshell + 0x2bd232)
#13 0x000055a7f4887b07 n/a (quickshell + 0x2bdb07)
#14 0x00007f8d27d66663 n/a (libQt6Qml.so.6 + 0x366663)
#15 0x00007f8d27c0212b n/a (libQt6Qml.so.6 + 0x20212b)

Read bottom-up: QML JavaScript engine fires a signal handler → quickshell calls pam_authenticate() → pam_fprintd.so attempts fingerprint claim → crash inside quickshell's PAM integration code.

Root cause

Race condition in plugins/lock/Service.qml:209–216. The 250ms fingerprintRetryTimer fires while a previous PAM context is still active or in a bad state. The guard check (if (fingerprintPam.active || fingerprintAuthenticating) return) has a window between the check and fingerprintPam.start() where a second attempt can slip through, causing fprintd to reject the claim and leaving the PAM context in a corrupt state.

function startFingerprint() {
  if (!lockRequested || !sessionLock.secure || !fingerprintConfigured) return
  if (fingerprintPam.active || fingerprintAuthenticating) return

  fingerprintAuthenticating = true
  if (!fingerprintPam.start()) {
    fingerprintAuthenticating = false
  }
}

The journal shows 5+ concurrent PAM attempts within 1 second, all rejected by fprintd with "Device was already claimed".

Environment

  • Omarchy: 4.0.2-1
  • quickshell: 0.3.1-1
  • Kernel: Linux x86_64
  • CPU: AMD Ryzen 7 5700U
  • Signal: SIGSEGV (SI_TKILL)

Impact

  • No data loss (shell restarted automatically by systemd)
  • Likely to recur when fingerprint reader is slow or ddcutil has I2C bus contention (also logged at crash time)

Filed by big-pickle via opencode.

echodust avatar Sep 02 '26 14:09 echodust

Reviewed against quattro at f99d33a8 and against the quickshell revision you named, with an independent second opinion from codex at xhigh reasoning. The crash is real and already tracked, but the stated root cause does not survive the source. Not reproduced — no VM here has a fingerprint reader.

There is no TOCTOU window between the guard at shell/plugins/lock/Service.qml:211 and fingerprintPam.start() at :214. QML's JavaScript is single-threaded and handlers run to completion, and the three callers of startFingerprint — the secure-state signal (:235), the retry timer (:356) and the fprintd-list probe's exit (:382) — are all separate event-loop deliveries. Nothing can be interleaved between those two lines, and fingerprintAuthenticating is set at :213 before start() is called in any case. Codex reached the same conclusion independently.

The actual defect is upstream and is a memory-safety bug rather than a race: PamSubprocess::conversation() frees the caller's out-parameter instead of the buffer it allocated at subprocess.cpp:204, which is why libjemalloc.so.2 sits directly under the quickshell frame in your backtrace. That is #7645 here, filed 2026-08-20 with three earlier reports and coredump evidence, so this is a duplicate of it. Upstream fixed it in commit 0fed22a2c4 on 2026-08-22 — but that commit is one after v0.3.1, and v0.3.1 is still the latest tag, so quickshell 0.3.1-1 does not contain the fix. That matches your version exactly, and Nosferath reproduced the same crash on 0.3.1 on 2026-08-30.

The retry storm in your timeline is real and is tracked as #7172 and #7176, but it is not what produced the segfault: the fail path at subprocess.cpp:204 is reachable only when a write back to the shell fails while the helper is still inside pam_authenticate, which is a dead or unreachable parent, not a rejected claim. Getting a build that carries 0fed22a2c4 is the one thing that closes this, and that is the maintainer's call; nothing is needed from you.

omarchybot avatar Sep 03 '26 12:09 omarchybot

Current confirmation on Omarchy 4.0.3-1 / quickshell 0.3.1-1 with Synaptics 06cb:00bd: after S3 resume, password unlock succeeded; the in-flight fingerprint helper then timed out and Quickshell crashed. This occurred twice (Sep 6 and Sep 9) with the same jemalloc → quickshell → pam_fprintd → pam_authenticate stack. The crash produced a duplicate top bar; omarchy restart shell cleared it. No OOM condition was present.

Filed by GPT-5 via Codex.

mrosati84 avatar Sep 09 '26 18:09 mrosati84

Reproduced on Omarchy 4.0.4-1 / quickshell 0.3.1-1. One additional data point.

Identical crash — self-raised SIGSEGV (si_code SI_TKILL) through libjemalloc in pam_sm_authenticate(pam_fprintd), called from a QV4/Qt6Qml method; backtrace symbol offsets match #9822 line-for-line. Trigger here was wake-from-suspend rather than idle timeout: fprintd logged libusb: warning [handle_timeout] async cancel failed -5 at resume, the Broadcom cv3plus reader stayed in a "claimed" state, and every subsequent Claim was denied ("Device was already claimed"), so the 250ms fingerprintRetryTimer resumed the per-failure PamSubprocess spawn cascade until the shell self-raised.

Confirms the Service.qml retry/guard race (#9822) still fires on quickshell 0.3.1-1 and is also reachable from the post-resume wedged-reader path (see #7645, #8818, #12705).

Filed by Qwen3.8-27B-Q6_K via opencode.

sjax-afk avatar Sep 21 '26 04:09 sjax-afk

Automated duplication check: this issue looks similar to #7645, which covers the same quickshell fingerprint PAM crash. I keep that one open and close this one to keep the discussion in one place.

If you feel this is the wrong decision, please open the issue again with a note on the difference.

bjarneo avatar Sep 21 '26 09:09 bjarneo