8008 Commits

Author SHA1 Message Date
Kir Kolyshkin 4ccedcbfe8 Merge pull request #5250 from AkihiroSuda/ci-cache-lima
CI: lima: add template name to cache key
2026-04-16 12:06:58 -07:00
Akihiro Suda ff4470156e CI: lima: add template name to cache key
The cache created for almalinux-8 could be overwritten for almalinux-9

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2026-04-16 22:30:11 +09:00
Rodrigo Campos Catelin 51d0c948d0 Merge pull request #5239 from AkihiroSuda/lima-actions
Complete migration from Cirrus CI to GHA (Lima)
2026-04-16 13:19:09 +02:00
Aleksa Sarai c5077eb39f merge #5243 into opencontainers/runc:main
Rodrigo Campos (1):
  libct/test: Disable GC on test run to catch leaking fds

LGTMs: kolyshkin cyphar
2026-04-16 14:55:36 +10:00
Rodrigo Campos 748af2e285 libct/test: Disable GC on test run to catch leaking fds
This test is racy for a long time now. All the logs I could find in CI
seem to be dangling symlinks, like the test shows "23 -> ". This means
the fd was closed before we did the call to readlink().

Let's try to disable the GC. This should get rid of the "fds are getting
closed before we read them" part.

Updates: #4297

Signed-off-by: Rodrigo Campos <rodrigo@amutable.com>
2026-04-15 17:08:29 -07:00
Rodrigo Campos Catelin 6f42442640 Merge pull request #5232 from kolyshkin/int-wait-stderr
libct/int: better error reporting
2026-04-15 18:22:42 +02:00
Kir Kolyshkin 9970cbfdb6 libct/int: switch from bytes.Buffer to strings.Builder
The latter is simpler and provides just enough functionality to be used
here.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-04-14 17:05:06 -07:00
Kir Kolyshkin 568a309225 libct/int: remove buffers.Stdin
It is never used.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-04-14 17:05:06 -07:00
Kir Kolyshkin 54be90bf68 libct/int: use readlink -v
By default, readlink is silent about any errors. Make it verbose so we
can better interpret any test failures.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-04-14 17:05:05 -07:00
Kir Kolyshkin bf4fcc3002 libct/int: show stderr if command failed
When running a process inside a container, make sure its stderr is not
nil (except for some trivial cases like cat). Modify waitProcess to show
failed command's stderr, if possible.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-04-14 17:04:18 -07:00
Kir Kolyshkin dd9fda7d60 libct/int: waitProcess: rm dead code
Since Wait returns an ExitError if process' exit status is not 0,
checking process status is redundant and this code is never reached.

Remove it.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-04-14 17:03:56 -07:00
Akihiro Suda 9d697a9222 Complete migration from Cirrus CI to GHA (Lima)
Fix issue 5238

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2026-04-14 19:17:07 +09:00
Kir Kolyshkin edbed618bf Merge pull request #5200 from xujihui1985/fix/rootfs-propagation
fix(libcontainer): preserve rootfs slave propagation for rslave containers
2026-04-12 22:03:54 -07:00
sean 38245cc5ac fix(libcontainer): bats test for rootfs propagation
add bat integration test for rootfs propagation test, expect to
see the mount propagation is slave, the test will create a isolate mntns
to run the test as the test will mutate the rootfs propagation

Signed-off-by: sean <xujihui1985@gmail.com>
2026-04-11 10:23:31 +08:00
sean ec170d8672 fix(libcontainer): preserve rootfs slave propagation
When rootfsPropagation is set to rslave, prepareRoot() was forcing the
rootfs parent mount to MS_PRIVATE before bind-mounting and pivoting into
the rootfs. That breaks the slave relationship needed for HostToContainer
propagation, so later unmount/remount events on host mountpoints under
the rootfs are not reflected inside the running container.

Fix this by keeping the rootfs parent mount as MS_SLAVE for slave-like
rootfs propagation settings, while leaving the final root propagation
remount in place.

