Commit Graph

7807 Commits

Author SHA1 Message Date
Kir Kolyshkin a5c14847f4 tests/int: remove useless/obvious comments
This is a bit opinionated, but some comments in integration tests do not
really help to understand the nature of the tests being performed by
stating something very obvious, like

	# run busybox detached
	runc run -d busybox

To make things worse, these not-so-helpful messages are being
copy/pasted over and over, and that is the main reason to remove them.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit 0eb03ef86f)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-04-10 14:42:11 -07:00
lfbzhm 49e6be637f Merge pull request #5229 from kolyshkin/1.4-5226
[1.4] tests/rootless.sh: fix skipping idmap tests for systemd
2026-04-09 09:34:54 +08:00
Kir Kolyshkin ceb8e42641 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-08 10:59:44 -07:00
Kir Kolyshkin 59dd4cdee9 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-08 10:59:44 -07:00
Kir Kolyshkin a9669107ff Merge pull request #5217 from kolyshkin/1.4.2
Release 1.4.2
2026-04-02 17:02:19 -07:00
Kir Kolyshkin 814f276bb0 VERSION: back to development
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-04-02 15:52:51 -07:00
Kir Kolyshkin c241c0bb5e VERSION: release v1.4.2
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
v1.4.2
2026-04-02 15:52:45 -07:00
Rodrigo Campos Catelin 95f27e8053 Merge pull request #5216 from lifubang/backport-5210-1.4
[1.4] Fix SIGCHLD race in signal handler setup
2026-04-02 12:20:05 +02:00
lifubang 39791aeab6 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>
(cherry picked from commit 404181e4cc)
Signed-off-by: lifubang <lifubang@acmcoder.com>
2026-04-02 01:11:45 +00:00
Aleksa Sarai 226ff030b4 Merge pull request #5201 from lifubang/backport-5177-1.4
[1.4] libct: close the mount source fd ASAP!
2026-03-29 19:56:11 +11:00
lifubang 9de77a986c test: check mount source fds are cleaned up with idmapped mounts
Signed-off-by: lifubang <lifubang@acmcoder.com>
(cherry picked from commit 7fdab1cb69)
Signed-off-by: lifubang <lifubang@acmcoder.com>
2026-03-28 15:16:13 +00:00
lifubang e4a82fc2d8 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>
(cherry picked from commit c77e71a3e7)
Signed-off-by: lifubang <lifubang@acmcoder.com>
2026-03-28 15:16:06 +00:00
lifubang 87db63422d libct: add a nil check for mountError
Signed-off-by: lifubang <lifubang@acmcoder.com>
(cherry picked from commit 0d0fd95731)
Signed-off-by: lifubang <lifubang@acmcoder.com>
2026-03-28 15:15:56 +00:00
Rodrigo Campos Catelin d4305dc5dd Merge pull request #5187 from kolyshkin/1.4-5159
[1.4] ci: add conmon tests run
2026-03-20 13:56:48 +01:00
Kir Kolyshkin 63605fc49f ci: add conmon tests run
This adds a CI job to run conmon tests with runc.

Related to issue 5151, PR 5153.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit 192e3d416f)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-03-19 16:55:08 -07:00
Aleksa Sarai 0daa0038d2 Merge pull request #5178 from kolyshkin/1.4-5175
[1.4] CHANGELOG: add "better errors from runc init" to 1.4.0
2026-03-17 10:25:02 +09:00
Kir Kolyshkin c10ee7d4b6 CHANGELOG: add "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.

Add the item to v1.4.0 changelog.

Same as commit e232a54 in main branch.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-03-16 10:42:29 -07:00
Kir Kolyshkin d13808e9d2 Merge pull request #5163 from kolyshkin/v141
VERSION: release 1.4.1
2026-03-12 21:56:37 -07:00
Kir Kolyshkin 6096163226 VERSION: back to development
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-03-12 13:27:50 -07:00
Kir Kolyshkin c671325303 VERSION: release v1.4.1
Note a few minor PRs were not mentioned: #5134, #5094, #5074.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
v1.4.1
2026-03-12 13:23:25 -07:00
Kir Kolyshkin 1a6e2e695f Merge pull request #5167 from cyphar/1.4-libpathrs-cherry-pick
[1.4] *: libpathrs cherry-picks
2026-03-12 12:42:18 -07:00
Kir Kolyshkin 485f8f6b8f Merge pull request #5168 from cyphar/1.4-5009-close-fd-on-error
[1.4] Close fds on error
2026-03-12 12:38:05 -07:00
Kir Kolyshkin 5dac7379e7 [1.4] notify_socket: close fds on error
Reported in issue 5008.

Reported-by: Arina Cherednik <arinacherednik034@gmail.com>
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit 93792e6c13)
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2026-03-12 19:15:37 +09:00
Kir Kolyshkin d934c6dd9e [1.4] libct: mountFd: close mountFile on error
Reported in issue 5008.

Reported-by: Arina Cherednik <arinacherednik034@gmail.com>
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit 8a9b4dcda6)
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2026-03-12 19:15:36 +09:00
Kir Kolyshkin 0af85cbca8 [1.4] libct: newProcessComm: close fds on error
Reported in issue 5008.

