Commit Graph

12912 Commits

Author SHA1 Message Date
Sebastiaan van Stijn
1480e3bd4f
leases: cleanup TestWithLabels
- don't define a type, but just an ad-hoc struct
- use a single slice with test-cases; this allows IDE's to pick up the
  table as a test-table (which allows (re-)running individual tests)
- make use of testify's assert.Equal to compare the results, instead
  of a DIY loop over the expected values.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-09-11 18:36:16 +02:00
Marat Radchenko
d94a789d15 Fix usages of mountinfo.PrefixFilter
It says: The prefix path **must be absolute, have all symlinks resolved, and cleaned**. But those requirements are violated in lots of places.

What happens when it is given a non-canonicalized path is that `mountinfo.GetMounts` will not find mounts.

The trivial case is:
```
$ mkdir a && ln -s a b && mkdir b/c b/d && mount --bind b/c b/d && cat /proc/mounts | grep -- '[ab]/d'
/dev/sdd3 /home/user/a/d ext4 rw,noatime,discard 0 0
```
We asked to bind-mount b/c to b/d, but ended up with mount in a/d.
So, mount table always contains canonicalized mount points, and it is an error to look for non-canonicalized paths in it.

Signed-off-by: Marat Radchenko <marat@slonopotamus.org>
2023-09-10 15:14:26 +03:00
Fu Wei
d015c99b2e
Merge pull request #9060 from zhuangqh/polish-criu
task: expose criu work path opt
2023-09-09 16:35:04 +08:00
Fu Wei
40f8ce622b
Merge pull request #9072 from thaJeztah/update_golang_1.21.1
update to go1.21.1, go1.20.8
2023-09-09 12:41:14 +08:00
jerryzhuang
45e303eea5 task: expose criu work path opt
Signed-off-by: jerryzhuang <zhuangqhc@gmail.com>
2023-09-09 12:13:09 +08:00
Sam Edwards
f77185f9e8 Fix "even if IPv4 comes first" test to have IPv4 first
Signed-off-by: Sam Edwards <CFSworks@gmail.com>
2023-09-08 21:46:10 -06:00
Sam Edwards
88a849626f Don't use To16() != nil to detect IPv6 addresses
The ip.To16() function returns non-nil if `ip` is any kind
of IP address, including IPv4. To look for IPv6 specifically,
use ip.To4() == nil.

Signed-off-by: Sam Edwards <CFSworks@gmail.com>
2023-09-08 21:44:49 -06:00
Sebastiaan van Stijn
eaf6071019
update to go1.21.1, go1.20.8
go1.21.1 (released 2023-09-06) includes four security fixes to the cmd/go,
crypto/tls, and html/template packages, as well as bug fixes to the compiler,
the go command, the linker, the runtime, and the context, crypto/tls,
encoding/gob, encoding/xml, go/types, net/http, os, and path/filepath packages.
See the Go 1.21.1 milestone on our issue tracker for details:

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

full diff: https://github.com/golang/go/compare/go1.21.0...go1.21.1

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:02:43 +02:00
Derek McGowan
210db9b101
Merge pull request #9067 from thaJeztah/update_cdi
vendor: github.com/cncf-tags/container-device-interface v0.6.1
2023-09-08 15:19:37 -07:00
Derek McGowan
1a7490c5a6
Add link to CONTRIBUTING from README
Replace link to BUILDING since CONTRIBUTING already points to it

Signed-off-by: Derek McGowan <derek@mcg.dev>
2023-09-08 11:18:14 -07:00
Derek McGowan
0413f12723
Add contributors guide
Signed-off-by: Derek McGowan <derek@mcg.dev>
2023-09-08 11:18:14 -07:00
Sebastiaan van Stijn
05093d7c07
vendor: github.com/cncf-tags/container-device-interface v0.6.1
Removes uses of the github.com/opencontainers/runc/libcontainer/devices
package.

