Skip to content

Reset create_pid after waitpid to prevent signaling unrelated processes#659

Merged
jnovy merged 1 commit into
mainfrom
fix/reset-create-pid-after-waitpid
May 21, 2026
Merged

Reset create_pid after waitpid to prevent signaling unrelated processes#659
jnovy merged 1 commit into
mainfrom
fix/reset-create-pid-after-waitpid

Conversation

@jnovy
Copy link
Copy Markdown
Collaborator

@jnovy jnovy commented May 21, 2026

After the synchronous waitpid(create_pid) succeeds in the non-terminal
code path, create_pid was never reset to -1. If the PID was later reused
by another process, on_sig_exit() would send SIGTERM to that unrelated
process.

This was observed in OpenStack environments where restarting container
services would occasionally kill qemu-kvm instances whose PIDs happened
to match a previously reaped create_pid.

Fix: set create_pid = -1 after successful waitpid(), matching the
behavior already present in the terminal path via runtime_exit_cb().

Resolves: RHEL-178025

After the synchronous waitpid(create_pid) succeeds, create_pid was
never reset to -1. If the PID was later reused by another process,
on_sig_exit() would send SIGTERM to that unrelated process.

Resolves: RHEL-178025

Signed-off-by: Jindrich Novy <jnovy@redhat.com>
@jnovy jnovy requested a review from giuseppe May 21, 2026 07:42
@jnovy jnovy added the jira label May 21, 2026
@packit-as-a-service
Copy link
Copy Markdown

Ephemeral COPR build failed. @containers/packit-build please check.

Copy link
Copy Markdown
Member

@giuseppe giuseppe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jnovy jnovy merged commit 707d99d into main May 21, 2026
26 of 28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants