[ms/release/0.1] backport signal init process fix #2562
Merged
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.
When implementing signal container process enforcement policy we introduced a bug, where instead of signalling just the container init process we ended up sending signals (SIGTERM or SIGKILL) to all processes running inside a container (by invoking
runc kill --all).container.Killno longer sends signals to all container processes.This results in an unpleasant behavior, where the init process could be handling (e.g. ignoring) SIGTERM, where as other processes inside container don't.
This PR makes a change to the order in which the signal container policy is enforced:
EnforceSignalContainerProcessPolicybefore sending any signals. Otherwise, this looks like a bug, since we would never callEnforceSignalContainerProcessPolicywithsignalingInitProcess == trueforSIGTERMandSIGKILLand potentially bypassing policies, which do not allowSIGTERMorSIGKILLto be sent to the init process.ShutdownContainerand instead revert back to callingprocess.Kill.(cherry picked from commit 04735e0)