full diff: https://github.com/cncf-tags/container-device-interface/compare/v0.6.0...v0.6.1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-09-08 13:53:43 +02:00
Ethan Lowman
ac1d556b92
Add image verifier transfer service plugin system based on a binary directory
Signed-off-by: Ethan Lowman <ethan.lowman@datadoghq.com>
2023-09-07 18:45:02 -04:00
Jordan Liggitt
55b2df560f
go.mod: github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.2
Signed-off-by: Jordan Liggitt <liggitt@google.com>
2023-09-07 16:53:10 -04:00
Jordan Liggitt
a00888db83
fix reference to canonical fieldmask type
Signed-off-by: Jordan Liggitt <liggitt@google.com>
2023-09-07 16:53:02 -04:00
Maksym Pavlenko
c13f47a3ae
Merge pull request #9029 from dmcgowan/push-inherit-distribution-sources
push: inherit distribution sources from parent
2023-09-07 12:46:18 -07:00
Derek McGowan
74e205f1e7
Merge pull request #8792 from zhuangqh/fix/writer-deadlock
content: reduce the contention between ref lock and boltdb lock
2023-09-06 09:58:07 -07:00
Akihiro Suda
e44d9e1c4f
Merge pull request #9061 from AkihiroSuda/crun-1.8.7
CI: bump up crun to 1.8.7
2023-09-07 01:32:48 +09:00
Phil Estes
827a960303
Merge pull request #9050 from vernou/fix-windows-installation-script
fix(docs): fix on the windows installation script
2023-09-06 12:07:00 -04:00
Akihiro Suda
0041996ca0
CI: bump up crun to 1.8.7
https://github.com/containers/crun/compare/1.8.3...1.8.7

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2023-09-06 23:45:56 +09:00
VERNOU Cédric
4bc0b26602
Revert the removal of the parameter Container
Signed-off-by: VERNOU Cédric <1659796+vernou@users.noreply.github.com>
2023-09-06 14:56:21 +02:00
Akhil Mohan
6ec0d4a3ad
prevent ctr from creating tags with forbidden characters
check if the target tag that is to be created using ctr image tag
is valid and does not contain any forbidden characters.

Signed-off-by: Akhil Mohan <makhil@vmware.com>
2023-09-06 15:47:52 +05:30
jerryzhuang
a4bdbf7844 content: reduce the contention between ref lock and boltdb lock
tryLock only once to reduce the amount of time the lock is held

Signed-off-by: jerryzhuang <zhuangqhc@gmail.com>
2023-09-05 23:34:13 +08:00
Fu Wei
5c37d3827b
Merge pull request #9055 from fuweid/fix-fuzz-issue
contrib/fuzz: fix redeclared issue
2023-09-05 23:03:57 +08:00
Derek McGowan
b11439fc4b
Merge pull request #9034 from thaJeztah/replace_reference
replace reference/docker for github.com/distribution/reference v0.5.0
2023-09-05 06:52:29 -07:00
Akihiro Suda
0ee2433c94
Merge pull request #5890 from artqzn/idmapped_mounts
RFC: Initial support of idmapped mount points
2023-09-05 20:41:05 +09:00
Wei Fu
abfabb6d82 contrib/fuzz: fix redeclared issue
Signed-off-by: Wei Fu <fuweid89@gmail.com>
2023-09-05 19:04:19 +08:00
Akihiro Suda
e30a40eb65
Merge pull request #9016 from djdongjin/remove-most-logrus
Remove most logrus import
2023-09-05 16:09:12 +09:00
Ilya Hanov
295bcec074 snapshotter: implement unit tests for idmapped mounts for overlay
Signed-off-by: Ilya Hanov <ilya.hanov@huawei-partners.com>
2023-09-05 01:23:30 +03:00
Ilya Hanov
9d01ed1c32 integration: add test for idmapped mounts
Signed-off-by: Alexey Perevalov <alexey.perevalov@huawei.com>
Signed-off-by: Ilya Hanov <ilya.hanov@huawei-partners.com>
2023-09-05 01:23:30 +03:00
Ilya Hanov
e49e6d6fd7 snapshotter: implement slow path for idmapped mounts check for overlay
Signed-off-by: Ilya Hanov <ilya.hanov@huawei-partners.com>
2023-09-05 01:23:30 +03:00
Ilya Hanov
1555a31bf6 mount: support idmapped mount points
This patch introduces idmapped mounts support for
container rootfs.

The idmapped mounts support was merged in Linux kernel 5.12
torvalds/linux@7d6beb7.
This functionality allows to address chown overhead for containers that
use user namespace.

The changes are based on experimental patchset published by
Mauricio Vásquez #4734.
Current version reiplements support of idmapped mounts using Golang.

Performance measurement results:
Image           idmapped mount  recursive chown
BusyBox         00.135          04.964
Ubuntu          00.171          15.713
Fedora          00.143          38.799

Signed-off-by: Mauricio Vásquez <mauricio@kinvolk.io>
Signed-off-by: Artem Kuzin <artem.kuzin@huawei.com>
Signed-off-by: Alexey Perevalov <alexey.perevalov@huawei.com>
Signed-off-by: Ilya Hanov <ilya.hanov@huawei-partners.com>
2023-09-05 01:23:30 +03:00
Ilya Hanov
723c88ce30 snapshotter: add "--remap-labels" support to overlayfs
Previously the only fuse-overlayfs supports "--remap-labels" option.
Since idmapped mounts were landed to Linux kernel v5.12 it becomes
possible to use it with overlayfs via mount_setattr() system call.

The changes are based on experimental patchset published by
Mauricio Vásquez #4734.

