Commit Graph

12259 Commits

Author SHA1 Message Date
Derek McGowan
fb5868b201 Merge pull request #9106 from thaJeztah/1.7_backport_swap_log_pkg_alias
[release/1.7 backport] alias log package to github.com/containerd/log v0.1.0
2023-09-20 21:30:11 -07:00
Sebastiaan van Stijn
09633b539f deprecate logs package, but disable linter (for transitioning)
Deprecate the pacakge, but suppress linting errors for now. This is to allow
backporting these changes to release branches, which may still need to transition.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 03b9ce56b5)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-09-20 16:27:21 +02:00
Sebastiaan van Stijn
cb201519f8 alias log package to github.com/containerd/log v0.1.0
This "soft" deprecates the package, but keeps the local uses of the package,
which can make backporting this to release-branches easier (we can
still move all uses in those branches as well though).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit d69ae811d6)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit f1591cc9b9)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-09-19 08:54:55 +02:00
Sebastiaan van Stijn
a5024e6dd9 vendor: github.com/stretchr/testify v1.8.4
full diff: https://github.com/stretchr/testify/compare/v1.8.2...v1.8.4

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-09-19 08:52:09 +02:00
Sebastiaan van Stijn
7bd976af3f vendor: github.com/sirupsen/logrus v1.9.3
full diff: https://github.com/sirupsen/logrus/compare/v1.9.0...v1.9.3

v1.9.3

- Fix a potential denial of service vulnerability in logrus.Writer()
  that could be triggered by logging text longer than 64kb without newlines
- Fix panic in Writer

v1.9.2

Reverts "Fix a potential denial of service vulnerability in logrus.Writer()",
which introduced a regression.

v1.9.1

- Fix data race in hooks.test package
- Add instructions to use different log levels for local and syslog
- Fix a potential denial of service vulnerability in logrus.Writer()
  that could be triggered by logging text longer than 64kb without newlines
- Use text when shows the logrus output

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-09-19 08:52:09 +02:00
Phil Estes
0736d5bf89 Merge pull request #9097 from vvoland/remotes-docker-status-exists-mounted-pushed-17
[release/1.7] remotes/docker: Add MountedFrom and Exists push status
2023-09-18 10:16:06 -04:00
Samuel Karp
beeac35c7a Merge pull request #9099 from samuelkarp/nri-1.7 2023-09-15 08:50:38 -07:00
Samuel Karp
3ca015e556 nri: update mock plugin handlers
Signed-off-by: Samuel Karp <samuelkarp@google.com>
(cherry picked from commit 9656b8c0d0)
Signed-off-by: Samuel Karp <samuelkarp@google.com>
2023-09-14 14:27:55 -07:00
Samuel Karp
4cd208c1f2 vendor: update github.com/containerd/nri@v0.4.0
Signed-off-by: Samuel Karp <samuelkarp@google.com>
(cherry picked from commit 6f9de91efc)
Signed-off-by: Samuel Karp <samuelkarp@google.com>
2023-09-14 14:27:40 -07:00
Paweł Gronowski
8cd2d33c2a [release/1.7] remotes/docker: Add MountedFrom and Exists push status
This makes it possible to check whether content didn't actually need to
be pushed to the remote registry and was cross-repo mounted or already
existed.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
(cherry picked from commit dfc7590d5a)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-09-14 16:34:10 +02:00
Derek McGowan
091922f03c Merge pull request #9085 from dmcgowan/prepare-1.7.6
[release/1.7] Prepare release notes for 1.7.6
v1.7.6
2023-09-12 10:23:35 -07:00
Phil Estes
8542d0e819 Merge pull request #9069 from kiashok/portStableAbi-1.7
[release/1.7] Invoke Stable ABI compatibility function in windows platform matcher
2023-09-12 11:01:57 -04:00
Akihiro Suda
78874ecf93 Merge pull request #9084 from dmcgowan/backport-1.7-inherit-distribution-sources
[release/1.7] push: inherit distribution sources from parent
2023-09-12 12:17:02 +09:00
Derek McGowan
3e09c65b21 Prepare release notes for v1.7.6
Signed-off-by: Derek McGowan <derek@mcg.dev>
2023-09-11 18:31:08 -07:00
Derek McGowan
5ebf05d97e push: inherit distribution sources from parent
When a blob does not exist locally, rather than erroring on info
lookup, inherit the parent distribution sources. Push is able
to succeed even if the blob does not exist locally when a cross
repository mount is done. This is a common operation pushing a
multi-platform image to the same registry but different namespace.

