Commit Graph

8013 Commits

Author SHA1 Message Date
Aleksa Sarai c4bb59526d VERSION: release v1.5.0
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
v1.5.0
2026-06-19 13:30:23 +02:00
Rodrigo Campos Catelin fabada3dd8 Merge pull request #5335 from AkihiroSuda/cherrypick-5330-1.5
[release-1.5] features: propagate version from the root urfave/cli command
2026-06-19 12:47:10 +02:00
Akihiro Suda c8a2d9bebc features: propagate version from the root urfave/cli command
Fix #5329
Fix #5331

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
(cherry picked from commit 7dda063c9a)
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2026-06-19 19:33:47 +09:00
Rodrigo Campos Catelin 8e155ffcdf Merge pull request #5328 from cyphar/1.5-libpathrs-0.2.5-5921
[1.5] deps: update to libpathrs 0.2.5
2026-06-19 12:17:06 +02:00
Aleksa Sarai 3c2913ccfb runc: add libpathrs info to --version and features
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
(cherry picked from commit 1e20abef19)
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2026-06-18 22:20:17 +02:00
Aleksa Sarai aba980f436 deps: update to libpathrs v0.2.5
This update includes a few breaking API changes that I needed to get in
before an actual runc release depends on it, so that we don't need to
deal with compatibility shims for them (or bumping the SOVERSION).

From a Go API perspective, there were no major changes -- though this
bump did also require a bump to github.com/cyphar/filepath-securejoin
because one of the wrapped APIs changed from int to uint64 as a flag
argument type. Again, better to get this done before we really depend on
this in a public way.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
(cherry picked from commit d47bf88349)
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2026-06-18 22:19:56 +02:00
Akihiro Suda 778bd25ef8 Merge pull request #5326 from kolyshkin/1.5-5312
[1.5] deps: bump to go-criu v8.3.0, drop google protobuf
2026-06-19 01:37:32 +09:00
Kir Kolyshkin cc3c5c1655 deps: bump to go-criu v8.3.0
go-criu v8.3.0 switches to protobuf-go-lite, which helps to remove
google.golang.org/protobuf dependency from here, reducing the runc
binary size from ~16M to ~14M.

The only missing piece is proto.String, proto.Bool, proto.Int32 etc.
helpers that return a pointer to a given variable. Those are replaced
by a generic mkPtr, which in turn is to be replaced by the new builtin
once Go < 1.26 is no longer supported.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit f66ace4cfa)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-06-17 17:51:13 -07:00
Kir Kolyshkin 750317a2f7 deps: bump go-criu to v8.2.0
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit 269405107f)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-06-17 17:42:58 -07:00
Aleksa Sarai 8ac0bc04b4 CHANGELOG: fix codespell
Fixes: b33d1c2605 ("VERSION: release v1.5.0-rc.3")
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2026-06-13 19:55:37 +02:00
Aleksa Sarai 0c1d94666f VERSION: back to development
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2026-06-13 14:24:58 +02:00
Aleksa Sarai b33d1c2605 VERSION: release v1.5.0-rc.3
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
v1.5.0-rc.3
2026-06-13 14:24:39 +02:00
Aleksa Sarai 50bac276ed merge CVE-2026-41579 fixes into release-1.5
Aleksa Sarai (3):
  rootfs: make cgroupv1 subsystem symlinks fd-based
  rootfs: make /dev initialisation code fd-based
  rootfs: switch createDevices argument order

