Commit Graph

2024 Commits

Author SHA1 Message Date
Krisztian Litkey
bf0111a9cc nri,deprecation: emit warnings for old NRI plugins.
Signed-off-by: Krisztian Litkey <krisztian.litkey@intel.com>
2026-08-07 10:39:30 -05:00
Samuel Karp
56bc534e7e Merge pull request #13871 from samuelkarp/remove_deprecated_checkpoint_restore
cri: remove restore in CreateContainer
2026-07-31 15:50:29 +00:00
Fu Wei
2600710ddb Merge pull request #13735 from AkihiroSuda/whiteout-test
integration: build the whiteout-test image locally
2026-07-31 15:15:31 +00:00
Samuel Karp
91be73ba62 cri: remove restore in CreateContainer
Remove support for restoring checkpoint data during CreateContainer,
which was previously deprecated in v2.3.

Assisted-by: Antigravity
Signed-off-by: Samuel Karp <samuelkarp@google.com>
2026-07-29 09:32:24 -07:00
Samuel Karp
fda8a90116 Merge pull request #13838 from samuelkarp/deprecate-cri-checkpoint
cri: deprecate restore in CreateContainer
2026-07-28 17:36:14 +00:00
Samuel Karp
a3f99ba690 cri: deprecate restore in CreateContainer
Assisted-by: Antigravity
Signed-off-by: Samuel Karp <samuelkarp@google.com>
2026-07-27 22:11:29 -07:00
Nikolaus Schuetz
41f6f0e877 pkg/epoch: reject negative SOURCE_DATE_EPOCH values
ParseSourceDateEpoch used strconv.ParseInt, which accepts a leading sign, so a
negative SOURCE_DATE_EPOCH was silently accepted and produced a pre-1970
timestamp with a nil error. That contradicts the function's own doc ("returns
an error if ... not well-formatted") and the reproducible-builds spec, where
SOURCE_DATE_EPOCH is a non-negative number of seconds since the Unix epoch.
Reject negative values and add a regression test.

Signed-off-by: Nikolaus Schuetz <nikolauspschuetz@gmail.com>
2026-07-22 14:46:05 -07:00
Aysha Afrah Ziya
0205398ac2 pkg/archive: reject out-of-range device numbers in layer headers
Signed-off-by: Aysha Afrah Ziya <aysha26@digiscrypt.com>
2026-07-14 20:10:05 +05:30
Akihiro Suda
f418688f2c integration: build the whiteout-test image locally
Build the image for TestIssue13030 locally using pkg/archive,
instead of pulling the prebuilt ghcr.io/containerd/whiteout-test image.

The image is built by appending layers generated with archive.WriteDiff
on top of the busybox base image, served with the new
testutil.ServeImage helper on a localhost HTTP registry, and pulled
through the regular client.Pull path with WithPullUnpack. This removes
the need to publish the multi-arch whiteout-test image, so the
Dockerfile and Makefile added in PR 13704 are removed along with the
image list entry.

Assisted-by: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2026-07-08 23:39:42 +09:00
Sebastiaan van Stijn
296f917d5d pkg/kernelversion: update links to upstream source
The package was moved to a separate module; update the links to
make it easier to discover the current version of upstream.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-07-02 17:11:44 +02:00
Sebastiaan van Stijn
c45f911980 pkg/kernelversion: simplify code with sync.OnceValues
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-07-02 17:11:44 +02:00
Sebastiaan van Stijn
5e3e05aec7 pkg/kernelversion: fix minor linting issues
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-07-02 17:11:44 +02:00
Sebastiaan van Stijn
762b89ceeb pkg/kernelversion: use unix.ByteSliceToString for utsname fields
similar to [moby@8a5c131]