Signed-off-by: Derek McGowan <derek@mcg.dev>
(cherry picked from commit 20f79300cf)
Signed-off-by: Derek McGowan <derek@mcg.dev>
2023-09-11 10:17:36 -07:00
Derek McGowan
d206896ddd content: add InfoProvider interface
Signed-off-by: Derek McGowan <derek@mcg.dev>
(cherry picked from commit f8c789f319)
Signed-off-by: Derek McGowan <derek@mcg.dev>
2023-09-11 10:17:35 -07:00
Akihiro Suda
f0d3109c7c Merge pull request #9074 from thaJeztah/1.7_update_golang_1.20.8
[release/1.7] update to go1.20.8
2023-09-09 13:32:44 +09:00
Sebastiaan van Stijn
423693d7b4 [release/1.7] update to go1.20.8
go1.20.8 (released 2023-09-06) includes two security fixes to the html/template
package, as well as bug fixes to the compiler, the go command, the runtime,
and the crypto/tls, go/types, net/http, and path/filepath packages. See the
Go 1.20.8 milestone on our issue tracker for details:

https://github.com/golang/go/issues?q=milestone%3AGo1.20.8+label%3ACherryPickApproved

full diff: https://github.com/golang/go/compare/go1.20.7...go1.20.8

From the security mailing:

[security] Go 1.21.1 and Go 1.20.8 are released

Hello gophers,

We have just released Go versions 1.21.1 and 1.20.8, minor point releases.

These minor releases include 4 security fixes following the security policy:

- cmd/go: go.mod toolchain directive allows arbitrary execution
  The go.mod toolchain directive, introduced in Go 1.21, could be leveraged to
  execute scripts and binaries relative to the root of the module when the "go"
  command was executed within the module. This applies to modules downloaded using
  the "go" command from the module proxy, as well as modules downloaded directly
  using VCS software.

  Thanks to Juho Nurminen of Mattermost for reporting this issue.

  This is CVE-2023-39320 and Go issue https://go.dev/issue/62198.

- html/template: improper handling of HTML-like comments within script contexts
  The html/template package did not properly handle HMTL-like "<!--" and "-->"
  comment tokens, nor hashbang "#!" comment tokens, in <script> contexts. This may
  cause the template parser to improperly interpret the contents of <script>
  contexts, causing actions to be improperly escaped. This could be leveraged to
  perform an XSS attack.

  Thanks to Takeshi Kaneko (GMO Cybersecurity by Ierae, Inc.) for reporting this
  issue.

  This is CVE-2023-39318 and Go issue https://go.dev/issue/62196.

- html/template: improper handling of special tags within script contexts
  The html/template package did not apply the proper rules for handling occurrences
  of "<script", "<!--", and "</script" within JS literals in <script> contexts.
  This may cause the template parser to improperly consider script contexts to be
  terminated early, causing actions to be improperly escaped. This could be
  leveraged to perform an XSS attack.

  Thanks to Takeshi Kaneko (GMO Cybersecurity by Ierae, Inc.) for reporting this
  issue.

  This is CVE-2023-39319 and Go issue https://go.dev/issue/62197.

- crypto/tls: panic when processing post-handshake message on QUIC connections
  Processing an incomplete post-handshake message for a QUIC connection caused a panic.

  Thanks to Marten Seemann for reporting this issue.

  This is CVE-2023-39321 and CVE-2023-39322 and Go issue https://go.dev/issue/62266.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-09-09 01:08:20 +02:00
Kirtana Ashok
c7a35ccdcc Fix transfer service dependencies:
- Fill OSVersion field of ocispec.Platform for windows OS in
transfer service plugin init()
- Do not return error from transfer service ReceiveStream if
stream.Recv() returned context.Canceled error