LGTMs: lifubang kolyshkin rata
2026-06-13 14:00:23 +02:00
Aleksa Sarai cd1c87d05a rootfs: make cgroupv1 subsystem symlinks fd-based
As with /dev symlinks, this was missed in commit d40b3439a9 ("rootfs:
switch to fd-based handling of mountpoint targets"). It's not really
clear to what extent this was exploitable (/sys/fs/cgroup is a tmpfs we
create) but it's better to just fix this anyway.

Fixes: d40b3439a9 ("rootfs: switch to fd-based handling of mountpoint targets")
Signed-off-by: Aleksa Sarai <aleksa@amutable.com>
(cherry picked from commit 66acd48f9d)
Signed-off-by: Aleksa Sarai <aleksa@amutable.com>
2026-06-13 00:28:59 +02:00
Aleksa Sarai 4504accbba rootfs: make /dev initialisation code fd-based
These codepaths are very old and operate on pure paths but before
pivot_root(2), meaning that a bad image with a malicious /dev symlink
could cause us to operate on host paths instead.

In practice this means that we could be tricked into removing a file
called "ptmx" (note that /dev/pts/ptmx and /dev/ptmx are both immune for
different reasons) or creating a very restricted set of symlinks (with
fixed targets and names). The scope of these bugs is thus quite limited,
but we definitely need to harden against it.

These codepaths were unfortunately missed during the fd-based rework in
commit d40b3439a9 ("rootfs: switch to fd-based handling of mountpoint
targets") -- I must've assumed they were called after pivot_root(2)...

Fixes: GHSA-xjvp-4fhw-gc47
Fixes: CVE-2026-41579
Fixes: d40b3439a9 ("rootfs: switch to fd-based handling of mountpoint targets")
Signed-off-by: Aleksa Sarai <aleksa@amutable.com>
(cherry picked from commit 864db8042d)
Signed-off-by: Aleksa Sarai <aleksa@amutable.com>
2026-06-13 00:14:51 +02:00
Aleksa Sarai c33c74f670 rootfs: switch createDevices argument order
This argument order matches most other helpers we have and will also
match the changes we are about to make to setupPtmx and
setupDevSymlinks.

Signed-off-by: Aleksa Sarai <aleksa@amutable.com>
(cherry picked from commit fcf04eb41b)
Signed-off-by: Aleksa Sarai <aleksa@amutable.com>
2026-06-13 00:14:51 +02:00
Rodrigo Campos Catelin f869956058 Merge pull request #5301 from kolyshkin/1.5-5297
[1.5] runc list: fix error reporting for non-existent root
2026-05-28 18:15:25 +02:00
Kir Kolyshkin 524803ccd6 [1.5] runc list: fix error reporting for non-existent root
The idea of commit d1fca8e was right (report errors for non-existent
root, unless using the default root dir) but the logic was inverted.

Fix the logic.

Test case for default root requires non-existent /root/runc, which is
not always possible.

[v1.5 backport: use GlobalIsSet]

Reported-by: RedMakeUp <girafeeblue@gmail.com>
Co-authored-by: RedMakeUp <girafeeblue@gmail.com>
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit 98c442a0e6)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-05-28 18:01:12 +02:00
Akihiro Suda 92e7dd9734 Merge pull request #5303 from ricardobranco777/1.5-5295
[1.5] Update busybox:glibc in integration tests to latest (1.38.0) builds
2026-05-28 13:52:03 +09:00
Ricardo Branco 3964cb7e6c Update busybox:glibc in integration tests to latest (1.38.0) builds
This release fixes tests on ppc64le in busybox commit 3621595939e43:
"nsenter,unshare: don't use xvfork_parent_waits_and_exits(), it SEGVs
on ppc64le".

Fixes: https://github.com/opencontainers/runc/issues/4836

Signed-off-by: Ricardo Branco <rbranco@suse.de>
(cherry picked from commit c7c2920db0)
Signed-off-by: Ricardo Branco <rbranco@suse.de>
2026-05-27 10:51:55 +02:00
Ricardo Branco d5dc535668 tests/int: relax testPids fork error match string
The test checked for the exact BusyBox ash diagnostic "sh: can't fork".
With BusyBox 1.38, ash reports the failure as:

  /bin/sh: line 0: can't fork: Resource temporarily unavailable

Match the stable "can't fork" part of the error message instead.

Signed-off-by: Ricardo Branco <rbranco@suse.de>
(cherry picked from commit de39d5e79b)
Signed-off-by: Ricardo Branco <rbranco@suse.de>
2026-05-27 10:51:55 +02:00
Ricardo Branco 2b02fb6327 tests/int: build TestPids pipelines programmatically
TestPids used long hand-written /bin/true pipelines for the 4-, 32- and
64-command cases. This made the test easy to typo and hard to review, as
seen by the earlier "bin/true" entries.

Build the shell pipelines instead, preserving the existing test coverage
while making the command counts explicit.

Signed-off-by: Ricardo Branco <rbranco@suse.de>
(cherry picked from commit 3acb097f93)
Signed-off-by: Ricardo Branco <rbranco@suse.de>
2026-05-27 10:51:55 +02:00
Rodrigo Campos Catelin 2c0d0d7408 Merge pull request #5286 from lifubang/backport-5269-1.5
[1.5] tests/int: fix flake in "resources.unified override" (backport #5269)
2026-05-22 10:45:40 +02:00
Kir Kolyshkin 7522b50684 tests/int: fix flake in "resources.unified override"
As runc binary grows in size over time (new features, more
dependencies) some tests start to flake because of low memory limits.

One such test is "runc run (cgroup v2 resources.unified override)";
it obviously fails because of 1M memory limit:

> runc run failed: unable to start container process: container init was OOM-killed (memory limit too low?)

Increase the limits 4x. Do the same for the "unified only" test.

Fixes issue 5264.

Reported-by: Kevin Berry <kpberry11@gmail.com>
Reported-by: Ricardo Branco <rbranco@suse.de>
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit 3fabb4d070)
Signed-off-by: lifubang <lifubang@acmcoder.com>
Co-authored-by: Claude <noreply@anthropic.com>
2026-05-22 10:32:49 +02:00
Rodrigo Campos Catelin a5e6e351a9 Merge pull request #5280 from lifubang/backport-5275-1.5
[1.5] libct: reuse tmpfs for directory masks
2026-05-21 11:52:43 +02:00
lifubang 8cf2a2d684 libct: close rootFd ASAP in maskPaths
Close the root file descriptor immediately after use in maskPaths to
reduce the window during which an attacker could potentially exploit
an open fd to access or manipulate the root filesystem. This follows
the principle of least privilege and mitigates risks in compromised
or malicious container scenarios.

Co-authored-by: Kir Kolyshkin <kolyshkin@gmail.com>
Signed-off-by: lifubang <lifubang@acmcoder.com>
(cherry picked from commit b88635e57e)
Signed-off-by: lifubang <lifubang@acmcoder.com>
2026-05-20 10:17:24 +00:00
lifubang e2eb5dd2db libct: optimize maskPaths for single-directory case
This is a follow-up to #5275. That change reused a single tmpfs mount
to mask multiple directories, which is efficient when masking more than
one path. However, it introduced unnecessary overhead when only one
directory is masked. This commit restores the original behavior for the
single-path case while preserving shared tmpfs logic for multiple paths.

Signed-off-by: lifubang <lifubang@acmcoder.com>
(cherry picked from commit e7e2f00248)
Signed-off-by: lifubang <lifubang@acmcoder.com>
2026-05-20 10:17:13 +00:00
lifubang d7791e5c23 integration: reuse tmpfs for directory masks
Co-authored-by: Davanum Srinivas <davanum@gmail.com>
Signed-off-by: lifubang <lifubang@acmcoder.com>
(cherry picked from commit 124772f354)
Signed-off-by: lifubang <lifubang@acmcoder.com>
2026-05-20 10:16:18 +00:00
lifubang 411b5f2f23 libct: reuse tmpfs for directory masks
Kubernetes may add one sysfs thermal_throttle entry per CPU to
maskedPaths. On large Intel systems this can produce many directory
masks for a single container. runc currently handles each directory
mask with a separate read-only tmpfs mount, and therefore a separate
tmpfs superblock.

On Linux 4.18/RHEL 8 kernels, creating and tearing down many tmpfs
superblocks can contend on the global shrinker_rwsem when containers
start or stop concurrently.

Use one read-only tmpfs for directory masks and bind-mount it over the
remaining directory targets. The first non-procfs-fd directory mount is
reopened through the container root fd before it is reused. File masks
still bind /dev/null, and procfs fd targets keep the existing
one-tmpfs-per-target behaviour because they are fd aliases rather than
stable rootfs paths.

If the bind-mount of the shared source fails (e.g. due to kernel
restrictions), fall back to individual tmpfs mounts for all remaining
directories. Tmpfs mounts use nr_blocks=1,nr_inodes=1 to minimise
kernel resource usage.

The bind mounts do not create additional tmpfs superblocks. They also
retain the read-only mount flag inherited from the source vfsmount, so
the masking semantics remain unchanged.

xref: kubernetes/kubernetes#138512
xref: kubernetes/kubernetes#138388
xref: kubernetes/kubernetes#131018

Co-authored-by: Davanum Srinivas <davanum@gmail.com>
Refactored-by: lifubang <lifubang@acmcoder.com>
Signed-off-by: lifubang <lifubang@acmcoder.com>
(cherry picked from commit c046c9b973)
Signed-off-by: lifubang <lifubang@acmcoder.com>
2026-05-20 10:16:18 +00:00
lifubang 24867ade0a libct: enforce strict tmpfs limits for masked paths
Previously, masked directories (e.g., /proc/acpi, /proc/scsi) were
mounted as read-only tmpfs without explicit size or inode limits.
Although these mounts are meant to be empty and unwritable, the lack
of resource constraints means that—should an attacker bypass the
read-only protection (e.g., via container escape, mount namespace
manipulation, or a kernel vulnerability)—the tmpfs could consume up
to 50% of system memory by default (the kernel's default tmpfs limit).

To mitigate this risk in high-density container environments and
adhere to the principle of least privilege, we now explicitly set:
  - nr_blocks=1 (sufficient for at most one block size)
  - nr_inodes=1 (sufficient for at most one inode)
Ref: https://man7.org/linux/man-pages/man5/tmpfs.5.html

These limits ensure that even if compromised, kernel memory usage
remains strictly bounded and negligible.

This change aligns with best practices used by other container
runtimes and strengthens defense-in-depth for sensitive masked paths.

Co-authored-by: Davanum Srinivas <davanum@gmail.com>
Refactored-by: lifubang <lifubang@acmcoder.com>
Signed-off-by: lifubang <lifubang@acmcoder.com>
(cherry picked from commit e57a7a4c8f)
Signed-off-by: lifubang <lifubang@acmcoder.com>
2026-05-20 10:16:18 +00:00
lifubang 0fc2921263 libct: skip mount for duplicate masked paths
Co-authored-by: Davanum Srinivas <davanum@gmail.com>
Refactored-by: lifubang <lifubang@acmcoder.com>
Signed-off-by: lifubang <lifubang@acmcoder.com>
(cherry picked from commit abf70bab63)
Signed-off-by: lifubang <lifubang@acmcoder.com>
2026-05-20 10:16:18 +00:00
lfbzhm 5e4d064c80 Merge pull request #5283 from kolyshkin/1.5-5279
[1.5] tests/rootless.sh: use command -v instead of which
2026-05-14 22:19:17 +08:00
Kir Kolyshkin 86f61cc3bb tests/rootless.sh: use command -v instead of which
Apparently, lima's experimental/fedora-rawhide image does not include
which rpm, and we don't really want to bother installing it.

Replace "which" with "command -v". Looks like this was the only place;
we already use "command -v" everywhere else.

This should fix lima (experimental/fedora-rawhide) CI.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit 5e78f4a66d)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-05-13 11:07:52 -07:00
lfbzhm 5e3b21e192 Merge pull request #5248 from AkihiroSuda/cherrypick-5239-1.5
[release-1.5] Complete migration from Cirrus CI to GHA (Lima)
2026-04-19 08:51:02 +08:00
Akihiro Suda a03e109e7a 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>
(cherry picked from commit ff4470156e)
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2026-04-17 17:39:01 +09:00
Akihiro Suda 27838f271f Complete migration from Cirrus CI to GHA (Lima)
Fix issue 5238

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
(cherry picked from commit 9d697a9222)
(cherry-pick was not clean)
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2026-04-16 22:20:31 +09:00
lfbzhm c0b996d0d3 Merge pull request #5246 from kolyshkin/1.5-5232
[1.5] libct/int: better error reporting
2026-04-16 14:51:19 +08:00
Kir Kolyshkin c2092624ed 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>
(cherry picked from commit 9970cbfdb6)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-04-15 11:44:08 -07:00
Kir Kolyshkin c63f75727c libct/int: remove buffers.Stdin
It is never used.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit 568a309225)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-04-15 11:44:08 -07:00
Kir Kolyshkin 87edc29643 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>
(cherry picked from commit 54be90bf68)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-04-15 11:44:08 -07:00
Kir Kolyshkin f3e4f8ece9 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>
(cherry picked from commit bf4fcc3002)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-04-15 11:44:08 -07:00
Kir Kolyshkin c9fd1a38f0 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>
(cherry picked from commit dd9fda7d60)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-04-15 11:44:08 -07:00
Rodrigo Campos Catelin f4254caa59 Merge pull request #5230 from kolyshkin/1.5-5226
[1.5] tests/rootless.sh: fix skipping idmap tests for systemd
2026-04-13 20:16:30 +02:00
Kir Kolyshkin 44838af3ee 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>
(cherry picked from commit 3e0829d195)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-04-13 10:56:18 -07:00
Kir Kolyshkin 96ffda7b87 tests: rename AUX_{DIR,UID} to ROOTLESS_AUX_*
Also, fix the typo (AUX_DIX) in cleanup.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit ac2a53be8e)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-04-13 10:56:18 -07:00
Rodrigo Campos Catelin 0500f93a25 Merge pull request #5236 from kolyshkin/1.5-5222
[1.5] tests/int/checkpoint: drop unneeded tests
2026-04-13 11:15:51 +02:00
Kir Kolyshkin 68388249f1 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>
(cherry picked from commit 2cd4782b70)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-04-10 11:19:42 -07:00
Aleksa Sarai 68f0c46b2c Merge pull request #5231 from kolyshkin/1.5-5227
[1.5] libct: move cmsg helpers to new internal/cmsg package
2026-04-09 10:53:42 +10:00
Aleksa Sarai d5cead38fd 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>
(cherry picked from commit ca509e76ff)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-04-08 11:09:19 -07:00
lfbzhm 8583683931 Merge pull request #5225 from thaJeztah/1.5_backport_gofix
[1.5 backport] libcontainer/devices: add '//go:fix inline' directives
2026-04-07 23:18:19 +08:00