[moby@8a5c131]: 8a5c13155e

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-07-02 17:11:42 +02:00
Akihiro Suda
a6f337bba8 Merge pull request #13560 from jgehrcke/klauspost-gzip-decomp
pkg/archive/compression: use klauspost/compress/gzip for decode
2026-06-30 13:51:32 +00:00
Maksym Pavlenko
10004d5967 Merge pull request #13675 from thaJeztah/rm_sequential
pkg/archive: remove redundant github.com/moby/sys/sequential dependency
2026-06-26 15:58:07 +00:00
Sebastiaan van Stijn
35f753cc44 pkg/archive: remove redundant github.com/moby/sys/sequential dependency
Go 1.26 adds support for passing Windows file flags via os.OpenFile,
eliminating the need to call windows.CreateFile directly.

github.com/moby/sys/sequential v0.7.0 uses this functionality when
compiled with go1.26, but provides fallbacks for older Go versions.

Given that containerd has go1.26 as a minimum requirement, we can
remove github.com/moby/sys/sequential as an intermediate, and implement
the code locally.

ref:

- 9d2fc630f5
- https://go-review.googlesource.com/c/go/+/699415
- https://go-review.googlesource.com/c/go/+/724621

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-06-26 10:14:53 +02:00
Sebastiaan van Stijn
7a7aebfcbf pkg/oci: update TestOpenUserFileCapsReads to use newlined data
This test verifies the maximum file-size constraints that were added in
[containerd7b05ec4]. However, github.com/moby/sys@v0.4.1 adds similar
constraints, including a constraint on line-length (1M): [moby/sys@2c56c3d]
that may hit before the file-size limit is reached if the data does not
contain newlines.

This patch updates the test to use data that includes newlines to make
sure it's testing the file-size constraints, not line-limit constraints.

[containerd7b05ec4]: 7b05ec421d
[moby/sys@2c56c3d]: 2c56c3d5d0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-06-26 09:57:28 +02:00
Derek McGowan
53f4271fd9 Merge pull request #13661 from akerouanton/default-unix-spec
oci: use path.Join to fill CgroupsPath
2026-06-25 14:18:19 +00:00
Albin Kerouanton
51e3a8f4ab oci: use path.Join to fill CgroupsPath
`populateDefaultUnixSpec` uses `filepath.Join` to generate the default
`CgroupsPath`. On Windows, this produces invalid paths as path elems are
joined with backslash. Switch to `path.Join` instead.

Signed-off-by: Albin Kerouanton <albin.kerouanton@docker.com>
2026-06-24 10:20:54 +02:00
Samuel Karp
5558f3aa0e Merge pull request #13626 from samuelkarp/june-18-combined-main
Patches
2026-06-18 16:02:14 -07:00
Chris Henzie
5a91c99584 Merge commit from fork 2026-06-15 21:25:17 -07:00
Dr. Jan-Philip Gehrcke
d8f13bf4cc pkg/archive/compression: use klauspost/compress/gzip for decode
Replace the stdlib compress/gzip decoder with klauspost's inflate.
Also see
https://github.com/containerd/containerd/issues/13559

Signed-off-by: Dr. Jan-Philip Gehrcke <jgehrcke@nvidia.com>
2026-06-15 14:34:15 -05:00
Esteban Ginez
be3fcf33e8 fix(shim/windows): retry on winio.ErrTimeout in awaitPipeReady
awaitPipeReady retried only when DialPipe returned os.IsNotExist or
context.DeadlineExceeded, but winio.DialPipe converts the per-attempt
deadline into winio.ErrTimeout before returning. A pipe in state 1
(ListenPipe called, Accept not yet called) causes DialPipe to block for
the full per-attempt timeout and return winio.ErrTimeout, which the old
check treated as a fatal error instead of retrying.

Also guard windows.ERROR_PIPE_BUSY explicitly to match the error checks
in containerd/nerdbox#218.

Adds a regression test that forces the state-1 to state-2 transition
race by delaying Accept past the 1-second per-attempt timeout.