Signed-off-by: Kirtana Ashok <kiashok@microsoft.com>
(cherry picked from commit 823e0420eb)
Signed-off-by: Kirtana Ashok <kiashok@microsoft.com>
2023-09-08 10:26:37 -07:00
Kirtana Ashok
38d4e506dd Invoke Stable ABI compatibility function in windows platform matcher
Signed-off-by: Kirtana Ashok <kiashok@microsoft.com>
(cherry picked from commit cfb30a31a8)
Signed-off-by: Kirtana Ashok <kiashok@microsoft.com>
2023-09-07 13:23:12 -07:00
Maksym Pavlenko
7791d75fa4 Merge pull request #9063 from kiashok/udpateHcsshimTag-0.11.0
[release/1.7] Update hcsshim tag to v0.11.0
2023-09-07 12:47:03 -07:00
Kirtana Ashok
ddffc7c9a1 Update hcsshim tag to v0.11.0
Signed-off-by: Kirtana Ashok <kiashok@microsoft.com>
2023-09-06 13:13:16 -07:00
Samuel Karp
86dc86e629 Merge pull request #9015 from dcantah/1.7-cri-usernames-nonlinux
[release/1.7] CRI: Support Linux usernames for !linux platforms
2023-09-01 23:23:25 -07:00
Fu Wei
b7ada5e32e Merge pull request #9047 from dcantah/1.7-darwin-copyfile 2023-09-02 07:34:11 +08:00
Danny Canter
ed4bac11e5 Blockfile: Enlighten blockfile copy on Darwin
The Go stdlib does not seem to have an efficient os.File.ReadFrom
routine for other platforms like it does on Linux with
copy_file_range. For Darwin at least we can use clonefile
in its place, otherwise if we have a sparse file we'd have
a fun surprise with the io.Copy approach..

We should see if there's other platforms that we can enhance here.
I've forgotten what's the right route on Windows.

Signed-off-by: Danny Canter <danny@dcantah.dev>
(cherry picked from commit 13ff185ba0)
Signed-off-by: Danny Canter <danny@dcantah.dev>
2023-09-01 10:32:18 -07:00
Phil Estes
c2978c2ab8 Merge pull request #9032 from thaJeztah/1.7_backport_revert_log_var
[release/1.7 backport] Revert "log: define G() as a function instead of a variable"
2023-08-31 10:48:24 -04:00
Sebastiaan van Stijn
4d1cfbbddb Revert "log: define G() as a function instead of a variable"
This reverts commit 778ac302b2.

(slightly modified, due to changes that were merged after that).

The reverted commit had two elements;

- Make `G` an actual function to improve the documentation
- Prevent `G` from being overwritten externally

From the commit that's reverted:

> The `G` variable is exported, and not expected to be overwritten
> externally. Defining it as a function also documents it as a function
> on https://pkg.go.dev, instead of a variable; https://pkg.go.dev/github.com/containerd/containerd@v1.6.22/log#pkg-variables

While it's unclear if the ability to replace the implementation was
_intentional_, it's this part that some external consumers were (ab)using.

We should look into that part in a follow-up, and design for this, for
example by providing a utility to replace the logger, and properly document
that.

In the meantime, let's revert the change.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 19d6c37a3f)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-08-30 21:47:14 +02:00
Phil Estes
1e03b05eaa Merge pull request #9025 from akhilerm/cherry-pick-9021-release/1.7
[release/1.7 backport] make repositories of install dependencies configurable
2023-08-29 14:33:10 -04:00
Akhil Mohan
a34e932412 make repositories of install dependencies configurable
make repositories of dependencies like runc, crun, cni and critools configurable

Signed-off-by: Akhil Mohan <makhil@vmware.com>
(cherry picked from commit 7a0ad09a0d)
Signed-off-by: Akhil Mohan <makhil@vmware.com>
2023-08-29 19:55:06 +05:30
Danny Canter
b449440a40 CRI: Support Linux usernames for !linux platforms
The oci.WithUser option was being applied in container_create_linux.go
instead of the cross plat buildLinuxSpec method. There's been recent
work to try and make every spec option that can be applied on any platform
able to do so, and this falls under that. However, WithUser on linux platforms
relies on the containers SnapshotKey being filled out, which means the spec
option needs to be applied during container creation.

