Commit Graph
26 Commits
Author SHA1 Message Date
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 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
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:

- https://github.com/moby/sys/commit/9d2fc630f5932bed2dc29585a5ef6b025f5d58bf
- 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
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
Sebastiaan van Stijn 828c2119e5 pkg: modernize: any
go install golang.org/x/tools/go/analysis/passes/modernize/cmd/modernize@latest
    modernize -any -fix ./...

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-03-15 18:24:15 +01:00
Sebastiaan van Stijn 5dd377a6ae pkg: modernize: mapsloop
go install golang.org/x/tools/go/analysis/passes/modernize/cmd/modernize@latest
    modernize -mapsloop -fix ./...

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-03-15 15:00:12 +01:00
Sebastiaan van Stijn 3354221293 pkg: modernize: rangeint
go install golang.org/x/tools/go/analysis/passes/modernize/cmd/modernize@latest
    modernize -rangeint -fix ./...

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-03-15 14:55:21 +01:00
Shachar Tal ba50a5645c Fix TOCTOU race bug in tar extraction
Signed-off-by: Shachar Tal <stal@paloaltonetworks.com>
2026-03-03 11:08:18 +02:00
yashsingh74 d93d18c857 fix: QF1001: could apply De Morgan's law (staticcheck)
Signed-off-by: yashsingh74 <yashsingh1774@gmail.com>
2025-06-18 14:16:41 +05:30
Derek McGowan aa9c17c692 Add symlink breakout test for overriden path
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-05-20 16:58:12 -07:00
Samuel Karp 38c9bb93a3 Revert "perf(applyNaive): avoid walking the tree for each file in the same directory"
This reverts commit d8063c30dd.

Signed-off-by: Samuel Karp <samuelkarp@google.com>
2025-05-12 16:36:10 -07:00
Phil Estes b1924f1fd2 Merge pull request #11337 from azr/tar-rootpath-cache
perf(applyNaive): avoid walking the tree for each file in the same directory
2025-03-07 21:08:05 +00:00
Adrien DelormeandCorentin REGAL d8063c30dd perf(applyNaive): avoid walking the tree for each file in the same directory
This for example allowed us to gain ~5s while pulling ghcr.io/huggingface/text-generation-inference:3.0.2

Signed-off-by: Adrien Delorme <azr@users.noreply.github.com>
Co-Authored-By: Corentin REGAL <143578+co42@users.noreply.github.com>
2025-02-28 18:50:45 +01:00
Kirtana Ashok 6c02321f6e Merge pull request #11179 from ambarve/blocked_cim
Support for importing layers in the block CIM format.
2025-02-24 22:21:10 +00:00
Amit Barve a1c540085f Support for importing layers in the block CIM format.
Adds a new diff plugin that can import image layers in the block CIM format using the new
block CIM layer writer added in hcsshim repo.

This commit also makes another important change in the way a diff is applied when using
CimFS based layer writers. Currently, the diff plugins call archive.Apply to apply a diff
and pass a function (that can actually apply the diff) as an argument (via
archive.ApplyOptions). This allows the callers to call archive.Apply with either a custom
applier function or if the caller doesn't pass such a function archive.Apply uses the
default naive diff applier.
However, there is drawback to this approach. The applier function passed to the
`archive.Apply` call needs to follow a specific signature. This signature expects it that
all parent layers are represented as an array of strings. In cases like CimFS, we can't
easily represent a set of layers as strings (unless we encode extra data in those strings
in a hacky way). To get around this problem, the diff plugins for CimFS based layers, skip
the archive.Apply call and directly call the layer writer instead.

Signed-off-by: Amit Barve <ambarve@microsoft.com>
2025-02-10 14:10:37 -05:00
Adrien DelormeandCorentin REGAL c51f5d26f1 perf(zstd): deactivate the low mem decoder
Signed-off-by: Adrien Delorme <azr@users.noreply.github.com>
Co-Authored-By: Corentin REGAL <143578+co42@users.noreply.github.com>
2025-02-05 14:39:16 +01:00
Amit Barve b81ace8724 Update cimfs snapshotter & differ for new hcsshim interface
hcsshim recently [updated](microsoft/hcsshim@1d406d0) the interface of APIs that are used
for importing OCI layers. It now expects that the CimFS snapshotter mounts contain the
full cim paths for parent layers. This change updates the cimfs differ & snapshotter to
use that new interface.

Signed-off-by: Amit Barve <ambarve@microsoft.com>
2025-01-10 17:06:57 -05:00
Jin Dong 2de1030299 Move fuzz tests to go native fuzz [part1]
Signed-off-by: Jin Dong <djdongjin95@gmail.com>
2024-12-24 22:48:20 +00:00
Derek McGowan 17f7858b4e Update differ to handle zstd media types
The differ should be able to generate zstd compressed layers when
provided with the zstd media type.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2024-11-26 14:29:21 -08:00
Sebastiaan van Stijn 9776047243 migrate to github.com/moby/sys/userns
Commit 8437c567d8 migrated the use of the
userns package to the github.com/moby/sys/user module.

After further discussion with maintainers, it was decided to move the
userns package to a separate module, as it has no direct relation with
"user" operations (other than having "user" in its name).

This patch migrates our code to use the new module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-08-08 12:48:54 +02:00
Sebastiaan van Stijn 8437c567d8 pkg/userns: deprecate and migrate to github.com/moby/sys/user/userns
The userns package in libcontainer was integrated into the moby/sys/user
module at commit [3778ae603c706494fd1e2c2faf83b406e38d687d][1].

This patch deprecates the containerd fork of that package, and adds it as
an alias for the moby/sys/user/userns package.

[1]: https://github.com/opencontainers/runc/commit/3778ae603c706494fd1e2c2faf83b406e38d687d

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-26 09:47:50 +02:00
Colin O'Dell c8254dfae9 Include filename in error
Signed-off-by: Colin O'Dell <colinodell@gmail.com>
2024-07-16 12:14:36 -04:00
Danny Canter b50e9eae43 Refactor spots to make use of sys.IgnoringEintr
This makes use of pkg/sys's IgnoringEintr function
to clean up some of the redundant eintr loops we
had laying around.

Signed-off-by: Danny Canter <danny@dcantah.dev>
2024-04-10 11:24:01 -07:00
Akihiro Suda d9b9160ae1 mv internal/testutil pkg/testutil
The package is consumed by several snapshotter plugins

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2024-03-04 17:00:39 +09:00
Derek McGowan 1c4be2d883 Move pkg/testutil to internal/testutil
Signed-off-by: Derek McGowan <derek@mcg.dev>
2024-01-17 09:57:28 -08:00
Derek McGowan 8e14c39e80 Move archive to pkg/archive
Signed-off-by: Derek McGowan <derek@mcg.dev>
2024-01-17 09:54:18 -08:00