Signed-off-by: Esteban Ginez <esteban.ginez@docker.com>
2026-06-10 14:49:50 -07:00
Ben Cressey
0ec1af4cae Do not propagate reserved labels from image configs
Image config labels are copied onto the container by both the CRI
plugin (BuildLabels) and the client's WithImageConfigLabels option
used by `ctr run`. Labels in the containerd.io/* namespace are
interpreted by containerd itself and labels in the io.cri-containerd*
namespace are interpreted by the CRI plugin. An image config is not a
trusted source for labels in either namespace.

Skip labels in both reserved namespaces when copying labels from an
image config to a container, and warn about each label skipped: an
image that tries to set them may be attempting to alter containerd
behavior. Oversized image labels are already skipped this way by
the CRI plugin.

Labels set explicitly by clients, for example via `ctr run --label`
or in the CRI request, are unaffected.

Verified with the CRI plugin and with `ctr run` against an image
whose config carries labels like these: the labels are no longer
present on the created container and a warning is logged for each.

Assisted-by: Claude Code
Signed-off-by: Ben Cressey <ben@cressey.org>
Signed-off-by: Samuel Karp <samuelkarp@google.com>
2026-06-10 13:18:24 -07:00
Sebastiaan van Stijn
633a5be1c9 pkg/oci: WithUser: remove redundant isErrRange utility
`strconv.NumError` implements `Unwrap` (see https://go.dev/cl/194563),
so there's no need to manually assert the type and unwrap.

Updates 9439355c2b

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-05-26 10:14:17 +02:00
LEI WANG
9439355c2b oci: return explicit error for out-of-range USER values
Detect strconv.ErrRange and validate uid/gid bounds to avoid falling back to username/group lookups.

Signed-off-by: LEI WANG <ssst0n3@gmail.com>
2026-05-19 11:36:54 -07:00
Samuel Karp
ae843af785 Merge pull request #13360 from mxpv/task
Fix sandbox task API endpoints for non-runc runtimes
2026-05-19 00:15:24 +00:00
Maksym Pavlenko
b88ab5af4f Wire task address and version fields
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2026-05-18 13:37:19 -07:00
Chris Henzie
7b05ec421d Bound user-database file reads in openUserFile
openUserFile now stats the opened file, refuses anything that is not a
regular file, and wraps the returned fs.File so reads are capped at
maxUserFileBytes (10 MiB). All callers of openUserFile read either
etc/passwd or etc/group; both are regular files on real systems, well
under the cap.

The cap and the regular-file check together bound parser memory use
when reading user-database files of unexpected shape or size.

Adds tests for the cap and for the non-regular file rejection. The cap
test covers three boundary points: a small pad (trailing entry parsed),
a pad placing the entry's last byte exactly on the cap (still parsed),
and a pad past the cap (read returns an "exceeds" error).

Assisted-by: Antigravity
Signed-off-by: Chris Henzie <chrishenzie@gmail.com>
2026-05-16 01:04:01 +00:00
Kir Kolyshkin
899dee1f59 pkg: remove unused nolint annotations
Commit f9c80be1b removed varcheck linter, but some nolint:varcheck
annotations are still there, resulting in golangci-lint warning:

> WARN [runner/nolint_filter] Found unknown linters in //nolint directives: varcheck

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-05-12 11:02:51 -07:00
Maksym Pavlenko
3e0ebf0f6d Deprecate shim.Command
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2026-04-29 10:51:55 -07:00
Sanil2108
f62bce25df pkg/rootfs: remove unused InitRootFS and related helpers
InitRootFS was added in #1477 for potential future use but has no
callers either inside or outside this repository. Remove it along
with the associated Mounter interface, initializerFunc type,
createInitLayer helper, and the platform-specific init files that
only existed to support it.

Fixes #13238

Signed-off-by: Sanil2108 <sanilkhurana7@gmail.com>
2026-04-21 08:59:39 +05:30
Derek McGowan
e07a1aa491 Add configuration for socket directory to the shim manager
Allow the socket directory to be directly configured by the shim manager
with reasonable defaults when not set. The default for root users will
still be the same directory under the default state directory. For
non-root users a temp directory will be used as default if the state
directory is not owned by the user.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2026-04-15 00:21:29 -07:00
Derek McGowan
d806373feb Make shim socket directory use configured state
Send the socket directory from containerd to the shim. The shim still
decides where the socket goes but can use the environment variable
passed from containerd to ensure the socket is placed in the configured
directory with proper permission.

This is needed for some rootless cases which do not have permission to
the default state directory as currently set. The directory being
hardcoded by the shim means it is currently not possible to change the
location the shim will listen at.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2026-04-15 00:21:18 -07:00
Derek McGowan
74b465dcc6 Merge pull request #13208 from dmcgowan/update-bootstrap-log-levels
Update bootstrap API log level definition
2026-04-10 17:01:20 -07:00
Derek McGowan
2c102c6cbe Update bootstrap API log level definition
Avoid using logrus concepts in the API, use slog style log levels with
integer values and 0 meaning the default "info" level.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2026-04-10 15:23:34 -07:00
Esteban Ginez
01e5fa616f fix: address review feedback on awaitPipeReady
- Use time.NewTimer + Stop() instead of time.After to avoid timer leaks
- Treat context.DeadlineExceeded as retryable (pipe busy, not just missing)
- Wrap last dial error instead of os.ErrNotExist for better diagnostics
- Update makeConnection godoc to reflect current BootstrapResult type

Signed-off-by: Esteban Ginez <esteban.ginez@docker.com>
2026-04-09 15:15:32 -07:00
Esteban Ginez
1e98ebaf0e fix(windows): verify pipe readiness before returning shim address
The shim "start" helper returns the named pipe address before the
daemon process has created the pipe via winio.ListenPipe(). On busy
Windows systems, containerd may try to connect before the pipe exists.

Add awaitPipeReady() — the start helper now polls the pipe address
(up to 5s, 10ms intervals) before writing the bootstrap result to
stdout. This follows hcsshim's readiness pattern where the shim
verifies its endpoint is ready before signaling the parent.

As a safety net, also parameterize makeConnection() with a dialer so
binary.Start() uses AnonDialer (retry) for new shims while loadShim()
keeps AnonReconnectDialer (fail-fast) for reconnects per #3659.

On Unix, awaitPipeReady() is a no-op: domain sockets appear atomically.

Signed-off-by: Esteban Ginez <esteban.ginez@docker.com>
2026-04-09 15:07:06 -07:00
Derek McGowan
a755ca16e5 Merge pull request #12865 from dmcgowan/readonly-overlay-erofs-no-mount
Support reading readonly overlays without mounting
2026-04-09 18:37:15 +00:00
Maksym Pavlenko
16b7ce2549 Address code review suggestions
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2026-04-08 08:29:28 -05:00
Maksym Pavlenko
45b7de2837 Limit amount of bytes read from stdin
Co-authored-by: Samuel Karp <me@samuelkarp.com>
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2026-04-08 08:29:28 -05:00
Maksym Pavlenko
3c0e8a55b6 Update comments wording about when to deprecate and remove the old path
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2026-04-08 08:29:28 -05:00
Maksym Pavlenko
9bf65dcf02 Use enums instead of strings for capabilities and log level
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2026-04-08 08:29:28 -05:00
Maksym Pavlenko
9dc864fd0f Switch to proto instead of json
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2026-04-08 08:29:28 -05:00
Maksym Pavlenko
73edc80451 Format code after cherry pick
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2026-04-08 08:29:28 -05:00
Derek McGowan
243cab594e Deprecate old pkg/shim interfaces
Signed-off-by: Derek McGowan <derek@mcg.dev>
2026-04-08 08:29:28 -05:00
Maksym Pavlenko
3fbdb132bf Fix module path
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2026-04-08 08:29:28 -05:00
Maksym Pavlenko
d957b1bf53 Use log level instead of debug flag
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2026-04-08 08:29:28 -05:00
Maksym Pavlenko
31d0bbbad7 Include containerd version when launching shim
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2026-04-08 08:29:28 -05:00
Maksym Pavlenko
f71c2e4211 Reformat and clean proto files
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2026-04-08 08:29:28 -05:00