To make this a little more generic, I've created a new platformSpecOpts
method that handles any spec opts that rely on runtime state (rootfs mounted
for example) for some platforms, or just platform options that we still don't
have workarounds for to be able to specify them for other platforms
(apparmor, seccomp etc.) by internally calling the already existing
containerSpecOpts method.

Signed-off-by: Danny Canter <danny@dcantah.dev>
(cherry picked from commit 66307d0b4e)
Signed-off-by: Danny Canter <danny@dcantah.dev>
2023-08-25 18:21:24 -07:00
Derek McGowan
fe457eb99a Merge pull request #9010 from dmcgowan/prepare-1.7.5
[release/1.7] Prepare release notes for 1.7.5
v1.7.5
2023-08-25 06:54:47 -07:00
Phil Estes
0dba541770 Merge pull request #9012 from AkihiroSuda/cherrypick-9011-1.7
[release/1.7 backport] go.mod: github.com/containerd/continuity v0.4.2
2023-08-25 09:26:22 -04:00
Akihiro Suda
503ab21bfc go.mod: github.com/containerd/continuity v0.4.2
https://github.com/containerd/continuity/compare/1e0d26eb2381...v0.4.2

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
(cherry picked from commit 490905be6f)
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2023-08-25 16:41:52 +09:00
Derek McGowan
93b23eb106 Prepare release notes for v1.7.5
Signed-off-by: Derek McGowan <derek@mcg.dev>
2023-08-24 13:43:41 -07:00
Derek McGowan
fb1292c8de Bump version to v1.7.4
Missed from previous release

Signed-off-by: Derek McGowan <derek@mcg.dev>
2023-08-24 13:24:48 -07:00
Derek McGowan
ff0cd279d8 Merge pull request #9001 from thaJeztah/1.7_backport_log_improve
[release/1.7 backport] log: cleanups and improvements to decouple more from logrus
2023-08-24 12:56:27 -07:00
Derek McGowan
488cd77cf2 Merge pull request #9000 from dcantah/1.7.4-release
[release/1.7] Prepare release notes for v1.7.4
v1.7.4
2023-08-24 10:45:46 -07:00
Danny Canter
7a0cae3ca1 [release/1.7] Prepare release notes for v1.7.4
Signed-off-by: Danny Canter <danny@dcantah.dev>
2023-08-24 02:58:10 -07:00
Akihiro Suda
5ee98395a0 Merge pull request #9003 from fuweid/cp-17-8954
[releases/1.7] *: fix leaked shim caused by high IO pressure
2023-08-24 13:22:42 +09:00
Akihiro Suda
d06fd931e0 Merge pull request #9005 from fuweid/cp-17-8676-8542
[release/1.7] Cherry-pick: [overlay] add configurable mount options to overlay snapshotter
2023-08-24 13:21:55 +09:00
Wei Fu
537d7526e4 integration: issue7496 case should work for runc.v2 only
Signed-off-by: Wei Fu <fuweid89@gmail.com>
2023-08-24 10:19:27 +08:00
Derek McGowan
0f4885c166 Add configurable mount options to overlay
Allows default mount options to be provided through configuration.

Signed-off-by: Derek McGowan <derek@mcg.dev>
(cherry picked from commit d115129d1e)
Signed-off-by: Wei Fu <fuweid89@gmail.com>
2023-08-24 09:03:18 +08:00
Cardy.Tang
8804a27d72 feat: make overlay sync removal configurable
Signed-off-by: Cardy.Tang <zuniorone@gmail.com>
(cherry picked from commit b9f2e48e37)
Signed-off-by: Wei Fu <fuweid89@gmail.com>
2023-08-24 09:02:59 +08:00
Wei Fu
5add172be5 Vagrantfile: add strace tool
Signed-off-by: Wei Fu <fuweid89@gmail.com>
(cherry picked from commit 00ef8ba99b)
Signed-off-by: Wei Fu <fuweid89@gmail.com>
2023-08-24 08:30:24 +08:00
Wei Fu
207e28f36d integration: add ShouldRetryShutdown case based on #7496
Since the moby/moby can't handle duplicate exit event well, it's hard
for containerd to retry shutdown if there is error, like context
canceled.

