Commit Graph

7419 Commits

Author SHA1 Message Date
Kir Kolyshkin 390641d148 libct/int: improve TestExecInEnvironment
This is a slight refactor of TestExecInEnvironment, making it more
strict wrt checking the exec output.

1. Explain why DEBUG is added twice to the env.
2. Reuse the execEnv for the check.
3. Make the check more strict -- instead of looking for substrings,
   check line by line.
4. Add a check for extra environment variables.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-01-09 18:22:53 +08:00
Kir Kolyshkin 9a54594752 libct/int: add BenchmarkExecInBigEnv
Here's what it shows on my laptop (with -count 10 -benchtime 10s,
summarized by benchstat):

	                │   sec/op    │
	ExecTrue-20       8.477m ± 2%
	ExecInBigEnv-20   61.53m ± 1%

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-01-09 18:22:53 +08:00
lfbzhm e5b777f9a9 Merge pull request #4586 from opencontainers/dependabot/go_modules/google.golang.org/protobuf-1.36.2
build(deps): bump google.golang.org/protobuf from 1.36.1 to 1.36.2
2025-01-09 12:16:44 +08:00
dependabot[bot] a69d289ffd build(deps): bump google.golang.org/protobuf from 1.36.1 to 1.36.2
Bumps google.golang.org/protobuf from 1.36.1 to 1.36.2.

---
updated-dependencies:
- dependency-name: google.golang.org/protobuf
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-08 04:16:24 +00:00
Kir Kolyshkin a50e6872be tests/int: simplify assignments
Assigning a multi-line value to a bash variable should not be so complex.

While at it, slightly reformat create_runtime_hook.

No functional change.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-01-07 13:54:34 -08:00
Kir Kolyshkin a22ea827a8 tests/int/hooks_so: don't hardcode soname
Reuse the appropriate variables instead.

No functional change.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-01-07 13:54:34 -08:00
Tomasz Duda 1890af6d45 support cgroup v1 mounted with noprefix
Android mounts the v1 cpuset cgroup with the noprefix option.
As a result, runc first attempts to access cpuset files using the prefix format (e.g., cpuset.cpus).
If this fails, it falls back to accessing them without the prefix (e.g., cpus).
Once a successful access method is determined, it is cached and used for all subsequent operations.
Only the v1 cpuset cgroup is allowed to mount with noprefix. See kernel source:
https://github.com/torvalds/linux/blob/2e1b3cc9d7f790145a80cb705b168f05dab65df2/kernel/cgroup/cgroup-v1.c#L1070.
Cpuset cannot be mounted with and without prefix simultaneously.

