Commit Graph

6160 Commits

Author SHA1 Message Date
Jonas Eschenburg 067ca8f5c8 notify_socket.go: use sd_notify_barrier mechanism
Signed-off-by: Jonas Eschenburg <jonas.eschenburg@kuka.com>
2022-11-14 10:41:22 +01:00
Jonas Eschenburg ee88b90032 notify_socket.go: avoid use of bytes.Buffer
Signed-off-by: Jonas Eschenburg <jonas.eschenburg@kuka.com>
2022-11-14 10:41:22 +01:00
Akihiro Suda f264cf91fa Merge pull request #3657 from opencontainers/dependabot/go_modules/golang.org/x/sys-0.2.0
build(deps): bump golang.org/x/sys from 0.1.0 to 0.2.0
2022-11-10 10:06:25 +09:00
dependabot[bot] 467dd23402 build(deps): bump golang.org/x/sys from 0.1.0 to 0.2.0
Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.1.0 to 0.2.0.
- [Release notes](https://github.com/golang/sys/releases)
- [Commits](https://github.com/golang/sys/compare/v0.1.0...v0.2.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sys
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-09 04:04:06 +00:00
Sebastiaan van Stijn 627e815f20 Merge pull request #3654 from AkihiroSuda/go-mod-sys-v0.1.0
go.mod: golang.org/x/*: use tagged versions
2022-11-08 22:32:06 +01:00
Kir Kolyshkin 0b0244323f Merge pull request #3656 from opencontainers/dependabot/go_modules/github.com/coreos/go-systemd/v22-22.5.0
build(deps): bump github.com/coreos/go-systemd/v22 from 22.4.0 to 22.5.0
2022-11-08 12:01:51 -08:00
dependabot[bot] e0d3c3e07f build(deps): bump github.com/coreos/go-systemd/v22 from 22.4.0 to 22.5.0
Bumps [github.com/coreos/go-systemd/v22](https://github.com/coreos/go-systemd) from 22.4.0 to 22.5.0.
- [Release notes](https://github.com/coreos/go-systemd/releases)
- [Commits](https://github.com/coreos/go-systemd/compare/v22.4.0...v22.5.0)

---
updated-dependencies:
- dependency-name: github.com/coreos/go-systemd/v22
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-08 04:10:57 +00:00
Akihiro Suda 79aedac186 go.mod: golang.org/x/*: use tagged versions
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2022-11-03 11:11:19 +09:00
Kir Kolyshkin 2a8e5d3c62 Merge pull request #3579 from kolyshkin/v2-low-mem
runc update: implement memory.checkBeforeUpdate
2022-11-02 18:29:15 -07:00
Kir Kolyshkin 6462e9de67 runc update: implement memory.checkBeforeUpdate
This is aimed at solving the problem of cgroup v2 memory controller
behavior which is not compatible with that of cgroup v1.

In cgroup v1, if the new memory limit being set is lower than the
current usage, setting the new limit fails.

In cgroup v2, same operation succeeds, and the container is OOM killed.

Introduce a new setting, memory.checkBeforeUpdate, and use it to mimic
cgroup v1 behavior.

Note that this is not 100% reliable because of TOCTOU, but this is the
best we can do.

Add some test cases.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2022-11-02 17:15:26 -07:00
Kir Kolyshkin b34a547d67 Merge pull request #3379 from kolyshkin/bump-shfmt
ci: bump shfmt to 3.5.1, simplify CI setup
2022-11-02 15:00:24 -07:00
Kir Kolyshkin 56edc41ca6 ci: bump shfmt to 3.5.1, simplify CI setup
1. Bump shfmt to v3.5.1. Release notes:
   https://github.com/mvdan/sh/releases

2. Since shfmt v3.5.0, specifying -l bash (or -l bats) is no longer
   necessary. Therefore, we can use shfmt to find all the files.
   Add .editorconfig to ignore vendor subdirectory.

3. Use shfmt docker image, so that we don't have to install anything
   explicitly. This greatly simplifies the shfmt CI job. Add
   localshfmt target so developers can still use a local shfmt binary
   when necessary.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2022-11-02 11:08:36 -07:00
Kir Kolyshkin 8da0a0b567 Merge pull request #3631 from godsarmy/3612-sigkill_comment
Fix comment of signalAllProcesses for process wait due to sigkill
2022-11-02 10:31:34 -07:00
Walt Chen 18f8f482b1 Fix comment of signalAllProcesses for process wait due to sigkill
Signed-off-by: Walt Chen <godsarmycy@gmail.com>
2022-11-02 10:08:09 -07:00
Aleksa Sarai df2043af5d merge 'refs/pull/3635/head' of github.com:opencontainers/runc
Kir Kolyshkin (1):
  libct/seccomp/patchbpf: rm duplicated code

LGTMs: cyphar thaJeztah
Closes #3635
2022-11-02 15:46:03 +11:00
Kir Kolyshkin 2cd05e44b6 libct/seccomp/patchbpf: rm duplicated code
In findLastSyscalls, we convert libseccomp.ArchNative to the real
libseccomp architecture, but archToNative already does that, so
this code is redundant.

Remove the redundant code, and move its comment to archToNative.

Fixes: 7a8d7162f
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2022-11-01 18:47:16 -07:00
Kir Kolyshkin c393d16cea Merge pull request #3652 from rst0git/deps-go-criu
deps: bump github.com/checkpoint-restore/go-criu to 6.3.0
2022-11-01 18:42:14 -07:00
Radostin Stoyanov fbce47a6b6 deps: bump github.com/checkpoint-restore/go-criu to 6.3.0
Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
2022-11-01 10:08:14 +00:00
Kir Kolyshkin fdc4d67cc7 Merge pull request #3405 from kolyshkin/seccomp-bintree
libct/seccomp: enable seccomp binary tree optimization
2022-10-31 17:57:08 -07:00
Kir Kolyshkin b265d1288f libct/seccomp: enable binary tree optimization
This makes libseccomp produce a BPF which uses a binary tree for
syscalls (instead of linear set of if statements).

It does not make sense to enable binary tree for small set of rules,
so don't do that if we have less than 8 syscalls (the number is chosen
arbitrarily).

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2022-10-31 16:59:49 -07:00
Sebastiaan van Stijn 6e2b46e259 Merge pull request #3636 from kolyshkin/gha-v
ci/gha: use v3 tag for actions/cache
2022-10-27 21:36:47 -04:00
Qiang Huang 3049057feb Merge branch 'main' into gha-v 2022-10-28 09:17:47 +08:00
Kir Kolyshkin d61b45163f Merge pull request #3650 from kolyshkin/fix-seccomp-test-on-arm
tests/int/seccomp: fix flags test on ARM
2022-10-27 11:29:53 -07:00
Kir Kolyshkin 65840f64ef tests/int/seccomp: fix flags test on ARM
On ARM, mkdirat(2) is used instead of mkdir(2), thus the seccomp rules
needs to be amended accordingly.

This is a change similar to one in commit e119db7a23, but but it
evaded the test case added in commit 58ea21dae as it took a long time to
merge, and we don't have ARM CI.

Fixes: 58ea21dae ("seccomp: add support for flags")
Reported-by: Ryan Phillips <rphillips@redhat.com>
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2022-10-26 11:13:34 -07:00
Kir Kolyshkin 6bf2c3b67e ci/gha: use v3 tag for actions/cache
This tag points to the latest v3 version (currently v3.0.11). Mainly
done to avoid cluttering git history with multiple minor v3 upgrades.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2022-10-17 10:05:17 -07:00
Kir Kolyshkin 6d1e1ee07d Merge pull request #3634 from opencontainers/dependabot/github_actions/actions/cache-3.0.11
build(deps): bump actions/cache from 3.0.10 to 3.0.11
2022-10-17 09:56:21 -07:00
dependabot[bot] a04363c1b9 build(deps): bump actions/cache from 3.0.10 to 3.0.11
Bumps [actions/cache](https://github.com/actions/cache) from 3.0.10 to 3.0.11.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/v3.0.10...v3.0.11)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-14 04:11:15 +00:00
Mrunal Patel 70e3b757c0 Merge pull request #3611 from yukariatlas/main
cgroups: cpuset: fix byte order while parsing cpuset range to bits
2022-10-13 12:19:44 -07:00
Mrunal Patel a187c84e42 Merge pull request #3626 from thaJeztah/more_idiomatic
libcontainer/cgroups: return concrete types
2022-10-13 12:14:11 -07:00
Chengen, Du 4a8750d93a tests/int: add a "update cpuset cpus range via v2 unified map" test
Add a test case for an issue fixed by the previous commit.
The env should has more than 8 core CPU to meet the test requirement.

Signed-off-by: Chengen, Du <chengen.du@canonical.com>
2022-10-13 11:14:13 +08:00
Chengen, Du 77cae9addc cgroups: cpuset: fix byte order while parsing cpuset range to bits
Runc parses cpuset range to bits in the case of cgroup v2 + systemd as cgroup driver.
The byte order representation differs from systemd expectation, which will set
different cpuset range in systemd transient unit if the length of parsed byte array exceeds one.

	# cat config.json
	...
	"resources": {
		...
		"cpu": {
			"cpus": "10-23"
		}
	},
	...
	# runc --systemd-cgroup run test
	# cat /run/systemd/transient/runc-test.scope.d/50-AllowedCPUs.conf
	# This is a drop-in unit file extension, created via "systemctl set-property"
	# or an equivalent operation. Do not edit.
	[Scope]
	AllowedCPUs=0-7 10-15

The cpuset.cpus in cgroup will also be set to wrong value after reloading systemd manager configuration.

	# systemctl daemon-reload
	# cat /sys/fs/cgroup/system.slice/runc-test.scope/cpuset.cpus
	0-7,10-15

Signed-off-by: seyeongkim <seyeong.kim@canonical.com>
Signed-off-by: Chengen, Du <chengen.du@canonical.com>
2022-10-13 11:13:29 +08:00
Aleksa Sarai 56b01e7beb merge branch 'pr-3623'
Evan Phoenix (1):
  Fixes inability to use /dev/null when inside a container

LGTMs: kolyshkin cyphar
Closes #3623
2022-10-13 01:40:57 +11:00
Evan Phoenix 462e719cae Fixes inability to use /dev/null when inside a container
This is a forward port of https://github.com/opencontainers/runc/pull/3620

The original code depended on the origin filesystem to have
/dev/{block,char} populated. This is done by udev normally and while is
very common non-containerized systemd installs, it's very easy to start
systemd in a container created by runc itself and not have
/dev/{block,char} populated. When this occurs, the following error
output is observed:

$ docker run hello-world
docker: Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error reopening /dev/null inside container: open /dev/null: operation not permitted: unknown.

/dev/null can't be opened because it was not added to the
deviceAllowList, as there was no /dev/char directory. The change here
utilizes the fact that when sysfs in in use, there is a
/sys/dev/{block,char} that is kernel maintained that we can check.

Signed-off-by: Evan Phoenix <evan@phx.io>
2022-10-08 10:53:18 -07:00
Akihiro Suda 526d3b3374 Merge pull request #3603 from kolyshkin/drop-inh
tests/int: do not set inheritable capabilities
2022-10-08 08:04:14 +09:00
Sebastiaan van Stijn fa47a92f67 Merge pull request #3565 from dharmicksai/3547
Add check for CONFIG_CGROUP_BPF in check-config.sh
2022-10-07 18:06:46 +02:00
Sebastiaan van Stijn 04389ae99b libcontainer/cgroups: return concrete types
It's more idiomatic Go to define interfaces on the receiver, and constructors to
return concrete types.

This patch changes various constructors to return a concrete type, with the
exceptions of NewWithPaths, which needs the abstraction as it switches between
implementations.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-10-07 17:31:11 +02:00
Sebastiaan van Stijn d811a7154c Merge pull request #3628 from kolyshkin/fix-centos-7-ci-again
cirrus-ci: install EPEL on CentOS 7 conditionally
2022-10-07 17:28:57 +02:00
Kir Kolyshkin ae53cde3ff cirrus-ci: install EPEL on CentOS 7 conditionally
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2022-10-06 12:10:26 -07:00
Kir Kolyshkin 1102f3fc9d Merge pull request #3624 from opencontainers/dependabot/github_actions/actions/cache-3.0.10
build(deps): bump actions/cache from 3.0.9 to 3.0.10
2022-10-04 19:06:08 -07:00
dependabot[bot] 8584900e50 build(deps): bump actions/cache from 3.0.9 to 3.0.10
Bumps [actions/cache](https://github.com/actions/cache) from 3.0.9 to 3.0.10.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/v3.0.9...v3.0.10)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-04 04:12:20 +00:00
Akihiro Suda 535b8b716a Merge pull request #3619 from opencontainers/dependabot/go_modules/github.com/opencontainers/selinux-1.10.2
build(deps): bump github.com/opencontainers/selinux from 1.10.1 to 1.10.2
2022-10-04 09:29:25 +09:00
Kir Kolyshkin 967552cff5 Merge pull request #3621 from opencontainers/dependabot/github_actions/actions/cache-3.0.9
build(deps): bump actions/cache from 3.0.8 to 3.0.9
2022-10-03 10:34:47 -07:00
Sebastiaan van Stijn fa0f7f5c97 Merge pull request #3622 from opencontainers/dependabot/go_modules/github.com/cilium/ebpf-0.9.3
build(deps): bump github.com/cilium/ebpf from 0.9.1 to 0.9.3
2022-10-03 09:27:48 +02:00
dependabot[bot] 1be5d45df9 build(deps): bump github.com/cilium/ebpf from 0.9.1 to 0.9.3
Bumps [github.com/cilium/ebpf](https://github.com/cilium/ebpf) from 0.9.1 to 0.9.3.
- [Release notes](https://github.com/cilium/ebpf/releases)
- [Commits](https://github.com/cilium/ebpf/compare/v0.9.1...v0.9.3)

---
updated-dependencies:
- dependency-name: github.com/cilium/ebpf
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-03 04:15:32 +00:00
dependabot[bot] 79a5c1109b build(deps): bump actions/cache from 3.0.8 to 3.0.9
Bumps [actions/cache](https://github.com/actions/cache) from 3.0.8 to 3.0.9.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/v3.0.8...v3.0.9)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-03 04:15:17 +00:00
dependabot[bot] da9126f788 build(deps): bump github.com/opencontainers/selinux
Bumps [github.com/opencontainers/selinux](https://github.com/opencontainers/selinux) from 1.10.1 to 1.10.2.
- [Release notes](https://github.com/opencontainers/selinux/releases)
- [Commits](https://github.com/opencontainers/selinux/compare/v1.10.1...v1.10.2)

---
updated-dependencies:
- dependency-name: github.com/opencontainers/selinux
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-09-29 04:09:47 +00:00
Sebastiaan van Stijn 1c3b8dbaf4 Merge pull request #3606 from opencontainers/dependabot/go_modules/github.com/coreos/go-systemd/v22-22.4.0
build(deps): bump github.com/coreos/go-systemd/v22 from 22.3.2 to 22.4.0
2022-09-29 00:11:52 +02:00
dependabot[bot] 7189ba8dfe build(deps): bump github.com/coreos/go-systemd/v22 from 22.3.2 to 22.4.0
Bumps [github.com/coreos/go-systemd/v22](https://github.com/coreos/go-systemd) from 22.3.2 to 22.4.0.
- [Release notes](https://github.com/coreos/go-systemd/releases)
- [Commits](https://github.com/coreos/go-systemd/compare/v22.3.2...v22.4.0)

---
updated-dependencies:
- dependency-name: github.com/coreos/go-systemd/v22
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-09-28 21:26:56 +00:00
Mrunal Patel a92bcd72fe Merge pull request #3614 from kolyshkin/fix-centos-7-ci
Fix centos 7 ci
2022-09-28 14:24:47 -07:00
Kir Kolyshkin 491713e841 cirrus-ci: enable EPEL for CentOS 7
It used to be enabled by default, but not as of last few weeks.

While at it, add rpm -q command to make sure all required RPMS were in
fact installed (at least CentOS 7 yum exits with 0 when some packages
requested are not available).

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2022-09-28 11:04:15 -07:00