Signed-off-by: sean <xujihui1985@gmail.com>
2026-04-11 10:22:16 +08:00
Kir Kolyshkin 506a568da5 Merge pull request #5234 from opencontainers/dependabot/github_actions/actions/github-script-9
build(deps): bump actions/github-script from 8 to 9
2026-04-10 18:05:19 -07:00
dependabot[bot] ce9d995115 build(deps): bump actions/github-script from 8 to 9
Bumps [actions/github-script](https://github.com/actions/github-script) from 8 to 9.
- [Release notes](https://github.com/actions/github-script/releases)
- [Commits](https://github.com/actions/github-script/compare/v8...v9)

---
updated-dependencies:
- dependency-name: actions/github-script
  dependency-version: '9'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-11 08:41:23 +08:00
lfbzhm b7e727f9a6 Merge pull request #5235 from opencontainers/dependabot/go_modules/golang.org/x/net-0.53.0
build(deps): bump golang.org/x/net from 0.52.0 to 0.53.0
2026-04-11 08:32:10 +08:00
Kir Kolyshkin 23072fd8ab Merge pull request #5224 from RedMakeUp/cirrus-unsafe-env
ci: propagate RUNC_ALLOW_UNSAFE_TESTS to ssh session
2026-04-10 16:59:25 -07:00
dependabot[bot] 727fae3012 build(deps): bump golang.org/x/net from 0.52.0 to 0.53.0
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.52.0 to 0.53.0.
- [Commits](https://github.com/golang/net/compare/v0.52.0...v0.53.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-10 18:19:02 +00:00
Kir Kolyshkin 4b97e12fcc Merge pull request #5233 from opencontainers/dependabot/go_modules/golang.org/x/sys-0.43.0
build(deps): bump golang.org/x/sys from 0.42.0 to 0.43.0
2026-04-10 11:17:57 -07:00
lfbzhm 780fd713fd Merge pull request #5222 from kolyshkin/drop-extra-cr
tests/int/checkpoint: drop unneeded tests
2026-04-09 19:21:51 +08:00
RedMakeUp 8178af4930 ci: propagate RUNC_ALLOW_UNSAFE_TESTS to ssh session
The RUNC_ALLOW_UNSAFE_TESTS variable set in the Cirrus CI env block
does not reach the integration tests because they are executed via
"ssh -tt localhost make ...", which starts a new login shell that
does not inherit the caller's environment. As a result, unsafe tests
are always skipped in Cirrus CI even though the intent is to run them.

Fix this by exporting the variable in /root/.bashrc (same way we
already handle PATH), so the ssh session picks it up.

See #5212 (comment).

Fixes: 9932ad19 ("tests/int: introduce the concept of unsafe tests")
Signed-off-by: RedMakeUp <girafeeblue@gmail.com>
2026-04-09 10:03:37 +00:00
dependabot[bot] ebc6fd6ad1 build(deps): bump golang.org/x/sys from 0.42.0 to 0.43.0
Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.42.0 to 0.43.0.
- [Commits](https://github.com/golang/sys/compare/v0.42.0...v0.43.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-09 04:52:33 +00:00
Kir Kolyshkin 2cd4782b70 tests/int/checkpoint: drop unneeded tests
Those tests were added by commit 8d180e96 ("Add support for Linux
Network Devices"), apparently by copy-pasting the test cases which
call simple_cr (all four of them).

While different simple_cr tests make sense as they cover different
code paths in runc and/or check for various regression, the same
variations with netdevice do not make sense, as having a net device
is orthogonal to e.g. bind mount, --debug, or cgroupns.

Remove those.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-04-08 11:07:42 -07:00
lfbzhm 65bf6dc661 Merge pull request #5226 from kolyshkin/fix-rootless-systemd-idmap
tests/rootless.sh: fix skipping idmap tests for systemd
2026-04-08 19:05:36 +08:00
Rodrigo Campos Catelin d57a45eb78 Merge pull request #5227 from cyphar/internal-cmsg-package
libct: move cmsg helpers to new internal/cmsg package
2026-04-08 11:36:32 +02:00
Rodrigo Campos Catelin 4c8d72d54d Merge pull request #5186 from kolyshkin/poststart
Move poststart hook from runc create to runc start
2026-04-08 11:35:17 +02:00
Kir Kolyshkin 3e0829d195 tests/rootless.sh: fix skipping idmap tests for systemd
When RUNC_USE_SYSTEMD is set, tests/rootless.sh is using

	ssh -tt rootless@localhost

to run tests as rootless user. In this case, local environment is not
passed to the user's ssh session (unless explicitly specified), and so
the tests do not get ROOTLESS_FEATURES.

As a result, idmap-related tests are skipped when running as rootless
using systemd cgroup driver:

	integration test (systemd driver)
	...
	[02] run rootless tests ... (idmap)
	...
	ok 286 runc run detached ({u,g}id != 0) # skip test requires rootless_idmap
	...

Fix this by creating a list of environment variables needed by the
tests, and adding those to ssh command line (in case of ssh) or
exporting (in case of sudo) so both cases work similarly.

Also, modify disable_idmap to unset variables set in enable_idmap so
they are not exported at all if idmap is not in features.

Fixes: bf15cc99 ("cgroup v2: support rootless systemd")
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-04-07 11:27:48 -07:00
Kir Kolyshkin ac2a53be8e tests: rename AUX_{DIR,UID} to ROOTLESS_AUX_*
Also, fix the typo (AUX_DIX) in cleanup.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-04-07 10:53:37 -07:00
Aleksa Sarai ca509e76ff libct: move cmsg helpers to new internal/cmsg package
These helpers all make more sense as a self-contained package and moving
them has the added benefit of removing an unneeded libpathrs dependency
(from libcontainer/utils's import of pathrs-lite) from several test
binaries.

Signed-off-by: Aleksa Sarai <aleksa@amutable.com>
2026-04-08 01:21:41 +10:00
Kir Kolyshkin 80fc1cd34e Merge pull request #5223 from thaJeztah/gofix
libcontainer/devices: add '//go:fix inline' directives
2026-04-06 11:08:29 -07:00
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
Sebastiaan van Stijn ba83c7c7d7 libcontainer/devices: add '//go:fix inline' directives
This allows users to automaticaly migrate to the new location
using `go fix`. It has some limitations, but can help smoothen
the transition; for example, taking this file;

```
package main

import (
	"github.com/opencontainers/runc/libcontainer/devices"
)

func main() {
	_, _ = devices.DeviceFromPath("a", "b")
	_, _ = devices.HostDevices()
	_, _ = devices.GetDevices("a")
}
```

Running `go fix -mod=readonly ./...` will migrate the code;

```
package main

import (
	devices0 "github.com/moby/sys/devices"
)

func main() {
	_, _ = devices0.DeviceFromPath("a", "b")
	_, _ = devices0.HostDevices()
	_, _ = devices0.GetDevices("a")
}
```

updates b345c78dca

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-04-04 19:36:43 +02: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
Kir Kolyshkin 3cdda464fa Move poststart hook from runc create to runc start
The runtime-spec [1] currently says:

> 6. Runtime's start command is invoked with the unique identifier of
>    the container.
> 7. The startContainer hooks MUST be invoked by the runtime. If any
>    startContainer hook fails, the runtime MUST generate an error, stop
>    the container, and continue the lifecycle at step 12.
> 8. The runtime MUST run the user-specified program, as specified by
>    process.
> 9. The poststart hooks MUST be invoked by the runtime. If any
>    poststart hook fails, the runtime MUST generate an error, stop the
>    container, and continue the lifecycle at step 12.
> ...
> 11. Runtime's delete command is invoked with the unique identifier of
>     the container.
> 12. The container MUST be destroyed by undoing the steps performed
>     during create phase (step 2).
> 13. The poststop hooks MUST be invoked by the runtime. If any poststop
>     hook fails, the runtime MUST log a warning, but the remaining hooks
>     and lifecycle continue as if the hook had succeeded.

Currently, we do 9 before 8 (heck, even before 6), which is clearly
against the spec and results in issues like the one described in [2].

Let's move running poststart hook to after the user-specified process
has started.

NOTE this patch only fixes the order and does not implement removing
the container when the poststart hook failed (as this part of the spec
is controversial -- destroy et al and should probably be, and currently
are, part of "runc delete").

[1]: https://github.com/opencontainers/runtime-spec/blob/main/runtime.md#lifecycle
[2]: https://github.com/opencontainers/runc/issues/5182

Reported-by: ningmingxiao <ning.mingxiao@zte.com.cn>
Reported-by: Erik Sjölund <erik.sjolund@gmail.com>
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-04-02 12:28:54 -07:00
Kir Kolyshkin 2253475660 libct: factor handleFifo out of c.exec
No functional change. To be used by the next patch.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-04-02 10:22:22 -07:00
Kir Kolyshkin b0762c7af1 libct: add lock-less c.signal
Rename c.signal to c.signalInit, and add c.signal which is a lock-less
form of c.Signal.

To be used by the next patch.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-04-02 10:22:22 -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