Commit Graph

7391 Commits

Author SHA1 Message Date
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
Aleksa Sarai 58a599d28a merge #4593 into opencontainers/runc:main
Kir Kolyshkin (1):
  tests/int: add hooks argv[0] test

LGTMs: rata cyphar
2025-02-25 13:54:46 +11:00
Aleksa Sarai 559bd4ebdf libcontainer: rename dmz -> exeseal
The "dmz" name was originally used because the libcontainer/dmz package
housed the runc-dmz binary, but since we removed it in commit
871057d863 ("drop runc-dmz solution according to overlay solution")
the name is an anachronism and we should just give it a more
self-explanatory name.

So, call it libcontainer/exeseal because the purpose of the package is
to provide tools to seal /proc/self/exe against attackers.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2025-02-25 13:46:05 +11:00
Aleksa Sarai ef9830a0bf merge #4513 into opencontainers/runc:main
Tomasz Duda (1):
  support cgroup v1 mounted with noprefix

LGTMs: kolyshkin cyphar
2025-02-25 13:21:49 +11:00
lfbzhm 5f8abe5754 Merge pull request #4637 from mirendev/evanphx/b-eintr
Retry direct unix package calls if observing EINTR
2025-02-25 08:24:20 +08:00
lfbzhm 7ee017cf04 Merge pull request #4633 from kolyshkin/libct-cg-sep
libct/cg: eliminate remaining libct deps
2025-02-25 08:19:00 +08:00
lifubang ad09197e41 libct: don't send config to nsexec when joining an existing timens
We should configure the process's timens offset only when we need to
create new time namespace, we shouldn't do it if we are joining an
existing time namespace. (#4635)

Signed-off-by: lifubang <lifubang@acmcoder.com>
2025-02-22 16:42:33 +00:00
lfbzhm 74619689ae test: exec into a container with private time ns
Signed-off-by: lifubang <lifubang@acmcoder.com>
2025-02-22 16:42:01 +00:00
Evan Phoenix 28475f12e3 Retry direct unix package calls if observing EINTR
Retry Recvfrom, Sendmsg, Readmsg, and Read as they can return EINTR.

Signed-off-by: Evan Phoenix <evan@phx.io>
2025-02-21 15:19:54 -08:00
Kir Kolyshkin 4e0f7a203d libct/cg/dev: remove specconv dependency
This was needed for a test case only, but we can easily copy the data
needed.

The alternatives are:
 - keep things as is (and have cgroups depend on
   runc/libcontainer/specconv);
 - remove this test case;
 - move AllowedDevices to cgroups/devices/config.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-02-21 14:23:58 -08:00
Kir Kolyshkin 69792827b4 libct/cg: don't use utils.CleanPath
Instead, we can just do filepath.Clean("/"+path) here.

While at it, add a comment telling why this is needed and important.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-02-21 14:23:58 -08:00
Kir Kolyshkin 5e1dcdf564 libct/cg: add internal/path.Inner
The code which determines inner cgroup path from cgroup config is
identical in fs and fs2 drivers, and it is using utils.CleanPath.

In preparation to move libcontainer/cgroups to a separate repo,
we have to get rid of libcontainer/utils dependency. So,
 - copy the utils.CleanPath implementation to internal/path;
 - consolidate the two innerPath implementations to internal/path.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-02-21 14:23:58 -08:00
Kir Kolyshkin 271aa88ed5 libct/cg/fs2: rm _defaultDirPath
The _defaultDirPath was only used for testing, and the test case
is quite easy to adopt to defaultDirPath.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-02-21 14:23:58 -08:00
Kir Kolyshkin 7bebe68c7a libct/cg: stop using utils.ProcThreadSelf
We were using utils.ProcThreadSelf since commit 8e8b136c,
which provides two things:
1. locking the OS tread;
2. fallback to /proc/self/task/$TID when /proc/thread-self
   is not available (kernel < 3.17).

Now, (1) is not needed since we only call readlink and not perform any
file data operation, and (2) is not needed here as this code is
only running when openat2 syscall is available, meaning kernel >= v5.6.

Also, check the error from readlink, so when it fails, we do not try to
enhance the error message.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-02-21 14:14:22 -08:00
Rodrigo Campos 91e6621205 Merge pull request #4634 from kolyshkin/gha-rm-ubu2004
CI: gha: rm ubuntu-20.04
2025-02-19 13:26:59 -03:00
Kir Kolyshkin 4244978687 CI: gha: rm ubuntu-20.04
There is an announce that Ubuntu 20.04 will be removed in April,
and in March there will be a few "brown-out" dates/times when
it won't work.

This leaves us with no other options than to remove ubuntu-20.04
from the testing matrix.

As a result, cgroup v1 testing will only be done on AlmaLinux 8
running on CirrusCI. It is probably going to be sufficient for
the time being (until we deprecate cgroup v1).

If not, our options are
 - run Ubuntu 20.04 (or other cgroup v1 distro) in a VM on GHA;
 - switch to cirrus-ci.

[1]: https://github.com/actions/runner-images/issues/11101

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-02-16 09:38:47 -08:00
lfbzhm c8737446d2 Merge pull request #4584 from kolyshkin/test-int-nits
Misc nits to tests/integration
2025-02-14 19:22:02 +08:00
lfbzhm 885f8f6dff Merge pull request #4628 from kolyshkin/ebpf0173
deps: bump cilium/ebpf to v0.17.3
2025-02-14 09:45:23 +08:00
Rodrigo Campos b0b186e64d Merge pull request #4630 from kolyshkin/clean-path
libc/utils: simplify CleanPath
2025-02-13 13:59:23 -03:00
Rodrigo Campos 199a307569 Merge pull request #4625 from kolyshkin/seccomp256
build: bump libseccomp to v2.5.6
2025-02-13 08:00:38 -03:00
lfbzhm c3c111d2a6 Merge pull request #4585 from kolyshkin/per-process-properties
Fix process/config properties merging
2025-02-13 18:47:32 +08:00
Rodrigo Campos 20727c62d5 Merge pull request #4598 from kolyshkin/go124
Add Go 1.24, drop Go 1.22
2025-02-13 07:46:47 -03:00
Kir Kolyshkin 79a4ac0553 deps: bump cilium/ebpf to v0.17.3
It has a fix for runc issue 4594.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-02-13 00:07:01 -08:00
Kir Kolyshkin 0f88286077 Merge pull request #4470 from kolyshkin/strings-cut
Use strings.Cut and strings.CutPrefix where possible
2025-02-12 23:35:20 -08:00
Kir Kolyshkin 6400bee7cd Merge pull request #4629 from cyphar/release-explicit-keyserver
release: explicitly set --keyserver in release signing scripts
2025-02-12 22:34:06 -08:00
Kir Kolyshkin 8db6ffbeef libc/utils: simplify CleanPath
This simplifies the code flow and basically removes the last
filepath.Clean, which is not necessary in either case:

 - for absolute path, single filepath.Clean is enough (as it is
   guaranteed to remove all dot and dot-dot elements);

 - for relative path, filepath.Rel calls Clean at the end
   (which is even documented).

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-02-12 20:17:51 -08:00
Aleksa Sarai 26cfe14231 release: explicitly set --keyserver in release signing scripts
On my machine, the --recv-keys steps to get upstream keys started
producing errors recently, and even setting a default keyserver in the
global gpg configuration doesn't seem to help:

  + gpg --homedir=/tmp/runc-sign-tmpkeyring.qm0IP6
        --no-default-keyring --keyring=seccomp.keyring
        --recv-keys 0x47A68FCE37C7D7024FD65E11356CE62C2B524099
  gpg: keybox '/tmp/runc-sign-tmpkeyring.qm0IP6/seccomp.keyring' created
  gpg: keyserver receive failed: No keyserver available

So just explicitly specify a reputable keyserver. Ideally we would use
an .onion-address keyserver to avoid potential targeted attacks but not
everybody runs a Tor proxy on their machine.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2025-02-13 14:42:24 +11:00
Kir Kolyshkin 0e3b5d5b37 build: bump libseccomp to v2.5.6
A new libseccomp releases (v2.5.6 and v2.6.0) were cut last month.

Theoretically, we could use v2.6.0 but let's stay conservative for now.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-02-12 07:58:34 -08:00