Skip to content

pam: delay auth init until grace period expires - #1069

Open
deivi98 wants to merge 1 commit into
hyprwm:mainfrom
deivi98:fix/delay-pam-init-during-grace
Open

pam: delay auth init until grace period expires#1069
deivi98 wants to merge 1 commit into
hyprwm:mainfrom
deivi98:fix/delay-pam-init-during-grace

Conversation

@deivi98

@deivi98 deivi98 commented Sep 2, 2026

Copy link
Copy Markdown

During a grace period, hyprlock allows unlocking via mouse movement or a keypress without completing PAM authentication. However, PAM (and therefore any module in the stack, e.g. pam_u2f) was being initialised immediately on startup regardless of grace, causing FIDO2 security keys to light up and wait for a touch that is never needed when the user unlocks during grace.

Fix this by waiting at the start of CPam::init()'s thread until the grace period wall-clock time has elapsed before calling into pam_authenticate(). The wait uses the existing inputSubmittedCondition condvar so that terminate() wakes the thread immediately if the session is unlocked (via grace, SIGUSR1, etc.) before the grace period ends, avoiding a hang on exit.

During a grace period, hyprlock allows unlocking via mouse movement or
a keypress without completing PAM authentication. However, PAM (and
therefore any module in the stack, e.g. pam_u2f) was being initialised
immediately on startup regardless of grace, causing FIDO2 security keys
to light up and wait for a touch that is never needed when the user
unlocks during grace.

Fix this by waiting at the start of CPam::init()'s thread until the
grace period wall-clock time has elapsed before calling into
pam_authenticate(). The wait uses the existing inputSubmittedCondition
condvar so that terminate() wakes the thread immediately if the session
is unlocked (via grace, SIGUSR1, etc.) before the grace period ends,
avoiding a hang on exit.
@deivi98

deivi98 commented Sep 2, 2026

Copy link
Copy Markdown
Author

Tested locally and it works, even with system suspend mid grace period

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.

1 participant