Commit Graph

7367 Commits

Author SHA1 Message Date
Akihiro Suda 8b98e829f0 Merge pull request #4676 from kolyshkin/keyring-log
libct: log a warning on join session keyring failure
2025-03-18 02:32:04 +09:00
Kir Kolyshkin 4c22153982 Merge pull request #4679 from rata/misc
libct: Use chown(uid, -1) to not change the gid
2025-03-14 17:49:40 -07:00
Kir Kolyshkin fde0842083 Merge pull request #4670 from kolyshkin/shell-spring-cleaning
Shell spring cleaning
2025-03-14 17:49:23 -07:00
Rodrigo Campos 9c5e687b6f libct: Use chown(uid, -1) to not change the gid
There is no behavior change, it is just more readable to use -1 to mean
don't touch this.

Please note that if the GID is not mapped in the userns, by using -1 for
that no error is returned. We just avoid dealing with it completely, as
we want here.

Signed-off-by: Rodrigo Campos <rodrigoca@microsoft.com>
2025-03-14 16:52:20 +01:00
Rodrigo Campos 92d1ea4acc Merge pull request #4675 from kolyshkin/nits-33
Misc CI nits
2025-03-14 12:34:24 -03:00
Kir Kolyshkin d31e6b87ca ci: bump bats to v0.11.0
This is the version available from Fedora 41.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-03-13 10:26:11 -07:00
Kir Kolyshkin 8e653e40c6 script/setup_host_fedora.sh: use bash arrays
This makes the code more robust and allows to remove the
"shellcheck disable=SC2086" annotation.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-03-13 10:21:55 -07:00
Kir Kolyshkin a76a1361b4 script/setup_host_fedora.sh: remove -p from mkdir
1. There is no need to have -p option in mkdir here, since
   /home/rootless was already created by useradd above.

2. When there is no -p, there is no need to suppress the shellcheck
   warning (which looked like this):

> In script/setup_host_fedora.sh line 21:
> mkdir -m 0700 -p /home/rootless/.ssh
>       ^-- SC2174 (warning): When used with -p, -m only applies to the deepest directory.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-03-13 10:21:55 -07:00
Kir Kolyshkin af386d1df1 tests/int: rm some "shellcheck disable" annotations
Those are no longer needed with shellcheck v0.10.0 (possibly with an
earlier version, too, but I am too lazy to check that).

While at it, fix a typo in the comment.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-03-13 10:21:55 -07:00
Kir Kolyshkin b48dd65114 ci: bump shellcheck to v0.10.0
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-03-13 10:21:55 -07:00
Kir Kolyshkin 6e5ffb7cbc Makefile: bump shfmt to v3.11.0
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-03-13 10:21:55 -07:00
Kir Kolyshkin 539315534f libct: log a warning on join session keyring failure
This addresses a TODO item added by commit 40f146841
("keyring: handle ENOSYS with keyctl(KEYCTL_JOIN_SESSION_KEYRING)"),
as we do have runc init logging working fine for quite some time.

While at it, fix a typo in a comment (standart -> standard).

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-03-13 08:42:22 -07:00
Kir Kolyshkin 9aeb7905cf tests/int/selinux: fix skip message
It was a mistake to say that SELinux need to be in the enforcing mode
for these tests to run. It only needs to be enabled.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-03-13 08:40:37 -07:00
Kir Kolyshkin 5ac77ed6d9 libct/int: add/use needUserNS helper
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-03-13 08:40:27 -07:00
Rodrigo Campos 67edd6d88e Merge pull request #4671 from kolyshkin/git-core
.cirrus.yml: install less dependencies
2025-03-13 11:35:15 -03:00
Kir Kolyshkin 1d9bea5378 .cirrus.yml: install less dependencies
In a nutshell:
 - use git-core instead of git;
 - do not install weak deps;
 - do not install docs.

This results in less packages to install:
 - 25 instead of 72 for almalinux-8
 - 24 instead of 90 for almalinux-9

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-03-10 14:39:26 -07:00
lfbzhm 854fb5242f Merge pull request #4666 from kolyshkin/pidfd_send_signal
Use pidfd_send_signal under the hood
2025-03-08 10:41:40 +08:00
Kir Kolyshkin 1afa1b8662 signals: replace unix.Kill with process.Signal
This way, given a recent Go and Linux version, pidfd_send_signal will
be used under the hood.

Keep unix.Signal and unix.SignalName for logging (it is way more
readable than what os.Signal.String() provides).

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-03-07 16:47:06 -08:00
lfbzhm 346c80d714 libct: replace unix.Kill with os.Process.Signal
Because we should switch to unix.PidFDSendSignal in new kernels, it has
been supported in go runtime. We don't need to add fall back to
unix.Kill code here.