Signed-off-by: Mauricio Vásquez <mauricio@kinvolk.io>
Signed-off-by: Artem Kuzin <artem.kuzin@huawei.com>
Signed-off-by: Ilya Hanov <ilya.hanov@huawei-partners.com>
2023-09-05 01:23:30 +03:00
Ilya Hanov
e8ddf669f5 snapshotter: support "remap-ids" capability for overlayfs
Previously remapping of a snapshotter has been done using
recursive chown.

Commit
31a6449734 added a support
for "remap-ids" capability which allows snapshotter internals do
remappings in case of idmapped mounts support to avoid recursive
chown and creating a new remapped snapshot.

Signed-off-by: Ilya Hanov <ilya.hanov@huawei-partners.com>
2023-09-05 01:23:30 +03:00
Derek McGowan
817391989f
Merge pull request #9044 from thaJeztah/update_uuid
vendor: github.com/google/uuid v1.3.1
2023-09-04 14:30:46 -07:00
VERNOU Cédric
ef6b91947e
fix(docs): fix on the windows installation script
Modify the parameter `-Path` to reference a folder, so `Copy-Item` create the destination folder.
Remove "-Container:$false" that flatten the hierarchy folder.

Signed-off-by: VERNOU Cédric <1659796+vernou@users.noreply.github.com>
2023-09-02 13:19:50 +02:00
Fu Wei
e2bf34feaf
Merge pull request #9033 from dcantah/sberror-include-id
CRI: Include sandbox ID in failed to recover error
2023-09-02 10:48:34 +08:00
Akihiro Suda
74705ae4f4
Merge pull request #9045 from thaJeztah/less_libcontainer
remove uses of github.com/runc/libcontainer/cgroups
2023-09-02 07:56:41 +09:00
Akihiro Suda
5a6c32da38
Merge pull request #9041 from fuweid/enable-fuzz-build
.github: enable fuzz build
2023-09-02 07:47:32 +09:00
Phil Estes
6f2855ef0f
Merge pull request #9036 from kiashok/updateRunhcsVersion 2023-09-01 14:00:28 -04:00
Derek McGowan
dc8b0d80b9
Merge pull request #9042 from dcantah/darwin-blockfile-copyfile
Blockfile: Enlighten blockfile copy on Darwin
2023-09-01 07:18:44 -07:00
Sebastiaan van Stijn
5d31e93787
pkg/systemd: use sync.Once for systemd detection
This brings over the enhancement from a506630e57.

We don't expect the systemd state to change while containerd is running,
so we can use a `sync.Once` for this, to prevent stat'ing each time.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-09-01 12:14:56 +02:00
Sebastiaan van Stijn
7d0ab4fc2c
remove uses of github.com/runc/libcontainer/cgroups
runc considers libcontainer to be "unstable" (not for external use),
so we try not to use it. Commit ed47d6ba76
brought back the dependency on other parts of libcontainer, but looks to
be only depending on a single utility, which in itself was borrowed from
github.com/coreos/go-systemd to not introduce CGO code in the same package.

This patch copies the version from github.com/coreos/go-systemd (adding
proper attribution, although the function is pretty trivial).

runc is in process of moving the libcontainer/user package to an external
module, which means we can remove the dependency on libcontainer entirely
in the near future. There is one more use of `libcontainer` in our vendor
tree; it looks like CDI is depending on one utility (devices.DeviceFromPath);
a943033a8b/vendor/github.com/container-orchestrated-devices/container-device-interface/pkg/cdi/container-edits_unix.go (L38)

We should remove the dependency on that utility, and add a CI check to
prevent bringing it back.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-09-01 12:10:55 +02:00
Sebastiaan van Stijn
9bc6441c21
vendor: github.com/google/uuid v1.3.1
Contains some performance improvements:

full diff: https://github.com/google/uuid/compare/v1.3.0...v1.3.1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-09-01 11:49:50 +02:00
Danny Canter
13ff185ba0 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>
2023-08-31 20:18:48 -07:00
Wei Fu
a3e8503ed2 .github: enable fuzz build
Signed-off-by: Wei Fu <fuweid89@gmail.com>
2023-09-01 10:36:54 +08:00
Kazuyoshi Kato
a943033a8b
Merge pull request #9013 from fish98/main
fuzzing: fix ossfuzz building error
2023-08-31 16:10:43 -07:00
Kazuyoshi Kato
a617005750
Merge pull request #9028 from hinshun/fix/import-unpack-wait
Add missing unpacker.Wait for image import
2023-08-31 16:09:42 -07:00
Derek McGowan
cd705af89b
metadata: add image delete events during garbage collection
Signed-off-by: Derek McGowan <derek@mcg.dev>
2023-08-31 15:10:13 -07:00
Derek McGowan
3f9756c184
gc: add support for image expiration
Update the garbage collector to support image expiration along with
support for image leasing. This allows making images collectible during
garbage collection and using a lease to prevent removal of an image.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2023-08-31 15:10:13 -07:00