Commit Graph

10731 Commits

Author SHA1 Message Date
Kazuyoshi Kato
82adbc849a Run fuzzing tests with go test -fuzz
In addition to oss-fuzz's CIFuzz (see #7052), this commit adds a small
shell script that run all fuzzing tests with go test -fuzz.

While running for 30 seconds would be too short to acutally find issues,
we want to make sure that these fuzzing tests are not fundamentally
broken.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2022-06-15 16:23:37 +00:00
Kazuyoshi Kato
a1eb2d8a67 Use testing.F on FuzzPlatformsParse
Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2022-06-15 14:56:20 +00:00
Kazuyoshi Kato
57200edf25 Use testing.F on FuzzParseProcPIDStatus
Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2022-06-15 14:56:20 +00:00
Kazuyoshi Kato
04874d51a3
Merge pull request #7052 from AdamKorcz/fuzz3
Run fuzzers in CI
2022-06-15 07:46:04 -07:00
Fu Wei
fbf76c201f
Merge pull request #6913 from wllenyj/devshm 2022-06-14 19:11:44 +08:00
wllenyj
42a386c816 CRI: change the /dev/shm mount options in Sandbox.
All containers except the pause container, mount `/dev/shm" with flags
`nosuid,nodev,noexec`. So change mount options for pause container to
keep consistence.
This also helps to solve issues of failing to mount `/dev/shm` when
pod/container level user namespace is enabled.

Fixes: #6911

Signed-off-by: Jiang Liu <gerry@linux.alibaba.com>
Signed-off-by: Lei Wang <wllenyj@linux.alibaba.com>
2022-06-14 10:45:06 +08:00
wllenyj
a62a95789c CRI: remove default /dev/shm mount in Sandbox.
This's an optimization to get rid of redundant `/dev/shm" mounts for pause container.
In `oci.defaultMounts`, there is a default `/dev/shm` mount which is redundant for
pause container.

Fixes: #6911

Signed-off-by: Jiang Liu <gerry@linux.alibaba.com>
Signed-off-by: Lei Wang  <wllenyj@linux.alibaba.com>
2022-06-14 10:45:06 +08:00
AdamKorcz
ee14f93161 Run fuzzers in CI
Signed-off-by: AdamKorcz <Adam@adalogics.com>
2022-06-13 21:02:24 +01:00
Fu Wei
a5d7185c72
Merge pull request #7008 from mmmmmmmxl/fix/userattr-unmount 2022-06-11 06:59:42 +08:00
Maksym Pavlenko
e71ffddb6b
Merge pull request #7042 from samuelkarp/freebsd-unit-tests
Port (some) unit tests to FreeBSD
2022-06-10 15:05:52 -07:00
Kazuyoshi Kato
b5ffeac6db
Merge pull request #6888 from aznashwan/bump-windows-ci-deps
Bump Golang and MinGW versions in Windows setup script.
2022-06-10 11:17:15 -07:00
Kazuyoshi Kato
4ec6a379c0
Merge pull request #6918 from dcantah/windows-snapshotter-cleanup
Windows snapshotter touch ups and new functionality
2022-06-10 11:08:18 -07:00
Kazuyoshi Kato
d6518b6da4
Merge pull request #7032 from swagatbora90/snapshotter-naming-comments
Improve naming consistencies in comments in snapshotter.go
2022-06-10 10:45:49 -07:00
Kazuyoshi Kato
fb0fe40c50
Merge pull request #7022 from kzys/static
Make building static binaries simpler
2022-06-10 10:11:35 -07:00
Samuel Karp
5560b622d6
archive: Explicitly specify stdio for tar(1)
Different tar(1) implementations default to different input and output
locations when none is specified.  This can include tape devices like
/dev/st0 (on Linux) or /dev/sa0 (on FreeBSD), but may be overridden by
compilation options or environment variables.  Using the f option with
the special value of - instructs tar(1) to read from stdin and write to
stdout instead of the default.

Signed-off-by: Samuel Karp <me@samuelkarp.com>
2022-06-09 18:54:10 -07:00
Samuel Karp
95f1d79718
platforms: Run goimports for FreeBSD
Signed-off-by: Samuel Karp <me@samuelkarp.com>
2022-06-09 18:54:10 -07:00
Samuel Karp
42e019e634
cri/server: Disable tests on FreeBSD
The TestPodAnnotationPassthroughContainerSpec test and the
TestContainerAnnotationPassthroughContainerSpec test both depend on a
platform-specific implementation of criService.containerSpec, which is
unimplemented on FreeBSD.