Signed-off-by: lifubang <lifubang@acmcoder.com>
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-03-07 14:07:47 -08:00
Kir Kolyshkin aad4d97d83 Merge pull request #4664 from AkihiroSuda/lima-actions
CI: migrate Vagrant + Cirrus to Lima + GHA
2025-03-07 12:55:43 -08:00
Akihiro Suda 135552e5e4 CI: migrate Vagrant + Cirrus to Lima + GHA
- Unlike proprietary Vagrant, Lima remains to be an open source project
- GHA now natively supports nested virt on Linux runners

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2025-03-07 12:48:02 +09:00
Rodrigo Campos b936081e87 Merge pull request #4660 from lifubang/fix-doc-spec-1.2.1
doc: update spec-conformance.md
2025-03-06 10:23:36 -03:00
lfbzhm 1bb3820760 Merge pull request #4663 from opencontainers/dependabot/go_modules/golang.org/x/net-0.37.0 2025-03-06 18:53:44 +08:00
dependabot[bot] d5fe53030b build(deps): bump golang.org/x/net from 0.36.0 to 0.37.0
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.36.0 to 0.37.0.
- [Commits](https://github.com/golang/net/compare/v0.36.0...v0.37.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-06 09:52:25 +00:00
dependabot[bot] 5c10e90ec3 Merge pull request #4662 from opencontainers/dependabot/go_modules/golang.org/x/sys-0.31.0 2025-03-06 09:51:12 +00:00
dependabot[bot] 000cdef75d build(deps): bump golang.org/x/sys from 0.30.0 to 0.31.0
Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.30.0 to 0.31.0.
- [Commits](https://github.com/golang/sys/compare/v0.30.0...v0.31.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>
2025-03-06 04:49:01 +00:00
lifubang 79e9cf53e0 doc: update spec-conformance.md
Signed-off-by: lifubang <lifubang@acmcoder.com>
2025-03-05 19:26:06 -08:00
Akihiro Suda 25dcdc71ae Merge pull request #4658 from snprajwal/deps
deps: bump go-criu to v7
2025-03-06 09:32:28 +09:00
Akihiro Suda c8c6a8528d Merge pull request #4659 from opencontainers/dependabot/go_modules/golang.org/x/net-0.36.0
build(deps): bump golang.org/x/net from 0.35.0 to 0.36.0
2025-03-06 09:30:59 +09:00
dependabot[bot] 12c2e21f40 build(deps): bump golang.org/x/net from 0.35.0 to 0.36.0
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.35.0 to 0.36.0.
- [Commits](https://github.com/golang/net/compare/v0.35.0...v0.36.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-05 04:26:18 +00:00
Prajwal S N 05e83fc600 deps: bump go-criu to v7
Signed-off-by: Prajwal S N <prajwalnadig21@gmail.com>
2025-03-05 01:02:53 +05:30
Aleksa Sarai 2f93d663a0 merge #4657 into opencontainers/runc:main
Rodrigo Campos (2):
  VERSION: back to development
  VERSION: release v1.3.0-rc.1

LGTMs: AkihiroSuda lifubang cyphar
2025-03-04 22:57:28 +11:00
Rodrigo Campos 5d6e7e1279 VERSION: back to development
Signed-off-by: Rodrigo Campos <rodrigoca@microsoft.com>
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2025-03-04 18:42:08 +11:00
Rodrigo Campos a00ce11e91 VERSION: release v1.3.0-rc.1
Signed-off-by: Rodrigo Campos <rodrigoca@microsoft.com>
(cyphar: improve changelog)
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
v1.3.0-rc.1
2025-03-04 18:42:08 +11:00
lfbzhm 0ebf33109b Merge pull request #4327 from kolyshkin/exec-cpu-aff
runc exec: implement CPU affinity
2025-03-03 17:57:45 +08:00
Kir Kolyshkin 10ca66bff5 runc exec: implement CPU affinity
As per
- https://github.com/opencontainers/runtime-spec/pull/1253
- https://github.com/opencontainers/runtime-spec/pull/1261

CPU affinity can be set in two ways:
1. When creating/starting a container, in config.json's
   Process.ExecCPUAffinity, which is when applied to all execs.
2. When running an exec, in process.json's CPUAffinity, which
   applied to a given exec and overrides the value from (1).

Add some basic tests.

Note that older kernels (RHEL8, Ubuntu 20.04) change CPU affinity of a
process to that of a container's cgroup, as soon as it is moved to that
cgroup, while newer kernels (Ubuntu 24.04, Fedora 41) don't do that.

Because of the above,
 - it's impossible to really test initial CPU affinity without adding
   debug logging to libcontainer/nsenter;
 - for older kernels, there can be a brief moment when exec's affinity
   is different than either initial or final affinity being set;
 - exec's final CPU affinity, if not specified, can be different
   depending on the kernel, therefore we don't test it.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-03-02 19:17:41 -08:00
Aleksa Sarai 701516b57a merge #4654 into opencontainers/runc:main
lifubang (1):
  performance improvement: setup signal notify in a new go routine

LGTMs: kolyshkin cyphar
2025-03-02 02:47:28 +11:00
lifubang d92dd22611 performance improvement: setup signal notify in a new go routine
There is a big loop(at least 65 times) in `signal.Notify`, it costs as much
time as `runc init`, so we can call it in parallel ro reduce the container
start time. In a general test, it can be reduced about 38.70%.

Signed-off-by: lifubang <lifubang@acmcoder.com>
(cyphar: move signal channel definition inside goroutine)
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2025-03-01 23:46:25 +11:00
Aleksa Sarai 202ca99fae merge #4655 into opencontainers/runc:main
Kir Kolyshkin (1):
  CHANGELOG: fwd port 1.2.1 to 1.2.5 changes

LGTMs: lifubang cyphar
2025-03-01 21:38:19 +11:00
Aleksa Sarai b0a21af4b1 merge #4638 into opencontainers/runc:main
Kir Kolyshkin (1):
  Switch to opencontainers/cgroups

LGTMs: lifubang cyphar
2025-03-01 21:37:27 +11:00
Kir Kolyshkin a75076b4a4 Switch to opencontainers/cgroups
This removes libcontainer/cgroups packages and starts
using those from github.com/opencontainers/cgroups repo.

Mostly generated by:

  git rm -f libcontainer/cgroups

  find . -type f -name "*.go" -exec sed -i \
    's|github.com/opencontainers/runc/libcontainer/cgroups|github.com/opencontainers/cgroups|g' \
    {} +

  go get github.com/opencontainers/cgroups@v0.0.1
  make vendor
  gofumpt -w .

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-02-28 15:20:33 -08:00
Kir Kolyshkin 6e01e85054 CHANGELOG: fwd port 1.2.1 to 1.2.5 changes
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-02-28 11:40:56 -08:00
Kir Kolyshkin 85ba66f059 Merge pull request #4653 from opencontainers/dependabot/go_modules/github.com/opencontainers/runtime-spec-1.2.1
build(deps): bump github.com/opencontainers/runtime-spec from 1.2.0 to 1.2.1
2025-02-28 11:24:49 -08:00
dependabot[bot] 537a2276bb build(deps): bump github.com/opencontainers/runtime-spec
Bumps [github.com/opencontainers/runtime-spec](https://github.com/opencontainers/runtime-spec) from 1.2.0 to 1.2.1.
- [Release notes](https://github.com/opencontainers/runtime-spec/releases)
- [Changelog](https://github.com/opencontainers/runtime-spec/blob/main/ChangeLog)
- [Commits](https://github.com/opencontainers/runtime-spec/compare/v1.2.0...v1.2.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-28 04:52:38 +00:00
Rodrigo Campos 8c72dfae65 Merge pull request #4627 from beam-cloud/main
Add skip-in-flight and link-remap criu options for checkpoint and restore
2025-02-26 06:06:26 -03:00
Rodrigo Campos 352c8d40ac Merge pull request #4636 from lifubang/fix-exec-timens
libct: don't send config to nsexec when joining an existing timens
2025-02-26 05:53:29 -03:00
Aleksa Sarai cfb643e02b merge #4641 into opencontainers/runc:main
Tomasz Duda (1):
  exeseal: do not use F_SEAL_FUTURE_WRITE

LGTMs: kolyshkin cyphar
2025-02-26 16:56:39 +11:00
Tomasz Duda c43ea7d629 exeseal: do not use F_SEAL_FUTURE_WRITE
Prior to kernel Linux 5.5, F_SEAL_FUTURE_WRITE has a bug which maps
memory as shared between processes even if it is set as private. See
kernel commit 05d351102dbe ("mm, memfd: fix COW issue on MAP_PRIVATE and
F_SEAL_FUTURE_WRITE mappings") for more details.

According to the fcntl(2) man pages, F_SEAL_WRITE is enough:

> Furthermore, trying to create new shared, writable memory-mappings via
> mmap(2) will also fail with EPERM.
>
> Using the F_ADD_SEALS operation to set the F_SEAL_WRITE seal fails
> with EBUSY if any writable, shared mapping exists. Such mappings must
> be unmapped before you can add this seal.

F_SEAL_FUTURE_WRITE only makes sense if a read-write shared mapping in
one process should be read-only in another process. This is not case for
runc, especially not for the /proc/self/exe we are protecting.

Signed-off-by: Tomasz Duda <tomaszduda23@gmail.com>
(cyphar: improve the comment regarding F_SEAL_FUTURE_WRITE)
(cyphar: improve commit message)
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2025-02-26 16:40:34 +11:00
Daniel Levi-Minzi 1d047e44ed expose criu options for link remap and skip in flight
Signed-off-by: Daniel Levi-Minzi <dleviminzi@gmail.com>
2025-02-25 10:35:31 -05:00
Kir Kolyshkin e0e22d33ea Merge pull request #4643 from cyphar/dmz-rename
libcontainer: rename dmz -> exeseal
2025-02-24 21:42:27 -08:00