In order to prevent from regression like #4769, I add skipped
integration case as TODO item and we should rethink about how to handle
the task/shim lifecycle.

Signed-off-by: Wei Fu <fuweid89@gmail.com>
(cherry picked from commit 601699a184)
Signed-off-by: Wei Fu <fuweid89@gmail.com>
2023-08-24 08:28:46 +08:00
Wei Fu
b4f480fb30 pkg/cri/sbserver: fix leaked shim issue for podsandbox mode
Fixes: #7496 #8931

Uses logrus instead of log

Signed-off-by: Wei Fu <fuweid89@gmail.com>
(cherry picked from commit 8dcb2a6e6d)
Signed-off-by: Wei Fu <fuweid89@gmail.com>
2023-08-24 08:26:59 +08:00
Wei Fu
88ff575c5c pkg/cri/server: fix leaked shim issue
Fixes: #7496 #8931

Signed-off-by: Wei Fu <fuweid89@gmail.com>
(cherry picked from commit 72bc63d83d)
Signed-off-by: Wei Fu <fuweid89@gmail.com>
2023-08-24 08:22:37 +08:00
Wei Fu
9f61dfb7c5 integration: add case to reproduce #7496
Signed-off-by: Wei Fu <fuweid89@gmail.com>
(cherry picked from commit 5bdd9ca938)
Signed-off-by: Wei Fu <fuweid89@gmail.com>
2023-08-24 08:17:58 +08:00
Sebastiaan van Stijn
2a9ae3c511 log: swap logrus functions with their equivalent on default logger
[`logrus.SetLevel()`][1], [`logrus.GetLevel()`][2] and [`logrus.SetFormatter()`][3]
are all convenience functions to configure logrus' standardlogger, which is the
logger to which we hold a reference in the Entry configured on [`log.L`][4].

This patch:

- swaps calls to `logrus.SetLevel`, `logrus.GetLevel` and `logrus.SetFormatter`
  for their equivalents on `log.L`. This makes it clearer what `SetLevel` does,
  and makes sure that we set the log-level of the logger / entry we define in
  our package (even if that would be swapped with a different instance).
- removes the use of `logrus.NewEntry` with directly constructing a `Entry`,
  using the local `Entry` alias (anticipating we can swap that type in future).

[1]: dd1b4c2e81/exported.go (L34C1-L37)
[2]: dd1b4c2e81/exported.go (L39-L42)
[3]: dd1b4c2e81/exported.go (L23-L26)
[4]: dd1b4c2e81/exported.go (L9-L16)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 85a2c9a01b)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-08-24 00:29:37 +02:00
Sebastiaan van Stijn
01445bb738 log: add package documentation and summary of package's purpose
Add a package doc to (try to) describe the purpose of this package, and
to describe the purpose (and expectations) of aliases provided by the
package.

> Package log provides types and functions related to logging, passing
> loggers through a context, and attaching context to the logger.
>
> # Transitional types
>
> This package contains various types that are aliases for types in [logrus].
> These aliases are intended for transitioning away from hard-coding logrus
> as logging implementation. Consumers of this package are encouraged to use
> the type-aliases from this package instead of directly using their logrus
> equivalent.
>
> The intent is to replace these aliases with locally defined types and
> interfaces once all consumers are no longer directly importing logrus
> types.
>
> IMPORTANT: due to the transitional purpose of this package, it is not
> guaranteed for the full logrus API to be provided in the future. As
> outlined, these aliases are provided as a step to transition away from
> a specific implementation which, as a result, exposes the full logrus API.
> While no decisions have been made on the ultimate design and interface
> provided by this package, we do not expect carrying "less common" features.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 6baff1694f)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-08-24 00:29:30 +02:00