Skip to content

Conversation

@sergio-correia
Copy link
Collaborator

@sergio-correia sergio-correia commented Dec 18, 2025

When using SSS with multiple pins (e.g., tang) and threshold < n, after
successful decryption with t pins, the remaining child processes and
their grandchildren (like curl) were not being killed.

The fix uses process groups for decryption only:

  • Add use_pgrp parameter to call() to control process group creation
  • For decryption: use_pgrp=true - child calls setpgid(0, 0) to become
    a process group leader, parent also calls setpgid() to eliminate race
  • For encryption: use_pgrp=false - no process groups needed since we
    wait for all children anyway
  • Cleanup uses kill(-pid, SIGTERM) to kill the entire process group
  • Falls back to direct kill if process group doesn't exist

Resolves: #460

When using SSS with multiple pins (e.g., tang) and threshold < n, after
successful decryption with t pins, the remaining child processes and
their grandchildren (like curl) were not being killed.

The fix uses process groups for decryption only:
- Add use_pgrp parameter to call() to control process group creation
- For decryption: use_pgrp=true - child calls setpgid(0, 0) to become
a process group leader, parent also calls setpgid() to eliminate race
- For encryption: use_pgrp=false - no process groups needed since we
wait for all children anyway
- Cleanup uses kill(-pid, SIGTERM) to kill the entire process group
- Falls back to direct kill if process group doesn't exist

Signed-off-by: Sergio Correia <scorreia@redhat.com>
@sergio-correia sergio-correia changed the title sss: kill entire process group during cleanup sss: kill entire process group during decryption cleanup Dec 19, 2025
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.

clevis-decrypt-sss fails to kill all child processes (and their respective children)

1 participant