summaryrefslogtreecommitdiff
path: root/vendor
diff options
context:
space:
mode:
authorSebastiaan van Stijn <github@gone.nl>2023-02-28 23:25:58 +0100
committerSebastiaan van Stijn <github@gone.nl>2023-02-28 23:25:58 +0100
commit5997ad8512bf330e94052d924f2e3df8d059e961 (patch)
tree77e9743dbcf8219e24c574d165913fb3ebc36faf /vendor
parent0021339b9299c5f1596bdf772a42ce346f16f060 (diff)
downloaddocker-5997ad8512bf330e94052d924f2e3df8d059e961.tar.gz
vendor: github.com/Microsoft/hcsshim v0.9.7
- Retain pause.exe as entrypoint for default pause images - wcow: support graceful termination of servercore containers full diff: https://github.com/Microsoft/hcsshim/compare/v0.9.6...v0.9.7 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Diffstat (limited to 'vendor')
-rw-r--r--vendor/github.com/Microsoft/hcsshim/internal/hcs/process.go38
-rw-r--r--vendor/modules.txt2
2 files changed, 36 insertions, 4 deletions
diff --git a/vendor/github.com/Microsoft/hcsshim/internal/hcs/process.go b/vendor/github.com/Microsoft/hcsshim/internal/hcs/process.go
index f4605922ab..78490d6cdd 100644
--- a/vendor/github.com/Microsoft/hcsshim/internal/hcs/process.go
+++ b/vendor/github.com/Microsoft/hcsshim/internal/hcs/process.go
@@ -161,7 +161,39 @@ func (process *Process) Kill(ctx context.Context) (bool, error) {
return true, nil
}
- resultJSON, err := vmcompute.HcsTerminateProcess(ctx, process.handle)
+ // HCS serializes the signals sent to a target pid per compute system handle.
+ // To avoid SIGKILL being serialized behind other signals, we open a new compute
+ // system handle to deliver the kill signal.
+ // If the calls to opening a new compute system handle fail, we forcefully
+ // terminate the container itself so that no container is left behind
+ hcsSystem, err := OpenComputeSystem(ctx, process.system.id)
+ if err != nil {
+ // log error and force termination of container
+ log.G(ctx).WithField("err", err).Error("OpenComputeSystem() call failed")
+ err = process.system.Terminate(ctx)
+ // if the Terminate() call itself ever failed, log and return error
+ if err != nil {
+ log.G(ctx).WithField("err", err).Error("Terminate() call failed")
+ return false, err
+ }
+ process.system.Close()
+ return true, nil
+ }
+ defer hcsSystem.Close()
+
+ newProcessHandle, err := hcsSystem.OpenProcess(ctx, process.Pid())
+ if err != nil {
+ // Return true only if the target process has either already
+ // exited, or does not exist.
+ if IsAlreadyStopped(err) {
+ return true, nil
+ } else {
+ return false, err
+ }
+ }
+ defer newProcessHandle.Close()
+
+ resultJSON, err := vmcompute.HcsTerminateProcess(ctx, newProcessHandle.handle)
if err != nil {
// We still need to check these two cases, as processes may still be killed by an
// external actor (human operator, OOM, random script etc).
@@ -185,9 +217,9 @@ func (process *Process) Kill(ctx context.Context) (bool, error) {
}
}
events := processHcsResult(ctx, resultJSON)
- delivered, err := process.processSignalResult(ctx, err)
+ delivered, err := newProcessHandle.processSignalResult(ctx, err)
if err != nil {
- err = makeProcessError(process, operation, err, events)
+ err = makeProcessError(newProcessHandle, operation, err, events)
}
process.killSignalDelivered = delivered
diff --git a/vendor/modules.txt b/vendor/modules.txt
index 6b012cd6de..8fa9381515 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -33,7 +33,7 @@ github.com/Microsoft/go-winio/pkg/fs
github.com/Microsoft/go-winio/pkg/guid
github.com/Microsoft/go-winio/pkg/security
github.com/Microsoft/go-winio/vhd
-# github.com/Microsoft/hcsshim v0.9.6
+# github.com/Microsoft/hcsshim v0.9.7
## explicit; go 1.13
github.com/Microsoft/hcsshim
github.com/Microsoft/hcsshim/cmd/containerd-shim-runhcs-v1/options