Commit Graph

7972 Commits

Author SHA1 Message Date
Aleksa Sarai 4f2090fd31 Merge pull request #5212 from kolyshkin/unsafe_test
tests/int: introduce the concept of unsafe tests
2026-04-05 10:24:07 +10:00
Kir Kolyshkin 9932ad19be tests/int: introduce the concept of unsafe tests
Some of runc integration tests may do something that I would not like
when running those on my development laptop. Examples include

 - changing the root mount propagation [1];
 - replacing /root/runc [2];
 - changing the file in /etc (see checkpoint.bats).

Yet it is totally fine to do all that in a throwaway CI environment,
or inside a Docker container.

Introduce a mechanism to skip specific "unsafe" tests unless an
environment variable, RUNC_ALLOW_UNSAFE_TESTS, is set. Use it
from a specific checkpoint/restore test which modifies
/etc/criu/default.conf.

[1]: https://github.com/opencontainers/runc/pull/5200
[2]: https://github.com/opencontainers/runc/pull/5207

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-04-02 20:03:47 -07:00
Kir Kolyshkin 7a1cae6dd0 Merge pull request #5142 from cyphar/deprecate-libct-devices
libct: deprecate libcontainer/devices in favour of moby/sys/devices
2026-04-02 17:58:00 -07:00
Aleksa Sarai b345c78dca libct/devices: deprecate in favour of moby/sys/devices
The libcontainer/devices package has been moved to moby/sys/devices, so
we can just point users to that and keep some compatibility shims around
until runc 1.6. We don't use it at all so there are no other changes
needed.

Signed-off-by: Aleksa Sarai <aleksa@amutable.com>
2026-04-02 22:54:14 +11:00
Rodrigo Campos Catelin a0d1b98e06 Merge pull request #4661 from lifubang/skip-setup-signalNotify-for-detached
skip setup signal notifier for detached container
2026-04-02 13:50:34 +02:00
lfbzhm 62d4f147e8 Merge pull request #5210 from lifubang/fix-signal-race
Fix SIGCHLD race in signal handler setup
2026-04-02 09:38:46 +08:00
lifubang 404181e4cc Fix SIGCHLD race in signal handler setup
When signal installation was moved to a goroutine for performance,
containers that exited quickly could complete before SIGCHLD was
registered, causing runc to hang waiting for the signal.

This fix ensures SIGCHLD is registered immediately in the main thread
before other signals are handled in the goroutine, maintaining performance
while guaranteeing no missed SIGCHLD notifications for fast-exiting
containers.

