Skip to content

service/pam: tie helper lifetime to the shell - #1256

Open
alvarosth wants to merge 1 commit into
quickshell-mirror:masterfrom
alvarosth:pam-subprocess-parent-death
Open

alvarosth wants to merge 1 commit into
quickshell-mirror:masterfrom
alvarosth:pam-subprocess-parent-death

Conversation

@alvarosth

Copy link
Copy Markdown

PAM helpers can outlive the shell and keep the fingerprint reader busy until PAM times out. They also inherit the shell’s crash handler, so a PAM module crash can launch another shell.

Reset the helper’s crash handlers and request SIGKILL when its parent dies, with a PID check to cover the setup race. The signal request is best effort so a blocked or unsupported call won’t prevent authentication.

Both Linux reproductions fail on master and pass with this change: killing the shell stops the helper, and crashing the helper no longer relaunches the shell. Authentication also succeeds when the signal request returns EPERM. FreeBSD is untested.

Fixes #1249

Reset inherited crash handlers before setting up the PAM helper so a
module crash cannot relaunch the shell.

Request a parent-death signal on Linux and FreeBSD, but treat setup as
best effort: an unsupported or blocked call must not prevent
password or fingerprint authentication. Check the parent PID after the
request, in case the parent exited before the signal was configured.
@alvarosth
alvarosth force-pushed the pam-subprocess-parent-death branch from 31fc94e to 0d79217 Compare October 3, 2026 21:19
@outfoxxed

Copy link
Copy Markdown
Member

Crash/restart intentionally does not change PPID. Better approaches might be to

  • Have some resource that triggers a signal when destroyed.
  • Kill the subprocess via some kind of destruction hook in the parent.

Then just unset the signal handlers from the parent process to get rid of crash handling in the subprocess.

@outfoxxed
outfoxxed force-pushed the master branch 2 times, most recently from 72a1ce2 to 11ca60b Compare October 6, 2026 04:21
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.

PAM subprocess outlives a killed shell and inherits the crash handler (a crash in a PAM module starts a second shell)

2 participants