The TestSandboxContainerSpec depends on a platform-specific
implementation oc criService.sandboxContainerSpec, which is
unimplemented on FreeBSD.

Signed-off-by: Samuel Karp <me@samuelkarp.com>
2022-06-09 18:54:10 -07:00
Samuel Karp
ad8e598060
oci: Remove empty mount option slice for FreeBSD
Mount options are marked `json:omitempty`. An empty slice in the default
object caused TestWithSpecFromFile to fail.

Signed-off-by: Samuel Karp <me@samuelkarp.com>
2022-06-09 18:54:10 -07:00
Samuel Karp
c15f0cdaf0
oci: FreeBSD devices may have major number 0
Signed-off-by: Samuel Karp <me@samuelkarp.com>
2022-06-09 18:54:09 -07:00
Samuel Karp
2ab8c12fc8
archive: use Linkat on FreeBSD for hardlinks
Calling link(2) with a symlink as the target will cause FreeBSD to
attempt to create a new hard link pointing to the target of the symlink
rather than a hardlink to the symlink itself. By contrast, Linux creates
a hardlink to the symlink.

Use linkat(2) instead, which accepts a flag controlling this behavior.
If linkat(2) is called with AT_SYMLINK_FOLLOW, it will behave the same
as link(2).  If linkat(2) is called without AT_SYMLINK_FOLLOW, it will
behave the same as Linux's link(2) instead.

See FreeBSD's implementation of ln(1), which uses linkat(2) and controls
this behavior by way of the -P and -L flags:
3003117253/bin/ln/ln.c (L342-L343)

Signed-off-by: Samuel Karp <me@samuelkarp.com>
2022-06-09 18:54:09 -07:00
Kazuyoshi Kato
30436a061b
Merge pull request #7033 from mxpv/cri
Allow CRI on Darwin
2022-06-09 16:53:48 -07:00
Swagat Bora
61690d76d2 Improve naming consistencies in comments in snapshotter.go
Signed-off-by: Swagat Bora <sbora@amazon.com>
2022-06-09 17:16:37 +00:00
Maksym Pavlenko
c101f79996 Allow CRI on Darwin
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-06-09 10:13:00 -07:00
Akihiro Suda
e036bdc985
Merge pull request #7034 from thaJeztah/update_runc
update runc binary to v1.1.3
2022-06-09 19:32:29 +09:00
Sebastiaan van Stijn
0167e55abd
update runc binary to v1.1.3
full diff: https://github.com/opencontainers/runc/compare/v1.1.2...v1.1.3

This is the third release of the 1.1.z series of runc, and contains
various minor improvements and bugfixes.

- Our seccomp `-ENOSYS` stub now correctly handles multiplexed syscalls on
  s390 and s390x. This solves the issue where syscalls the host kernel did not
  support would return `-EPERM` despite the existence of the `-ENOSYS` stub
  code (this was due to how s390x does syscall multiplexing).
- Retry on dbus disconnect logic in libcontainer/cgroups/systemd now works as
  intended; this fix does not affect runc binary itself but is important for
  libcontainer users such as Kubernetes.
- Inability to compile with recent clang due to an issue with duplicate
  constants in libseccomp-golang.
- When using systemd cgroup driver, skip adding device paths that don't exist,
  to stop systemd from emitting warnings about those paths.
- Socket activation was failing when more than 3 sockets were used.
- Various CI fixes.
- Allow to bind mount `/proc/sys/kernel/ns_last_pid` to inside container.
- runc static binaries are now linked against libseccomp v2.5.4.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-06-09 07:29:43 +02:00
Samuel Karp
2b4b0cf28f
Merge pull request #7000 from akhramov/freebsd_linux_containers 2022-06-08 18:07:39 -07:00
Maksym Pavlenko
007254791e
Merge pull request #7026 from AkihiroSuda/mountinfo-0.6.2
go.mod: github.com/moby/sys/mountinfo v0.6.2
2022-06-08 10:40:29 -07:00
Derek McGowan
5ebd96d256
Merge pull request #7031 from swagatbora90/fix-spelling-overlay
fix minor spelling mistake: lablel -> label
2022-06-08 09:51:33 -07:00
Akihiro Suda
c3fb7dfa7f
go.mod: github.com/moby/sys/mountinfo v0.6.2
https://github.com/moby/sys/compare/mountinfo/v0.6.0...mountinfo/v0.6.2

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2022-06-08 13:25:08 +09:00
Xinlin Ma
fa4720fa16 fix add ro mount for userattr-unmount unexpected timeout
Signed-off-by: Xinlin Ma <forblue.lin@gmail.com>
2022-06-08 11:34:05 +08:00
Kazuyoshi Kato
0532f666f6
Merge pull request #7027 from AkihiroSuda/containerd-cgroup-1.0.4
go.mod: github.com/containerd/cgroups v1.0.4
2022-06-07 20:10:33 -07:00
Kazuyoshi Kato
a35fbb7ec7
Merge pull request #7028 from AkihiroSuda/continuity-0.3.0
go.mod: github.com/containerd/continuity v0.3.0
2022-06-07 20:10:13 -07:00
Swagat Bora
92d360b58a fix minor spelling mistake: lablel -> label
Signed-off-by: Swagat Bora <sbora@amazon.com>
2022-06-07 21:05:47 +00:00
Derek McGowan
1c54ab1da1
Merge pull request #7029 from Zinbo/correct-spelling-mistake
Correct spelling mistake ("sanbdox" to "sandbox")
2022-06-07 09:49:24 -07:00
Shane Jennings
6190b0f04b
Correct spelling mistake ("sanbdox" to "sandbox")
Signed-off-by: Shane Jennings <superzinbo@gmail.com>
2022-06-07 10:55:15 +01:00
Akihiro Suda
5a6e4144ac
go.mod: github.com/containerd/cgroups v1.0.4
https://github.com/containerd/cgroups/compare/v1.0.3...v1.0.4

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2022-06-07 17:15:21 +09:00
Akihiro Suda
088c8df3ac
go.mod: github.com/containerd/continuity v0.3.0
https://github.com/containerd/continuity/compare/v0.2.2...v0.3.0

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2022-06-07 17:14:08 +09:00
Daniel Canter
44e12dc5d8 Windows snapshotter touch ups and new functionality
This change does a couple things to remove some cruft/unused functionality
in the Windows snapshotter, as well as add a way to specify the rootfs
size in bytes for a Windows container via a new field added in the CRI api in
k8s 1.24. Setting the rootfs/scratch volume size was assumed to be working
prior to this but turns out not to be the case.

Previously I'd added a change to pass any annotations in the containerd
snapshot form (containerd.io/snapshot/*) as labels for the containers
rootfs snapshot. This was added as a means for a client to be able to provide
containerd.io/snapshot/io.microsoft.container.storage.rootfs.size-gb as an
annotation and have that be translated to a label and ultimately set the
size for the scratch volume in Windows. However, this actually only worked if
interfacing with the CRI api directly (crictl) as Kubernetes itself will
fail to validate annotations that if split by "/" end up with > 2 parts,
which the snapshot labels will (containerd.io / snapshot / foobarbaz).

With this in mind, passing the annotations and filtering to
containerd.io/snapshot/* is moot, so I've removed this code in favor of
a new `snapshotterOpts()` function that will return platform specific
snapshotter options if ones exist. Now on Windows we can just check if
RootfsSizeInBytes is set on the WindowsContainerResources struct and
then return a snapshotter option that sets the right label.

So all in all this change:
- Gets rid of code to pass CRI annotations as labels down to snapshotters.

- Gets rid of the functionality to create a 1GB sized scratch disk if
the client provided a size < 20GB. This code is not used currently and
has a few logical shortcomings as it won't be able to create the disk
if a container is already running and using the same base layer. WCIFS
(driver that handles the unioning of windows container layers together)
holds open handles to some files that we need to delete to create the
1GB scratch disk is the underlying problem.

- Deprecates the containerd.io/snapshot/io.microsoft.container.storage.rootfs.size-gb
label in favor of a new containerd.io/snapshot/windows/rootfs.sizebytes label.
The previous label/annotation wasn't being used by us, and from a cursory
github search wasn't being used by anyone else either. Now that there is a CRI
field to specify the size, this should just be a field that users can set
on their pod specs and don't need to concern themselves with what it eventually
gets translated to, but non-CRI clients can still use the new label/deprecated
label as usual.

- Add test to cri integration suite to validate expanding the rootfs size.

Signed-off-by: Daniel Canter <dcanter@microsoft.com>
2022-06-06 14:57:07 -07:00
Derek McGowan
c1bcabb454
Merge pull request from GHSA-5ffw-gxpp-mxpf
Limit the response size of ExecSync
2022-06-06 10:19:23 -07:00
Kazuyoshi Kato
8bf5995e12
Merge pull request #7018 from lucacome/bump-grpc
Bump grpc to v1.47.0
2022-06-06 10:04:10 -07:00
Kazuyoshi Kato
40aa4f3f1b
Implicitly discard the input to drain the reader
Signed-off-by: Derek McGowan <derek@mcg.dev>
2022-06-06 09:57:13 -07:00
Kazuyoshi Kato
00eb74a4ca Make building static binaries simpler
This commit adds STATIC makefile variable to adjust LDFLAGS and build
tags accordingly.

Fixes #5824.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2022-06-04 03:34:41 +00:00
Nashwan Azhari
d25b4e6f35 Bump Golang and MinGW versions in Windows setup script.
Signed-off-by: Nashwan Azhari <nazhari@cloudbasesolutions.com>
2022-06-03 21:07:53 +03:00
Kazuyoshi Kato
455b45708c
Merge pull request #7017 from lucacome/bump-k8s-deps
Bump k8s.io deps to v0.24.1
2022-06-03 10:33:50 -07:00
Phil Estes
2b661b890f
Merge pull request #6899 from shuaichang/ISSUE6657-support-runtime-snapshotter
Support runtime level snapshotter for issue 6657
2022-06-03 10:04:53 +02:00
shuaichang
7b9f1d4058 Added support for runtime level snapshotter, issue 6657
Signed-off-by: shuaichang <shuai.chang@databricks.com>

Updated annotation name
2022-06-02 16:29:59 -07:00
Luca Comellini
8bc6ccc073
Bump k8s.io deps to v0.24.1
Signed-off-by: Luca Comellini <luca.com@gmail.com>
2022-06-02 15:26:54 -07:00
Luca Comellini
5fcde823dd
Bump grpc to v1.47.0
Signed-off-by: Luca Comellini <luca.com@gmail.com>
2022-06-02 15:25:37 -07:00
Fu Wei
1f4e5175c4
Merge pull request #7012 from thaJeztah/update_golang_1.18.3
update golang to 1.18.3, 1.17.11
2022-06-02 18:49:01 +08:00
Sebastiaan van Stijn
1b3c3860db
update golang to 1.18.3, 1.17.11
go1.18.3 (released 2022-06-01) includes security fixes to the crypto/rand,
crypto/tls, os/exec, and path/filepath packages, as well as bug fixes to the
compiler, and the crypto/tls and text/template/parse packages. See the Go
1.18.3 milestone on our issue tracker for details:

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

update golang to 1.17.11

go1.17.11 (released 2022-06-01) includes security fixes to the crypto/rand,
crypto/tls, os/exec, and path/filepath packages, as well as bug fixes to the
crypto/tls package. See the Go 1.17.11 milestone on our issue tracker for details.

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

Hello gophers,

We have just released Go versions 1.18.3 and 1.17.11, minor point releases.

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

- crypto/rand: rand.Read hangs with extremely large buffers
  On Windows, rand.Read will hang indefinitely if passed a buffer larger than
  1 << 32 - 1 bytes.

  Thanks to Davis Goodin and Quim Muntal, working at Microsoft on the Go toolset,
  for reporting this issue.

  This is [CVE-2022-30634][CVE-2022-30634] and Go issue https://go.dev/issue/52561.
- crypto/tls: session tickets lack random ticket_age_add
  Session tickets generated by crypto/tls did not contain a randomly generated
  ticket_age_add. This allows an attacker that can observe TLS handshakes to
  correlate successive connections by comparing ticket ages during session
  resumption.

  Thanks to GitHub user nervuri for reporting this.

  This is [CVE-2022-30629][CVE-2022-30629] and Go issue https://go.dev/issue/52814.
- `os/exec`: empty `Cmd.Path` can result in running unintended binary on Windows

  If, on Windows, `Cmd.Run`, `cmd.Start`, `cmd.Output`, or `cmd.CombinedOutput`
  are executed when Cmd.Path is unset and, in the working directory, there are
  binaries named either "..com" or "..exe", they will be executed.

  Thanks to Chris Darroch, brian m. carlson, and Mikhail Shcherbakov for reporting
  this.

  This is [CVE-2022-30580][CVE-2022-30580] and Go issue https://go.dev/issue/52574.
- `path/filepath`: Clean(`.\c:`) returns `c:` on Windows

  On Windows, the `filepath.Clean` function could convert an invalid path to a
  valid, absolute path. For example, Clean(`.\c:`) returned `c:`.

  Thanks to Unrud for reporting this issue.

  This is [CVE-2022-29804][CVE-2022-29804] and Go issue https://go.dev/issue/52476.

[CVE-2022-30634]: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-30634
[CVE-2022-30629]: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-30629
[CVE-2022-30580]: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-30580
[CVE-2022-29804]: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-29804

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-06-02 09:45:57 +02:00