Reported-by: Ayato Tokubi <atokubi@redhat.com>
Signed-off-by: lifubang <lifubang@acmcoder.com>
2026-04-02 00:59:18 +00:00
Kir Kolyshkin 5c9b6ac713 Merge pull request #5164 from opencontainers/dependabot/go_modules/golang.org/x/net-0.52.0
build(deps): bump golang.org/x/net from 0.50.0 to 0.52.0
2026-04-01 13:05:39 -07:00
dependabot[bot] d033312a74 build(deps): bump golang.org/x/net from 0.50.0 to 0.52.0
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.50.0 to 0.52.0.
- [Commits](https://github.com/golang/net/compare/v0.50.0...v0.52.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-01 18:11:21 +00:00
lifubang 4c0496a69f skip setup signal notifier for detached container
For detached container, we don't need to setup signal notifier, because
there is no customer to consume the signals in `forward()`.

Signed-off-by: lifubang <lifubang@acmcoder.com>
2026-03-31 12:35:25 -07:00
lifubang e259ae0c38 move notifySocket out of signalHandler
In fact, notifySocket has no relationship to signalHandler, we
can move it out of signalHandler to make the code more clear.

Signed-off-by: lifubang <lifubang@acmcoder.com>
2026-03-31 12:35:25 -07:00
lifubang fba5a1ec23 move process terminate operation to defer function
Signed-off-by: lifubang <lifubang@acmcoder.com>
2026-03-31 12:35:25 -07:00
lifubang 456d0f525a fix a ambiguity of err in defer func
We should use a named return value of error, or else we can't
catch all errors when calling defer function, for example we
used a block scope var name `err` for `setupPidfdSocket`.

Signed-off-by: lifubang <lifubang@acmcoder.com>
2026-03-31 12:35:25 -07:00
Rodrigo Campos Catelin 348d92f497 Merge pull request #5205 from kolyshkin/carry-5169
Switch to Go 1.25+
2026-03-31 11:13:44 +02:00
Aleksa Sarai 47fba7e4b1 go fix: use (*sync.WaitGroup).Go
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2026-03-30 13:13:53 -07:00
Aleksa Sarai 99d054b93f go.mod: bump minimum to Go 1.25
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2026-03-30 13:13:53 -07:00
Kir Kolyshkin f9a9a36fa8 tests/int: allow cpu quota cgroup v1 files fds
Since switching to Go 1.25 in go.mod, the "detect fd leaks" test fails
like this:

> not ok 57 runc create[detect fd leak as comprehensively as possible]
> # (in test file tests/integration/create.bats, line 76)
> #   `[ "$violation_found" -eq 0 ]' failed
> ...
> # Violation: FD 9 -> '/system.slice/runc-test_busybox.scope/cpu.cfs_quota_us'
> # Violation: FD 10 -> '/system.slice/runc-test_busybox.scope/cpu.cfs_period_us'
> ...

This happens because Go 1.25 adds a feature to dynamically set GOMAXPROC
based on current CPU quota values. This feature can be disabled by setting

	GODEBUG=containermaxprocs=0,updatemaxprocs=0

but it is harmless to keep it (except for the above test failure).

Add an exception to the test case.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-03-30 13:13:50 -07:00
lfbzhm 400f3dd460 Merge pull request #5190 from kolyshkin/preopen_root
Pre-open container root directory
2026-03-30 09:09:42 +08:00
lfbzhm 5b094ed1ac libct: use preopened rootfs more
This uses preopened rootfs in Chdir and pivotRoot.

While at it, add O_PATH when opening oldroot in pivotRoot.

Co-authored-by: Kir Kolyshkin <kolyshkin@gmail.com>
Signed-off-by: lfbzhm <lifubang@acmcoder.com>
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-03-29 12:02:38 -07:00
Kir Kolyshkin 28cb321887 Pre-open container root directory
A lot of filesystem-related stuff happens inside the container root
directory, and we have used its name before. It makes sense to pre-open
it and use a *os.File handle instead.

Function names in internal/pathrs are kept as is for simplicity (and it
is an internal package), but they now accept root as *os.File.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-03-29 12:02:36 -07:00
Kir Kolyshkin 78b80677f6 libct: minor refactor in mountToRootfs
No change in functionality, just a preparation for the next patch.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-03-28 23:48:07 -07:00
Kir Kolyshkin 60352524d3 libct: mountCgroupV1: address TODO
Indeed, it does not make sense to prepend c.root once we started using
MkdirAllInRoot in commit 63c29081.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-03-28 23:48:07 -07:00
Aleksa Sarai 7b40afb6cc merge #5177 into opencontainers/runc:main
Li Fubang (3):
  test: check mount source fds are cleaned up with idmapped mounts
  libct: close mount source fd as soon as possible
  libct: add a nil check for mountError

LGTMs: kolyshkin rata cyphar
2026-03-28 17:32:21 +11:00
lfbzhm fe158d1781 Merge pull request #5195 from cyphar/readme-libpathrs
README: add libpathrs installation notes
2026-03-26 12:44:40 +08:00
Aleksa Sarai 81d59df8d5 README: add libpathrs installation notes
libpathrs now has its own installation instructions[1] but it is quite
helpful to provide some high-level instructions as well as notes about
what minimum versions we expect.

[1]: https://github.com/cyphar/libpathrs/blob/main/INSTALL.md

Suggested-by: Li Fubang <lifubang@acmcoder.com>
Signed-off-by: Aleksa Sarai <aleksa@amutable.com>
2026-03-25 19:38:39 +11:00
Aleksa Sarai 142c838e53 merge #5194 into opencontainers/runc:main
Akhil Mohan (1):
  use POSIX regex in libpathrs build

LGTMs: kolyshkin cyphar
2026-03-25 02:57:28 +11:00
Akhil Mohan 28d5ffbab0 use POSIX regex in libpathrs build
word boundary anchor \> is present only in GNU awk implementation. This
will not work if we are building libpathrs inside a container like
debian/ubuntu which uses mawk. Therefore switch to a POSIX compatible
regex that can be used with all implementations of awk to find the
system libc path

Signed-off-by: Akhil Mohan <akhilerm@gmail.com>
Signed-off-by: Aleksa Sarai <aleksa@amutable.com>
2026-03-24 21:20:45 +11:00
lfbzhm 132498f869 Merge pull request #5191 from kolyshkin/unix
libct/exeseal: drop own F_SEAL_EXEC
2026-03-21 19:55:16 +08:00
Kir Kolyshkin dc2558d7b2 Merge pull request #5185 from kolyshkin/fix-5172
CHANGELOG fixups
2026-03-20 23:19:04 -07:00
Kir Kolyshkin f00b2f9fd5 libct/exeseal: drop own F_SEAL_EXEC
Since golang.org/x/sys@v0.22 it is available from unix.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-03-20 15:57:55 -07:00
lifubang 7fdab1cb69 test: check mount source fds are cleaned up with idmapped mounts
Signed-off-by: lifubang <lifubang@acmcoder.com>
2026-03-20 01:17:08 +00:00
lifubang c77e71a3e7 libct: close mount source fd as soon as possible
This commit factors out setupAndMountToRootfs without changing any
logic. Use "Hide whitespace changes" during review to focus on the
actual changes.

The refactor ensures the mount source file descriptor is closed via
defer in each loop iteration, reducing the total number of open FDs
in runc. This helps avoid hitting the file descriptor limit under
high concurrency or when handling many mounts.

Signed-off-by: lifubang <lifubang@acmcoder.com>
2026-03-20 01:09:49 +00:00
Kir Kolyshkin 65d3120d9e CHANGELOG: forward-port v1.3.5 changes
From commit 488fc13e.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-03-19 12:18:44 -07:00
Kir Kolyshkin 29f2d82a85 CHANGELOG: fix entry placement
Commit 0079bee1 incorrectly placed an entry into v1.4.1 changelog.
Move it to under "Unreleased".

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-03-19 12:18:41 -07:00
lifubang 0d0fd95731 libct: add a nil check for mountError
Signed-off-by: lifubang <lifubang@acmcoder.com>
2026-03-19 15:47:32 +00:00
lfbzhm 837e98c984 Merge pull request #5171 from kolyshkin/runc-buildtags
Makefile: add RUNC_BUILDTAGS, deprecate EXTRA_BUILDTAGS
2026-03-19 16:32:40 +08:00
Kir Kolyshkin d8c62c7d0b Makefile: add RUNC_BUILDTAGS, deprecate EXTRA_BUILDTAGS
A bit of history. EXTRA_BUILDTAGS was introduced in commit dac417174,
as a quick way to add some extra Go build tags to the runc build.

Later, commit 767bc008 changed Makefile to not get EXTRA_TAGS from the
shell environment, as the name is quite generic and some unrelated
environment variable with that name can affect runc build. While such
change does make sense, it makes it more complicated to pass build tags
in CI and otherwise (see e.g. commit 0e1fe368a).

Moreover, runc build uses some Go build tags by default (via Makefile),
and while it is easy to add more build tags (via EXTRA_BUILDTAGS), in
order to remove some existing tags one has to redefine BUILDTAGS from
scratch, which is not very convenient (again, see commit 0e1fe368a which
gets the current value of BUILDTAGS from the Makefile in order to remove
a single tag).

To handle all of the above, let's do this:
 - implement RUNC_BUILDTAGS, fixing the issue of not-so-unique name;
 - allow to get RUNC_BUILDTAGS from shell environment;
 - implement a feature to remove a build tag from default set by
   prefixing it with "-" (as in RUNC_BUILDTAGS="-seccomp");
 - document all this in README;
 - make CI use the new feature;
 - keep EXTRA_BUILDTAGS for backward compatibility, add a make warning
   and a TODO to remove it for runc 1.6.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-03-18 13:17:17 +08:00
Akihiro Suda 348c7663e1 Merge pull request #5172 from kolyshkin/seccomp-wait-kill
Support specs.LinuxSeccompFlagWaitKillableRecv
2026-03-18 09:34:49 +09:00
Kir Kolyshkin 0079bee17f Support specs.LinuxSeccompFlagWaitKillableRecv
This adds support for WaitKillableRecv seccomp flag
(also known as SCMP_FLTATR_CTL_WAITKILL in libseccomp and
as SECCOMP_FILTER_FLAG_WAIT_KILLABLE_RECV in the kernel).

This requires:
 - libseccomp >= 2.6.0
 - libseccomp-golang >= 0.11.0
 - linux kernel >= 5.19

Note that this flag does not make sense without NEW_LISTENER, and
the kernel returns EINVAL when SECCOMP_FILTER_FLAG_WAIT_KILLABLE_RECV
is set but SECCOMP_FILTER_FLAG_NEW_LISTENER is not set.

For runc this means that .linux.seccomp.listenerPath should also be set,
and some of the seccomp rules should have SCMP_ACT_NOTIFY action. This
is why the flag is tested separately in seccomp-notify.bats.

At the moment the only adequate CI environment for this functionality is
Fedora 43. On all other platforms (including CentOS 10 and Ubuntu 24.04)
it is skipped similar to this:

> ok 251 runc run [seccomp] (SECCOMP_FILTER_FLAG_WAIT_KILLABLE_RECV) # skip requires libseccomp >= 2.6.0 and API level >= 7 (current version: 2.5.6, API level: 6)

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-03-16 10:48:42 -07:00
Aleksa Sarai 496b68a305 Merge pull request #5175 from kolyshkin/changelog-runc-init-errors
CHANGELOG: move "better errors from runc init" to 1.4.0
2026-03-15 21:11:24 +09:00
Kir Kolyshkin e232a541bd CHANGELOG: move "better errors from runc init" to 1.4.0
Found out that these changes were backported to release-1.4 (PR 5040)
and made its way into runc v1.4.0, but were missing from its CHANGELOG.

Move the item to v1.4.0 changelog, and add a backport PR reference.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-03-14 15:35:42 -07:00
Aleksa Sarai 5c48e21781 merge #5154 into opencontainers/runc:main
Aleksa Sarai (4):
  VERSION: back to development
  VERSION: release v1.5.0-rc.1
  CHANGELOG: forward-port v1.4.1 entry
  CHANGELOG: add original PR references to backports

LGTMs: rata lifubang
2026-03-13 21:28:25 +09:00
Aleksa Sarai e5b355048c VERSION: back to development
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2026-03-13 18:17:43 +09:00
Aleksa Sarai 5d2588d379 VERSION: release v1.5.0-rc.1
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
v1.5.0-rc.1
2026-03-13 18:17:43 +09:00
Aleksa Sarai ced0149acf CHANGELOG: forward-port v1.4.1 entry
Some of the patches in the "unreleased" section were backported and so
they can be moved to the v1.4.1 section to some unneeded avoid
duplication.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2026-03-13 16:29:31 +09:00
Aleksa Sarai ed75f30e7a CHANGELOG: add original PR references to backports
When going through the changelog for v1.5.0-rc.1, these PRs were merged
but not referenced by their original PR number in the changelog, making
it harder to figure out which patches since v1.4.0-rc.1 are in
v1.5.0-rc.1 or v1.4.0.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2026-03-12 23:20:38 +09:00
Rodrigo Campos Catelin fd0388b2c4 Merge pull request #5170 from cyphar/ci-conmon-libpathrs
gha: install libpathrs for conmon test as well
2026-03-12 13:48:11 +01:00
Aleksa Sarai 9cf46be341 gha: install libpathrs for conmon test as well
Commit 192e3d416f ("ci: add conmon tests run") was merged without
rebasing on top of commit e2c989b7e1 ("build: enable libpathrs by
default"), causing build failures when it was merged.

The solution is to just use the same install script as the rest of CI
from commit 7322b05f41 ("ci: build and install libpathrs").

Fixes: 192e3d416f ("ci: add conmon tests run")
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2026-03-12 20:46:10 +09:00
lfbzhm 7837689f9a Merge pull request #5159 from kolyshkin/add-conmon
ci: add conmon tests run
2026-03-12 19:18:14 +08:00
Aleksa Sarai ba01f0fb6a merge #5150 into opencontainers/runc:main
Aleksa Sarai (1):
  conformance: poststart hooks spec now matches runc

LGTMs: rata kolyshkin
2026-03-12 19:05:19 +09:00