fix(unikontainers): reject non-positive pid in kill/signal paths#751
Open
WHOIM1205 wants to merge 1 commit into
Open
fix(unikontainers): reject non-positive pid in kill/signal paths#751WHOIM1205 wants to merge 1 commit into
WHOIM1205 wants to merge 1 commit into
Conversation
Signed-off-by: WHOIM1205 <rathourprateek8@gmail.com>
✅ Deploy Preview for urunc canceled.
|
Author
|
Hey @cmainas this addresses the invalid PID handling issue by rejecting non-positive PIDs before any signal operation and allowing cleanup of failed containers. Please let me know if you'd like any additional tests or changes. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
A partially-created unikontainer can persist a sentinel PID value (
-1) in its state before the monitor process is successfully created. Subsequent lifecycle operations trusted this stored PID and passed it directly to process-control paths.On Unix systems,
kill(-1, sig)does not target a single process. Instead, it broadcasts the signal to every process the caller is permitted to signal. Since urunc typically runs with elevated privileges, a failed container creation followed by a signal or force-delete operation could result in host-wide signal delivery.This change adds validation for non-positive PIDs at all process-control boundaries:
Unikontainer.Signal()hypervisors.killProcess()Unikontainer.isRunning()These checks prevent unsafe signal propagation and allow failed containers with invalid PIDs to be cleaned up correctly.
No changes to normal container lifecycle behavior. Containers with valid monitor PIDs continue to operate as before.
Related issues
How was this tested?
Verified by code inspection and local validation.
Pid: -1during the creating stateunix.Kill()with non-positive PIDsisRunning()returnsfalsefor invalid PIDs, allowing cleanup of failed containersLLM usage
N/A
Checklist