blob: 7be2c5c96fd400b59d276b6bfbc0df8b6ade6fa7 [file] [log] [blame]
From b6fbe61268748c0a5bc6246f83bfe1877e12d55d Mon Sep 17 00:00:00 2001
From: Nandhini Rengaraj <nrengaraj@google.com>
Date: Tue, 27 Feb 2024 20:55:23 +0000
Subject: [PATCH] Import OnlyStrict method from containerd v1.6.2
This change is needed to apply the backported patch to fix
CVE-2024-24557. The lower version of vendored containerd in docker
v20.10 does not contain this method.
---
.../containerd/containerd/platforms/compare.go | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/vendor/github.com/containerd/containerd/platforms/compare.go b/vendor/github.com/containerd/containerd/platforms/compare.go
index 3ad22a1..d23c46c 100644
--- a/vendor/github.com/containerd/containerd/platforms/compare.go
+++ b/vendor/github.com/containerd/containerd/platforms/compare.go
@@ -125,6 +125,18 @@ func Only(platform specs.Platform) MatchComparer {
}
}
+// OnlyStrict returns a match comparer for a single platform.
+//
+// Unlike Only, OnlyStrict does not match sub platforms.
+// So, "arm/vN" will not match "arm/vM" where M < N,
+// and "amd64" will not also match "386".
+//
+// OnlyStrict matches non-canonical forms.
+// So, "arm64" matches "arm/64/v8".
+func OnlyStrict(platform specs.Platform) MatchComparer {
+ return Ordered(Normalize(platform))
+}
+
// Ordered returns a platform MatchComparer which matches any of the platforms
// but orders them in order they are provided.
func Ordered(platforms ...specs.Platform) MatchComparer {
--
2.44.0.rc1.240.g4c46232300-goog