Reported-by: Arina Cherednik <arinacherednik034@gmail.com>
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit c24965b742)
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2026-03-12 19:15:35 +09:00
Kir Kolyshkin ffc6092b8d [1.4] libct: startInitialization: add defer close
This function calls Init what normally never returns, so the defer only
works if there is an error and we can safely use it to close those fds
we opened. This was done for most but not all fds.

Reported in issue 5008.

Reported-by: Arina Cherednik <arinacherednik034@gmail.com>
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit 88f897160c)
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2026-03-12 19:15:28 +09:00
Aleksa Sarai 4fb2e1ceba [1.4] deps: update to cyphar.com/go-pathrs@v0.2.4
This includes a few fixes for 32-bit builds.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
(cherry picked from commit b58e342758)
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2026-03-12 19:00:19 +09:00
Aleksa Sarai 97f79dbf59 [1.4] README: document libpathrs build tag
Ever since v0.6.0 of github.com/cyphar/filepath-securejoin, pathrs-lite
has been able to transparently switch to using libpathrs as the backend
for safe path resolution (at compile-time, using a build tag). Note that
because build-tags apply globally, this allows for us to easily opt
pure-Go dependencies into all using libpathrs as well for our binaries.

In a future patch this will likely be enabled by default, but document
that this is an option for downstreams that want to opt-in to using
libpathrs.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
(cherry picked from commit ab6f75dd25)
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2026-03-12 19:00:17 +09:00
Aleksa Sarai 5424ac4ddb [1.4] script: seccomp.sh -> build-seccomp.sh
This name is far more descriptive.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
(cherry picked from commit b1a9047c7a)
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2026-03-12 19:00:16 +09:00
Aleksa Sarai ac7909922e [1.4] build: rename /opt/libseccomp cdylib directory
In a future patch this will contain other cdylibs so it deserves a
slightly more general name.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
(cherry picked from commit 8292574e7a)
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2026-03-12 19:00:14 +09:00
Aleksa Sarai 8cdb38cd4e [1.4] build: treat armhf as ARMv7
The intention of commit 531e29e192 ("script/lib.sh: set GOARM=5 for
armel, GOARM=6 for armhf") was to properly support older ARM platforms
with our release builds.

However, we have never been able to support ARMv6 for our builds because
we use the Debian compiler to build the libseccomp we statically compile
into our binaries and (as per the now-deleted comment itself) Debian
treats armhf as being ARMv7 so the final binaries we produced were
always only ever compatible with ARMv7+.

This was a bit of an oddity before but when building libpathrs for
releases we will need to use Rust which makes the target more explicit
(and while it does support armhf, we are using the Debian-packaged Rust
cross-compiler and thus are in the same dilemma with what Debian
considers "armhf" to be).

All-in-all, it's better to just bite the bullet and just follow Debian
here properly.

Fixes: 531e29e192 ("script/lib.sh: set GOARM=5 for armel, GOARM=6 for armhf")
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
(cherry picked from commit 51ae8de054)
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2026-03-12 19:00:13 +09:00
Aleksa Sarai ba78fffbe5 [1.4] dockerfile: switch to Debian 13
Debian 13 (trixie) was released a few months ago and it's probably
prudent to just upgrade. This is also necessary to get access to riscv64
repositories when we build libpathrs for inclusion in our runc binaries.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
(cherry picked from commit 6b757b6aa0)
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2026-03-12 19:00:05 +09:00
Curd Becker 6b36291fd5 Add linter rule to guard against use of os.Is* error functions
Signed-off-by: Curd Becker <me@curd-becker.de>
(cherry picked from commit 58d24d2dfb)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-03-12 12:01:15 +09:00
Curd Becker 323a54ef0d Replace os.Is* error checking functions with their errors.Is counterpart
Signed-off-by: Curd Becker <me@curd-becker.de>
(cherry picked from commit 536e183451)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-03-12 12:01:15 +09:00
Aleksa Sarai f8040c3d1f Merge pull request #5161 from kolyshkin/1.4-5133
[1.4] libct/specconv: fix panic in initSystemdProps
2026-03-12 12:00:39 +09:00
Kir Kolyshkin 190a6c6e37 libct/specconv: fix panic in initSystemdProps
There is a chance of panic here -- eliminate it.

Add a test case (which panics before the fix).

Reported-by: Luke Hinds <luke@stacklok.com>
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit a48a7cef96)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-03-11 15:21:31 -07:00
Kir Kolyshkin 168dcab909 libct/specconv: TestInitSystemdProps: use t.Run
Use t.Run for individual tests. Add missing desc fields.

Best reviewed with --ignore-all-space.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit 392a221293)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-03-11 15:21:31 -07:00
Aleksa Sarai 323185e3e1 Merge pull request #5157 from kolyshkin/1.4-5153
[1.4] Revert "Preventing containers from being unable to be deleted"
2026-03-10 20:02:01 +09:00
Kir Kolyshkin 1672693373 Revert "Preventing containers from being unable to be deleted"
This fixes random failures to start a container in conmon integration
tests (see issue 5151).