Signed-off-by: Tomasz Duda <tomaszduda23@gmail.com>
2025-01-07 13:06:27 -08:00
dependabot[bot] 81b13172be Merge pull request #4582 from opencontainers/dependabot/go_modules/golang.org/x/net-0.34.0 2025-01-07 06:37:38 +00:00
dependabot[bot] 061483b62a build(deps): bump golang.org/x/net from 0.33.0 to 0.34.0
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.33.0 to 0.34.0.
- [Commits](https://github.com/golang/net/compare/v0.33.0...v0.34.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-01-07 04:35:23 +00:00
dependabot[bot] c25c92580f Merge pull request #4579 from opencontainers/dependabot/go_modules/golang.org/x/sys-0.29.0 2025-01-06 23:23:26 +00:00
dependabot[bot] 48ad17f4c6 build(deps): bump golang.org/x/sys from 0.28.0 to 0.29.0
Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.28.0 to 0.29.0.
- [Commits](https://github.com/golang/sys/compare/v0.28.0...v0.29.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-06 04:55:38 +00:00
Aleksa Sarai 1c32d39997 merge #4576 into opencontainers/runc:main
Kir Kolyshkin (1):
  libct/system: rm Fexecve

LGTMs: lifubang cyphar
2025-01-04 15:39:05 +11:00
Kir Kolyshkin 83350c24a9 libct/system: rm Fexecve
This helper was added for runc-dmz in commit dac417174, but runc-dmz was
later removed in commit 871057d, which forgot to remove the helper.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-01-03 13:57:05 -08:00
Akihiro Suda 06a4a781a5 Merge pull request #4572 from rinarakaki/main
Fix `go.mod` link in README.md
2025-01-01 02:06:45 +09:00
Akihiro Suda e859f292d6 Merge pull request #4571 from opencontainers/dependabot/go_modules/google.golang.org/protobuf-1.36.1
build(deps): bump google.golang.org/protobuf from 1.36.0 to 1.36.1
2025-01-01 02:06:31 +09:00
Rin Arakaki c0abf76e0f Update README.md
Signed-off-by: Rin Arakaki <rnarkkx@gmail.com>
2024-12-29 14:36:49 +09:00
lfbzhm d48d9cfefc Merge pull request #4459 from kolyshkin/prio-nits
Fixups to scheduler/priority settings
2024-12-25 23:41:27 +08:00
dependabot[bot] f848304994 build(deps): bump google.golang.org/protobuf from 1.36.0 to 1.36.1
Bumps google.golang.org/protobuf from 1.36.0 to 1.36.1.

---
updated-dependencies:
- dependency-name: google.golang.org/protobuf
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-25 23:29:14 +08:00
lfbzhm fd932ec301 Merge pull request #4433 from kolyshkin/hasHook
libct: add/use configs.HasHook
2024-12-25 19:28:13 +08:00
Kir Kolyshkin 57462491c1 libct/configs/validate: add IOPriority.Class validation
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2024-12-22 18:17:44 -08:00
Kir Kolyshkin 7334ee01e6 libct/configs: rm IOPrioClassMapping
This is an internal implementation detail and should not be either
public or visible.

Amend setIOPriority to do own class conversion.

Fixes: bfbd0305 ("Add I/O priority")
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2024-12-22 18:17:44 -08:00
Kir Kolyshkin 5d3942eec3 libct: unify IOPriority setting
For some reason, io priority is set in different places between runc
start/run and runc exec:

 - for runc start/run, it is done in the middle of (*linuxStandardInit).Init,
   close to the place where we exec runc init.
 - for runc exec, it is done much earlier, in (*setnsProcess) start().

Let's move setIOPriority call for runc exec to (*linuxSetnsInit).Init,
so it is in the same logical place as for runc start/run.

Also, move the function itself to init_linux.go as it's part of init.

Should not have any visible effect, except part of runc init is run with
a different I/O priority.

While at it, rename setIOPriority to setupIOPriority, and make it accept
the whole *configs.Config, for uniformity with other similar functions.

Fixes: bfbd0305 ("Add I/O priority")
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2024-12-22 18:15:31 -08:00
Kir Kolyshkin ec465d39f5 utils: simplify newProcess
This code is not in libcontainer, meaning it is only used by a short lived
binary (runc start/run/exec). Unlike code in libcontainer (see
CreateLibcontainerConfig), here we don't have to care about copying the
structures supplied as input, meaning we can just reuse the pointers
directly.

Fixes: bfbd0305 ("Add I/O priority")
Fixes: 770728e1 ("Support `process.scheduler`")
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2024-12-22 18:06:20 -08:00
Kir Kolyshkin 2dc3ea4b87 libct: simplify setIOPriority/setupScheduler calls
Move the nil check inside, simplifying the callers.

Fixes: bfbd0305 ("Add I/O priority")
Fixes: 770728e1 ("Support `process.scheduler`")
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2024-12-22 18:06:20 -08:00
Kir Kolyshkin 93091e6ac2 libct: don't pass SpecState to init unless needed
SpecState field of initConfig is only needed to run hooks that are
executed inside a container -- namely CreateContainer and
StartContainer.

If these hooks are not configured, there is no need to fill, marshal and
unmarshal SpecState.

While at it, inline updateSpecState as it is trivial and only has one user.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2024-12-22 17:52:15 -08:00
Kir Kolyshkin 8afeb58398 libct: add/use configs.HasHook
This allows to omit a call to c.currentOCIState (which can be somewhat
costly when there are many annotations) when the hooks of a given kind
won't be run.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2024-12-22 17:47:09 -08:00
Akihiro Suda 2e906e292e Merge pull request #4312 from lifubang/refactor-process
refactor init and setns process
2024-12-23 08:53:10 +09:00
lfbzhm 171c414904 refactor init and setns process
Introduce a common parent struct `containerProcess`,
let both `initProcess` and `setnsProcess` are inherited
from it.

Signed-off-by: lfbzhm <lifubang@acmcoder.com>
2024-12-21 19:16:01 -08:00
Aleksa Sarai 30962bdf7a merge #4562 into opencontainers/runc:main
Adam Korczynski (1):
  remove broken fuzzer from oss-fuzz build script

LGTMs: kolyshkin cyphar
2024-12-20 22:53:52 +11:00
dependabot[bot] ef5d2d4e35 Merge pull request #4565 from opencontainers/dependabot/go_modules/github.com/cilium/ebpf-0.17.1 2024-12-20 05:35:35 +00:00
dependabot[bot] 5855ba5303 build(deps): bump github.com/cilium/ebpf from 0.17.0 to 0.17.1
Bumps [github.com/cilium/ebpf](https://github.com/cilium/ebpf) from 0.17.0 to 0.17.1.
- [Release notes](https://github.com/cilium/ebpf/releases)
- [Commits](https://github.com/cilium/ebpf/compare/v0.17.0...v0.17.1)

---
updated-dependencies:
- dependency-name: github.com/cilium/ebpf
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-20 04:10:23 +00:00
Kir Kolyshkin ae994af502 Merge pull request #4563 from opencontainers/dependabot/go_modules/github.com/cilium/ebpf-0.17.0
build(deps): bump github.com/cilium/ebpf from 0.16.0 to 0.17.0
2024-12-19 16:28:57 -08:00
dependabot[bot] e809db842f build(deps): bump github.com/cilium/ebpf from 0.16.0 to 0.17.0
Bumps [github.com/cilium/ebpf](https://github.com/cilium/ebpf) from 0.16.0 to 0.17.0.
- [Release notes](https://github.com/cilium/ebpf/releases)
- [Commits](https://github.com/cilium/ebpf/compare/v0.16.0...v0.17.0)

---
updated-dependencies:
- dependency-name: github.com/cilium/ebpf
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-20 00:07:03 +00:00
Kir Kolyshkin 5239b05129 Merge pull request #4564 from opencontainers/dependabot/go_modules/golang.org/x/net-0.33.0
build(deps): bump golang.org/x/net from 0.32.0 to 0.33.0
2024-12-19 16:05:57 -08:00
Aleksa Sarai b5a1957d53 Merge pull request #4560 from opencontainers/dependabot/go_modules/github.com/cyphar/filepath-securejoin-0.3.6
build(deps): bump github.com/cyphar/filepath-securejoin from 0.3.5 to 0.3.6
2024-12-19 15:14:00 +11:00
dependabot[bot] c2b11a6353 build(deps): bump golang.org/x/net from 0.32.0 to 0.33.0
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.32.0 to 0.33.0.
- [Commits](https://github.com/golang/net/compare/v0.32.0...v0.33.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>
2024-12-19 04:09:48 +00:00
dependabot[bot] 71327d7fcd build(deps): bump github.com/cyphar/filepath-securejoin
Bumps [github.com/cyphar/filepath-securejoin](https://github.com/cyphar/filepath-securejoin) from 0.3.5 to 0.3.6.
- [Release notes](https://github.com/cyphar/filepath-securejoin/releases)
- [Changelog](https://github.com/cyphar/filepath-securejoin/blob/main/CHANGELOG.md)
- [Commits](https://github.com/cyphar/filepath-securejoin/compare/v0.3.5...v0.3.6)

---
updated-dependencies:
- dependency-name: github.com/cyphar/filepath-securejoin
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-19 01:42:44 +00:00
lfbzhm 90f38e76ae Merge pull request #4561 from kolyshkin/lint162
GHA CI bumps
2024-12-19 09:33:04 +08:00
Aleksa Sarai af929228bb RELEASES: add formal release policy for runc
Historically, our release cadence and support policy has been quite
ad-hoc, which has caused some strife and is not really becoming of a
project as widely used as ours. So, in an attempt to make our releases
more regular and to provide more guidance on our backport policy, add a
document outlining our policy.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2024-12-19 12:26:39 +11:00
Adam Korczynski 21c0968bf1 remove broken fuzzer from oss-fuzz build script
Signed-off-by: Adam Korczynski <adam@adalogics.com>
2024-12-18 16:49:44 +00:00
Kir Kolyshkin 9468986a49 ci: use a specific ubuntu version
GHA shows a warning telling that "ubuntu-latest" is going to be switched
to ubuntu-24.04 soon. Let's specify the version explicitly (and switch
to 24.04 for this job ahead of github).

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2024-12-17 22:52:16 -08:00
Kir Kolyshkin e845f4be86 ci: bump golangci-lint to v1.62
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2024-12-17 22:50:44 -08:00
dependabot[bot] aace922de9 Merge pull request #4558 from opencontainers/dependabot/go_modules/google.golang.org/protobuf-1.36.0 2024-12-18 01:20:22 +00:00
dependabot[bot] 705382ac66 build(deps): bump google.golang.org/protobuf from 1.35.2 to 1.36.0
Bumps google.golang.org/protobuf from 1.35.2 to 1.36.0.

---
updated-dependencies:
- dependency-name: google.golang.org/protobuf
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-17 04:53:16 +00:00
Aleksa Sarai 3ddaa9140d merge #4555 into opencontainers/runc:main
Kir Kolyshkin (1):
  Re-add tun/tap to default device rules

LGTMs: AkihiroSuda cyphar
2024-12-17 14:13:05 +11:00
Kir Kolyshkin 394f4c3b70 Re-add tun/tap to default device rules
Since v1.2.0 was released, a number of users complained that the removal
of tun/tap device access from the default device ruleset is causing a
regression in their workloads.

Additionally, it seems that some upper-level orchestration tools
(Docker Swarm, Kubernetes) makes it either impossible or cumbersome
to supply additional device rules.

While it's probably not quite right to have /dev/net/tun in a default
device list, it was there from the very beginning, and users rely on it.
Let's keep it there for the sake of backward compatibility.

This reverts commit 2ce40b6ad7.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2024-12-16 12:01:10 -08:00
Akihiro Suda 28b65d3d23 Merge pull request #4472 from kolyshkin/cg-cfg
libct/configs: move cgroup configs to libct/cgroups
2024-12-15 02:01:32 +09:00
Akihiro Suda 2e1559ecd3 Merge pull request #4553 from kolyshkin/keyring
keyring: update @kolyshkin key expiry
2024-12-14 22:12:37 +09:00
Kir Kolyshkin b15fcc1be6 keyring: update @kolyshkin key expiry
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2024-12-13 14:28:12 -08:00
Kir Kolyshkin 5a838ccbe0 tests/cmd/sd-helper: switch from configs to cgroups
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2024-12-11 19:08:40 -08:00