Commit 8ffbc6f
committed
gcs: do not trigger container shutdown when signaling init process
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`).
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:
- always call `EnforceSignalContainerProcessPolicy` before sending
any signals. Otherwise, this looks like a bug, since we would
never call `EnforceSignalContainerProcessPolicy` with
`signalingInitProcess == true` for `SIGTERM` and `SIGKILL` and
potentially bypassing policies, which do not allow `SIGTERM` or
`SIGKILL` to be sent to the init process.
- no longer call `ShutdownContainer` and instead revert back to
calling `process.Kill`.
Additionally update framework.rego to have SIGTERM and SIGKILL as
default kill signals for init process for framework API versions
"0.10.0" and below.
New policies must explicitly have kill signals present.
Signed-off-by: Maksim An <[email protected]>1 parent 6efa5fd commit 8ffbc6f
File tree
3 files changed
+10
-12
lines changed- internal/guest/runtime
- hcsv2
- runc
- pkg/securitypolicy
3 files changed
+10
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
683 | 683 | | |
684 | 684 | | |
685 | 685 | | |
686 | | - | |
687 | | - | |
688 | | - | |
689 | | - | |
690 | | - | |
691 | | - | |
692 | | - | |
693 | | - | |
694 | | - | |
695 | | - | |
696 | | - | |
| 686 | + | |
697 | 687 | | |
698 | 688 | | |
699 | 689 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | | - | |
| 77 | + | |
| 78 | + | |
78 | 79 | | |
79 | 80 | | |
80 | 81 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
909 | 909 | | |
910 | 910 | | |
911 | 911 | | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
912 | 919 | | |
913 | 920 | | |
914 | 921 | | |
| |||
0 commit comments