I guess we need to find another way to fix issue 4645.

This reverts commit 1b39997e73.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit 5996fe143a)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-03-09 17:24:52 -07:00
Aleksa Sarai 1f9669fafb Merge pull request #5149 from kolyshkin/1.4-5025
[1.4] libct: fix resetting CPU affinity
2026-03-05 12:40:43 +11:00
Antti Kervinen 1c78358384 libct: fix resetting CPU affinity
unix.CPUSet is limited to 1024 CPUs. Calling
unix.SchedSetaffinity(pid, cpuset) removes all CPUs starting from 1024
from allowed CPUs of pid, even if cpuset is all ones. As a
consequence, when runc tries to reset CPU affinity to "allow all" by
default, it prevents all containers from CPUs 1024 onwards.

This change uses a huge CPU mask to play safe and get all possible
CPUs enabled with a single sched_setaffinity call.

Fixes: #5023

Signed-off-by: Antti Kervinen <antti.kervinen@intel.com>
(cherry picked from commit 700c944c4d)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-03-04 17:14:16 -08:00
Kir Kolyshkin c4dba84df7 Merge pull request #5147 from cyphar/1.4-keyring-fixes
[1.4] keyring fixes
2026-03-04 17:13:58 -08:00
Aleksa Sarai 392c8199d9 keyring: update AkihiroSuda's key
This comes from <https://github.com/AkihiroSuda.gpg> and is a valid
update of the key metadata.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
(cherry picked from commit 9ad18b1347)
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2026-03-05 01:15:08 +11:00
Aleksa Sarai 21c6b2097e keyring: validate: allow maintainers to have no keys
Some maintainers appear to have removed their PGP keys, which causes
"gpg --import" during "make validate-keyring" to fail. The solution is
to switch to a non-fatal warning if no keys were imported.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
(cherry picked from commit 936a59b07f)
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2026-03-05 00:46:12 +11:00
Aleksa Sarai 7c12b02755 keyring: remove asarai@suse.de key
I no longer work at SUSE and thus this key (and email address) are no
longer associated with me.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
(cherry picked from commit a691486c83)
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2026-03-05 00:46:12 +11:00
Akihiro Suda a92b322089 Merge pull request #5134 from kolyshkin/1.4-5124
[1.4] tests/int: Disable coredumps for SCMP_ACT_KILL tests
2026-03-01 03:21:23 +09:00
Ricardo Branco 6326d76098 tests/int: Disable coredumps for SCMP_ACT_KILL tests
SCMP_ACT_KILL terminates the process with a fatal signal, which may
produce a core dump depending on the host configuration.

While this is harmless on ephemeral CI instances, it can leave unwanted
core files on developer or customer systems. It also interferes with
test environments that detect unexpected core dumps.

Signed-off-by: Ricardo Branco <rbranco@suse.de>
(cherry picked from commit f18e97d312)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-02-26 18:37:30 -08:00
Aleksa Sarai 81dc3f393e merge #5125 into opencontainers/runc:release-1.4
Kir Kolyshkin (1):
  ci: update policycoreutils for CentOS 10

LGTMs: AkihiroSuda cyphar
2026-02-26 17:39:49 +11:00
Kir Kolyshkin fc7ac957ae ci: update policycoreutils for CentOS 10
When container-selinux 4:2.246.0-1.el10 is installed, it produces the
following %post script warnings:

> ...
>   Running scriptlet: container-selinux-4:2.246.0-1.el10.noarch            26/37
>   Installing       : container-selinux-4:2.246.0-1.el10.noarch            26/37
>   Running scriptlet: container-selinux-4:2.246.0-1.el10.noarch            26/37
> libsemanage.semanage_pipe_data: Child process /usr/libexec/selinux/hll/pp failed with code: 255. (No data available).
> libsemanage.semanage_compile_module: container: libsepol.policydb_read: policydb module version 24 does not match my version range 4-23.
> libsemanage.semanage_compile_module: container: libsepol.sepol_module_package_read: invalid module in module package (at section 0).
> libsemanage.semanage_compile_module: container: libsepol.sepol_ppfile_to_module_package: Failed to read policy package.
> libsemanage.semanage_direct_commit: Failed to compile hll files into cil files. (No data available).
> semodule:  Failed!
> ...

For some reason, dnf install still succeeds, but when the selinux tests
fail with:

> chcon: failed to change context of '/tmp/bats-run-3MMyYP/runc.szTqBc/bundle/runc' to ‘system_u:object_r:container_runtime_exec_t:s0’: Invalid argument

All this is fixed once policycoreutils is added to the list of RPMS so
it is updated (from 3.9-3.el10 to 3.10-1.el10) during the same
transaction.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit 3235c5a90a)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-02-25 13:45:36 -08:00
Kir Kolyshkin 920ca5a4e0 Merge pull request #5116 from lifubang/backport-1.4-5091
[1.4] Fix runc exec vs go1.26 + older kernel
2026-02-12 11:58:04 -08:00