3718 Commits

Author SHA1 Message Date
Derek McGowan
0aa8fe0bf9 Update to containerd v2.0.2, buildkit v0.19.0-rc2
Update buildkit version to commit which uses 2.0

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-01-15 14:09:30 +01:00
Sebastiaan van Stijn
3db60168e7 pkg/ioutils: remove crypto/sha256, crypto/sha512 imports
commit 572498be56 moved the ioutils.HashData
utility to the libnetwork resolvconf package.

After removing, we saw some tests  in the reference  pacakge failing;

    === Failed
    === FAIL: reference TestLoad (0.00s)
        store_test.go:53: failed to parse reference: unsupported digest algorithm

    === FAIL: reference TestSave (0.00s)
        store_test.go:82: failed to parse reference: unsupported digest algorithm

    === FAIL: reference TestAddDeleteGet (0.00s)
        store_test.go:174: could not parse reference: unsupported digest algorithm

    === FAIL: reference TestInvalidTags (0.00s)
        store_test.go:355: assertion failed: error is not nil: unsupported digest algorithm

Those failures were because those tests depended on a side-effect of the
ioutils package being imported, which (before removal of HashData) imported
crypto/sha256, registering that algorithms, which on its turn was used by
github.com/opencontainers/go-digest to determnin if a given algorithm must
be accepted (see [go-digest#64]).

As a workaround, these imports were added. pkg/ioutils is now imported
in less places, and should not be depended on for this purpose.

Let's remove this workaround; if needed, these imports can be added in
a more relevant location.

This reverts commit 98caf09f0f.

[go-digest#64]: https://github.com/opencontainers/go-digest/pull/64

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-01-15 00:20:28 +01:00
Sebastiaan van Stijn
e26122c609 pkg/ioutils: remove unused NewReaderErrWrapper
It was added in Docker [v1.3.0] through bd130e72a0,
but never used, and its behavior never documented. There are no publicly
visible external consumers  of this function, so let's remove it.

[v1.3.0]: https://github.com/moby/moby/releases/tag/v1.3.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-01-10 20:55:15 +01:00
Sebastiaan van Stijn
d34a5f5d72 Merge pull request #49152 from thaJeztah/pkg_archive_nolookups
pkg/archive: nosysFileInfo: implement tar.FileInfoNames to prevent lookups
2025-01-10 20:02:47 +01:00
Sebastiaan van Stijn
2b4db9383c pkg/archive: nosysFileInfo: implement tar.FileInfoNames to prevent lookups
commit e9bbc41dd1 removed our fork of
pkg/archive that was in place to mitigate CVE-2019-14271. As part of that
change, a nosysFileInfo type was added to prevent tar.FileInfoHeader from
looking up user- and group-names.

A proposal was pending in go https://go.dev/issue/50102 to define an
interface for implementing custom lookup functions to be implemented,
and disable go's builtin lookup. That proposal was accepted, and is now
implemented in go1.23.

Thia patch makes the nosysFileInfo implement the tar.FileInfoNames interface
to prevent tar.FileInfoHeader from performing its own lookups. While the
mitigation implemented in e9bbc41dd1 should
already prevent this from happening, implementing the interface does not
cost us much and is complementary to the existing mitigation.

This patch keeps the mitigation added in a316b10dab
in place for any unforeseen other code.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-01-10 16:14:38 +01:00
Sebastiaan van Stijn
ce8d3d1c78 pkg/ioutils: remove deprecated NopWriteCloser
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-01-10 15:40:12 +01:00
Sebastiaan van Stijn
39f1abb1fb pkg/ioutils: remove deprecated NopWriter
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-01-10 15:40:12 +01:00
Sebastiaan van Stijn
3faa170371 pkg/ioutils: deprecate NopWriteCloser
It was only used internally, and has no external consumers; deprecate
it to be removed in the next release.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-01-10 14:20:11 +01:00
Sebastiaan van Stijn
7fa3c553e7 pkg/ioutils: deprecate NopWriter
It's not used, and users can use io.Discard instead.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-01-10 14:17:28 +01:00
Sebastiaan van Stijn
71253c38f1 Merge pull request #49245 from thaJeztah/ioutils_cleaner
pkg/ioutils: remove or internalize deprecated types and functions
2025-01-10 14:11:04 +01:00
Paweł Gronowski
d23871469b pkg/sysinfo: Remove deprecated NumCPU
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-01-10 10:26:04 +01:00
Sebastiaan van Stijn
cdd4a7429f pkg/ioutils: remove errWriteFlusherClosed
It's an alias for io.EOF and not exported, so we don't need it.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-01-10 09:21:10 +01:00
Sebastiaan van Stijn
034cd27da0 pkg/ioutils: remove deprecated NopFlusher
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-01-10 09:21:09 +01:00
Sebastiaan van Stijn
e183df63f9 pkg/ioutils: remove deprecated WriteCounter, NewWriteCounter
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-01-10 09:21:09 +01:00
Sebastiaan van Stijn
15ce2914a5 pkg/ioutils: move BytesPipe to container/streams/bytespipe
These types are only used internally in container/streams and have no
external consumers. move them to a subpackage of container/streams.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-01-10 09:21:09 +01:00
Sebastiaan van Stijn
818a180fce pkg/ioutils: deprecate NopFlusher
Apart from being used internally for NewWriteFlusher, it's only used
in a single location outside of this package. Copy the implementation
where it's used, and mark it deprecated.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-01-09 17:56:34 +01:00
Sebastiaan van Stijn
383503d382 pkg/ioutils: deprecate WriteCounter, NewWriteCounter
it was moved to pkg/ioutils in c30a55f14d,
and only had a single use at the time in [engine/Env.WriteTo]. That use
was removed in 531f4122bd, which removed
the engine package.

[engine/Env.WriteTo]: c30a55f14d/engine/env.go (L260-L264)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-01-09 17:23:46 +01:00
Sebastiaan van Stijn
60971a66b4 pkg/ioutils: deprecate BytesPipe, NewBytesPipe, ErrClosed
These types are only used internally in container/streams and have no
external consumers. Deprecate them in preparation of moving them to
a subpackage of container/streams.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-01-09 17:19:43 +01:00
Sebastiaan van Stijn
45fe68629b Merge pull request #49241 from vvoland/runtime-numcpu
pkg/sysinfo: Deprecate NumCPU
2025-01-09 15:15:41 +01:00
Sebastiaan van Stijn
957f77e730 Merge pull request #49177 from thaJeztah/daemon_no_pkg_parsers
deprecate pkg/parsers.ParseKeyValueOpt and move internal
2025-01-09 15:04:38 +01:00
Paweł Gronowski
3db72b255d pkg/sysinfo: Deprecate NumCPU
Deprecate in favor of `runtime.NumCPU` as the behavior is the same now.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-01-09 13:39:49 +01:00
Sebastiaan van Stijn
5b18a7914c deprecate pkg/parsers.ParseKeyValueOpt and move internal
Move the utility to where it's used, and deprecate the implementation
in pkg/parsers.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-01-09 13:14:09 +01:00
Sebastiaan van Stijn
35932cdeec pkg/ioutils: un-export readCloserWrapper
This type was exported in fd35494a25 to be
used in tests in pkg/archive. It's no longer used in pkg/archive since
ba90fd8da0, so we can un-export it.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-01-08 18:29:44 +01:00
Sebastiaan van Stijn
7864454792 pkg/ioutils: move atomic file-writers to a separate (pkg/atomicwriter) package
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-01-08 10:36:32 +01:00
Derek McGowan
9c368a93b6 Split internal idtools functionality
Separare idtools functionality that is used internally from the
functionlality used by importers. The `pkg/idtools` package is now
much smaller and more generic.

Signed-off-by: Derek McGowan <derek@mcg.dev>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-01-07 11:18:46 -08:00
Sebastiaan van Stijn
8260f985b6 Merge pull request #49226 from thaJeztah/idtools_use_user
pkg/idtools: rewrite to use moby/sys/user
2025-01-07 20:01:11 +01:00
Sebastiaan van Stijn
24ad9bef9d pkg/idtools: rewrite to use moby/sys/user
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-01-07 13:43:24 +01:00
Sebastiaan van Stijn
064cdf475c pkg/parsers: deprecate ParseUintListMaximum, ParseUintList
These utilities have been moved internal to pkg/sysinfo in
2282279180, and are no longer
used.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-01-06 21:12:36 +01:00
Sebastiaan van Stijn
1359772433 pkg/sysinfo: parse cpuset.cpus/mems once and memoize
Preserve the result instead of parsing these for each container that
specifies cpuset options,

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-01-06 17:53:25 +01:00
Sebastiaan van Stijn
2282279180 pkg/sysinfo: internalize parsing cpusets
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-01-06 10:46:42 +01:00
Sebastiaan van Stijn
aa696ffbb1 pkg/sysinfo: touch-up docs for cgroupCpusetInfo.Cpus, Mems
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-01-06 10:46:42 +01:00
Sebastiaan van Stijn
4597396cb5 pkg/sysinfo: define const for default Max CPUs
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-01-06 10:46:29 +01:00
Sebastiaan van Stijn
799501d172 pkg/sysinfo: rename vars/arguments for clarity
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-01-06 10:40:09 +01:00
Sebastiaan van Stijn
0d51680f91 pkg/sysinfo: stub out parsing cpusets on non-linux
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-01-06 10:40:08 +01:00
Sebastiaan van Stijn
a51baca00d pkg/fileutils: move GetTotalUsedFds internal in daemon
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-01-03 18:39:43 +01:00
Sebastiaan van Stijn
e45f20352d pkg/fileutils: deprecate GetTotalUsedFds
This function is only used internally and has no external consumers.
Mark it deprecated to be removed in the next release.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-01-03 17:18:15 +01:00
Sebastiaan van Stijn
0fe953dff0 pkg/idtools: use lazyregexp to compile regexes on first use
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-01-02 21:37:33 +01:00
Sebastiaan van Stijn
547151abd2 pkg/sysinfo: cleanup tests
- use t.TempDir()
- combine various tests to check if New() sets expected values instead
  of skipping tests when not.
- remove gotest.tools, as it was only used minimally
- replace uses of "path" for filepath operations.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-01-02 16:51:42 +01:00
Sebastiaan van Stijn
6f6c3b9211 Merge pull request #49172 from thaJeztah/internalize_pkg_broadcaster
remove pkg/broadcaster and make it internal to container/streams
2025-01-01 16:12:00 +01:00
Akihiro Suda
1d3d51f1fe Merge pull request #49182 from thaJeztah/pkg_parsers_rename_var
pkg/parsers: rename var that collided with builtin
2025-01-01 22:39:24 +09:00
Sebastiaan van Stijn
86a2df8be6 pkg/parsers: rename var that collided with builtin
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-12-31 20:17:21 +01:00
Sebastiaan van Stijn
44db31b9cc remove pkg/broadcaster and make it internal to container/streams
This package was only used internally in container/streams and had
no external consumers.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-12-28 17:30:39 +01:00
Sebastiaan van Stijn
6ab9212168 pkg/ioutils: remove OnEOFReader and move it internal
This type was originally in pkg/transport, but got moved to pkg/ioutils
in 276c640be4.

This type is only used in a single location, and has no external consumers,
so we can move it where it's used and un-export it.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-12-28 16:52:54 +01:00
Derek McGowan
4c251b6b03 Add pool for archive decompress stream
Cleanup decompress logic and add a pool. The close logic should be
custom defined for each compression type since they have different
close interfaces.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2024-12-23 17:45:10 -08:00
Derek McGowan
9189a6e0ab Fix chrootarchive test
After the untar errors, the reader must complete in order to fill
the buffer used by the subsequent check.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2024-12-23 17:45:10 -08:00
Derek McGowan
a93a079cb4 Remove use of pools in archive
Signed-off-by: Derek McGowan <derek@mcg.dev>
2024-12-23 17:45:10 -08:00
Sebastiaan van Stijn
bc61b31935 pkg/idtools: remove uses of deprecated system.MkdirAll
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-12-21 14:28:04 +01:00
Sebastiaan van Stijn
4472e9b7f8 pkg/system: deprecate MkdirAll and remove custom volume GUID handling
commit 86d1223a29 introduced a custom version
of `os.MkdirAll` for Windows to account for situations where the path to
create would start with a Windows volume name (GUID path), for example,
`"\\?\Volume{4c1b02c1-d990-11dc-99ae-806e6f6e6963}\`. At the time that patch
was added we were using [go1.4.2], which did not have special handling
for Windows in [MkdirAll], therefore would recognize such paths as regular
paths, trying to create them, which would fail.

This code was later updated in 46ec4c1ae2
to provide ACL (DACL) support on Windows.

Further updates were made in cfef1b11e5 and
55ceb5047c to allow for an early return when
detecting a volume GUID path, and the code was re-aligned with the latest
(go1.19.2) implementation in f058afc861, which
brought in the platform-specific [fixRootDirectory] handling introduced in
go1.11. While that enhancement detected UNC volume-paths (`\\?c\`, `//?/c:`),
it did not yet support volume GUID paths.

go1.22, through [golang.org/cl/86295] added support for this, and `os.MkdirAll`
now natively detects volume GUID paths, making our own implementation for
this redundant.

This patch:

- Deprecates pkg/system.MkdirAll in favor of os.MkdirAll, which now provides
  the same functionality on go1.22 and up.
- Renames the (non-exported) `mkdirall` function to `mkdirAllWithACL`, and
  synchronises `it` with the [implementation in go1.23.4], bringing in the
  changes from [golang.org/cl/86295] and [golang.org/cl/582499].
- Adds a fast path to `MkdirAllWithACL` if no ACL / SDDL is provided.

It's worth noting that we currently still support go1.22, and that the
implementation changed in go1.23; those changes ([golang.org/cl/581517]
and [golang.org/cl/566556]) were lateral moves, therefore should be
identical to the implementation in go1.22, and we can safely use the
implementation provided by [filepath.VolumeName] on either go1.22 or go1.23.

[go1.4.2]: 86d1223a29/Dockerfile (L77)
[MkdirAll]: https://github.com/golang/go/blob/go1.4.2/src/os/path.go#L19-L60
[fixRootDirectory]: b86e766813
[golang.org/cl/86295]: cd589c8a73
[golang.org/cl/582499]: 5616ab6025
[golang.org/cl/581517]: ad22356ec6
[golang.org/cl/566556]: ceef0633b3
[1]: https://github.com/golang/go/blob/go1.23.4/src/os/path.go#L12-L66
[filepath.VolumeName]: https://pkg.go.dev/path/filepath#VolumeName

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-12-21 14:19:01 +01:00
Sebastiaan van Stijn
524a63a958 pkg/chrootarchive: remove "// import" comments
These comments were added to prevent users from accidentally
importing using the wrong module name, but they don't have
an effect when working in go modules mode.

Remove the comments in preparation of moving this package
to a separate module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-12-19 22:27:40 +01:00
Sebastiaan van Stijn
302ca6227f pkg/chrootarchive: use stdlib errors
Remove use of github.com/pkg/errors for this package, in preparation
of it being moved to a separate module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-12-19 22:26:42 +01:00