Commit Graph

5367 Commits

Author SHA1 Message Date
Kir Kolyshkin dfc0f0695a man/*: revamp
Current runc man pages are ugly (no proper man page formatting)
and very short (mostly just a copy-paste from the "runc <command>
--help" output. They are also somewhat obsoleted as not all CLI updates
were propagated to man/*.

This commits makes the first step to solving this.

In short:
 - added some more information about some options;
 - lots of formatting fixes;
 - use references to other man pages and web pages;
 - fix SYNOPSYS (formatting, mostly);
 - removed the repeated description of <container_id> from every page;
 - added SEE ALSO;
 - something else I forgot.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2021-06-16 12:42:06 -07:00
Kir Kolyshkin e8bd33ae28 runc --help: improve log options description
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2021-06-15 17:49:56 -07:00
Kir Kolyshkin cf4ecaed08 runc update: hide --kernel* options
Commit 52390d6804 made this parameters obsoleted, but they are
still shown in e.g. runc update --help output.

Hide them (and maybe in 5 years we can remove them).

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2021-06-15 17:48:40 -07:00
Kir Kolyshkin 4065c394a3 exec: rm --no-subreaper flag
This was removed from runc exec by commit f61c6e413f about 5 years ago,
so it's time to remove it entirely.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2021-06-15 15:40:10 -07:00
Kir Kolyshkin f093cca13d Merge pull request #3024 from kolyshkin/fscommon-mv
libct/cg: mv fscommon.{Open,Read,Write}File to cgroups
2021-06-14 12:49:18 -07:00
Kir Kolyshkin 8726c701a1 Merge pull request #3017 from wzshiming/fix/setenv
Returns clearer error message for Setenv
2021-06-14 11:13:13 -07:00
Akihiro Suda c4359f8e7d Merge pull request #3005 from adrianreber/2021-06-07-lsm-profile 2021-06-15 01:16:43 +09:00
Kir Kolyshkin d7fc302860 libct/cg/fs*: mark {Open,Read,Write}File as deprecated
... and switch to using the ones from cgroups.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2021-06-13 17:17:48 -07:00
Kir Kolyshkin 8f1b4d4a6f libct/cg: mv fscommon.{Open,Read,Write}File to cgroups
This is a better place as cgroups itself is using these.
Should help with moving more stuff common in between fs and fs2 to
fscommon.

Looks big, but this is just moving the code around:

 fscommon/{fscommon,open}.go -> cgroups/file.go
 fscommon/fscommon_test.go   -> cgroups/file_test.go

and fixes for TestMode moved to a different package.

There's no functional change.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2021-06-13 12:38:21 -07:00
Shiming Zhang 322c8fd36b Returns clearer error message for setenv
Signed-off-by: Shiming Zhang <wzshiming@foxmail.com>
2021-06-12 14:32:48 +08:00
Mrunal Patel 93a01cd4d0 Merge pull request #3009 from AkihiroSuda/update-ebpf-wrap
update cilium/ebpf to fix haveBpfProgReplace() check
2021-06-11 15:38:01 -04:00
Mrunal Patel a3813ca249 Merge pull request #3000 from kolyshkin/test-dev-update
libct/int: add device update test
2021-06-11 14:36:49 -04:00
Kir Kolyshkin 0ca4cdad35 Merge pull request #3010 from askervin/5D6_blkio_bfq_weight
libcontainer/cgroups/fs/blkio: support BFQ weight[_device]
2021-06-11 11:30:05 -07:00
Akihiro Suda 46940ed80c update cilium/ebpf to fix haveBpfProgReplace() check
The `errors.Is(err, unix.EINVAL)` check in `haveBpfProgReplace()` was
broken because the `cilium/ebpf` library did not "wrap" errors.
https://github.com/cilium/ebpf/blob/v0.6.0/link/program.go#L72

So the eBPF support of runc was broken for kernel prior to 5.6.

This commit bumps up cilium/ebpf to contain cilium/ebpf PR 320.

Fix opencontainers/runc issue 3008

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2021-06-12 02:12:25 +09:00
dependabot[bot] 7eb5c527c8 Merge pull request #3023 from opencontainers/dependabot/github_actions/tim-actions/get-pr-commits-1.1.0 2021-06-11 14:43:08 +00:00
Antti Kervinen 6339d8a0dd libcontainer/cgroups/fs/blkio: support BFQ weight[_device]
- Update the blkio cgroup to support the BFQ I/O Scheduler, that has
  replaced CFQ in the Linux kernel.
- BFQ is controlled through blkio.bfq.weight[_device] instead of
  CFQ's blkio.weight[_device] in cgroups v1.
- BFQ does not support blkio.leaf_weight[_device], so that behavior
  remains untouched.
- Do not change behavior on legacy CFQ systems.
- Enable using blkio weights on BFQ systems.

Signed-off-by: Antti Kervinen <antti.kervinen@intel.com>
2021-06-11 11:11:06 +03:00
dependabot[bot] 01f5dcaeb7 build(deps): bump tim-actions/get-pr-commits from 1.0.0 to 1.1.0
Bumps [tim-actions/get-pr-commits](https://github.com/tim-actions/get-pr-commits) from 1.0.0 to 1.1.0.
- [Release notes](https://github.com/tim-actions/get-pr-commits/releases)
- [Commits](https://github.com/tim-actions/get-pr-commits/compare/v1.0.0...v1.1.0)

---
updated-dependencies:
- dependency-name: tim-actions/get-pr-commits
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-11 06:31:30 +00:00
Akihiro Suda b44f48c945 Merge pull request #3018 from oss-qm/submit/tests-fix-spelling
github: workflows: fix tiny typo
2021-06-11 14:19:21 +09:00
Akihiro Suda 196eee13e5 Merge pull request #3019 from kolyshkin/sd-skip-dev
libct/cg/sd: fix "SkipDevices" handling
2021-06-11 14:09:58 +09:00
Kir Kolyshkin bd8e070109 libct/cg/sd: fix "SkipDevices" handling
1. The meaning of SkipDevices is what it is -- do not set any
   device-related options.

2. Reverts the part of commit 108ee85b82 which skipped the freeze
   when the SkipDevices is set. Apparently, the freeze is needed on
   update even if no Device* properties are being set.

3. Add "runc update" to "runc run [device cgroup deny]" test.

Fixes: 752e7a8249
Fixes: 108ee85b82
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2021-06-10 12:01:21 -07:00
Aleksa Sarai f454bb10d7 merge branch 'pr-3004'
Sebastiaan van Stijn (2):
  libcontainer: relax validation for absolute paths
  configs/validator: move cgroup validation to the list of checks

LGTMs: kolyshkin cyphar
Closes #3004
2021-06-11 00:22:03 +10:00
Enrico Weigelt, metux IT consult 1b2abc89ae github: workflows: fix tiny typo
Tiny spelling fix - it's called "docker", not "dockre".

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2021-06-10 13:03:16 +02:00
Sebastiaan van Stijn b31a9340f9 libcontainer: relax validation for absolute paths
Commits 1f1e91b1a0 and 2192670a24
added validation for mountpoints to be an absolute path, to match the OCI
specs.

Unfortunately, the old behavior (accepting the path to be a relative path)
has been around for a long time, and although "not according to the spec",
various higher level runtimes rely on this behavior.

While higher level runtime have been updated to address this requirement,
there will be a transition period before all runtimes are updated to carry
these fixes.

This patch relaxes the validation, to generate a WARNING instead of failing,
allowing runtimes to update (but allowing them to update runc to the current
version, which includes security fixes).

We can remove this exception in a future patch release.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-06-09 13:20:28 +02:00
Sebastiaan van Stijn dbb35411f8 configs/validator: move cgroup validation to the list of checks
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-06-09 13:15:54 +02:00
Aleksa Sarai dcdf6b631d merge branch 'pr-3006'
Kir Kolyshkin (1):
  libct/cg/sd/dbus: fix NewDbusConnManager

LGTMs: AkihiroSuda cyphar
Closes #3006
2021-06-09 20:09:00 +10:00
Aleksa Sarai f2e0e8f9d0 merge branch 'pr-3012'
Kir Kolyshkin (1):
  libct/cg/fs: don't forget to close a file

LGTMs: AkihiroSuda cyphar
Closes #3012
2021-06-09 15:02:00 +10:00
Kir Kolyshkin 9573e4b68e libct/cg/fs: don't forget to close a file
Fixes: 7fe0a98e79
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2021-06-08 21:04:41 -07:00
Akihiro Suda 4d6b9297c7 Merge pull request #2986 from cyphar/ebpf-replacefd-support-check
cgroupv2: ebpf: check for BPF_F_REPLACE support and degrade gracefully
2021-06-08 15:35:30 +09:00
Aleksa Sarai 9ebc573a38 cgroupv2: ebpf: debug info when detaching programs in fallback mode
It seems that we are triggering the mutli-attach fallback in the fedora
CI, but we don't have enough debugging information to really know what's
going on, so add some. Unfortunately the amount of information we have
available with eBPF programs in general is fairly limited (we can't get
their bytecode for instance).

We also demote the "more than one filter" warning to an info message
because it happens very often under the systemd cgroup driver (likely
when systemd configures the cgroup it isn't deleting our old program, so
when our apply code runs after the systemd one there are two running
programs).

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2021-06-08 13:23:59 +10:00
Aleksa Sarai a3ca7b47fc cgroupv2: ebpf: check for BPF_F_REPLACE support and degrade gracefully
It turns out that the cilium eBPF library doesn't degrade gracefully if
BPF_F_REPLACE is not supported, so we need to work around it by treating
that case as we treat the more-than-one program case.

It also turns out that we weren't passing BPF_F_REPLACE explicitly, but
this is required by the cilium library (causing EINVALs).

Fixes: d0f2c25f52 ("cgroup2: devices: replace all existing filters when attaching")
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2021-06-08 13:23:56 +10:00
Kir Kolyshkin d06bda60c5 libct/cg/sd/dbus: fix NewDbusConnManager
Noticed that the check of trying to use both rootful and rootless
in NewDbusConnManager never worked, as we never set dbusInited to true.

Do that. While at it, protect this with the mutex (against the
case of two goroutines simultaneously calling NewDbusConnManager).
This is a rare call, so taking read-only then read-write mutex does not
make sense.

Fixes: c7f847ed3a

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2021-06-07 12:23:01 -07:00
Adrian Reber 535f25c44f Allow restoring with a different LSM profile
Restoring an SELinux enabled container with Podman will result in
a container with the exactly same SELinux process labels as during
checkpointing. CRIU takes care of all the process labels.

Restoring multiple copies of a checkpointed container will result in all
containers having the same SELinux process labels, which might be
undesired.

When looking at Pods all container in a Pod share the process label
of the infrastructure container. To restore a container into and
existing Pod it is necessary to tell CRIU to restore the container
with the infrastructure container process label.

CRIU supports setting different process labels using --lsm-profile for a
long time and this just passes the process label information from runc
to CRIU.

Unfortunately CRIU has a bug as no one was using the --lsm-profile
option so this changes requires the upcoming CRIU version 3.16.

Signed-off-by: Adrian Reber <areber@redhat.com>
2021-06-07 18:05:24 +02:00
Kir Kolyshkin 508f5bf665 libct/int: add device update test
... and remove the one from tests/integration.

The idea is similar to the one for the test case being removed -- try
updating device rules many times to make sure we are not leaking eBPF
programs after every update/Set(). This is better though as we can
really change the device rules every time (which "runc update" can't)
and check that the rule is applied.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2021-06-05 16:11:29 -07:00
Kir Kolyshkin 2f8e8e9d97 Merge pull request #2994 from kolyshkin/skip-devices-on-update
runc update: skip devices
2021-06-04 15:33:26 -07:00
Kir Kolyshkin 123a34d4e3 Merge pull request #2999 from thaJeztah/remove_deprecated_stubs
libcontainer: remove aliases for deprecated functions
2021-06-04 14:05:55 -07:00
Sebastiaan van Stijn 8fe3dfbb88 libcontainer/system: remove alias for deprecated RunningInUserNS
These were deprecated and moved; the stubs were included in the
last two (rc94, rc95) releases, so external consumers would have
the chance to update their code.

Removing this so that this doesn't get into v1.0.0 GA

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-06-04 17:48:48 +02:00
Sebastiaan van Stijn 3f23a736cb libcontainer/configs: remove stubs for deprecated Devices funcs
These were deprecated and moved; the stubs were included in the
last two (rc94, rc95) releases, so external consumers would have
the chance to update their code.

Removing this so that this doesn't get into v1.0.0 GA

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-06-04 17:46:25 +02:00
Akihiro Suda 7362fa2d28 Merge pull request #2997 from kolyshkin/fix-dbus-err
[rc94 regression] libct/cg/sd: fix dbus error handling
2021-06-04 14:01:32 +09:00
Kir Kolyshkin b2d28c5df2 libct/cg/sd: fix dbus error handling
This fixes isDbusError function, introduced by commit bacfc2c. Due to a
type error it was not working at all.

This also fixes the whole "retry on dbus disconnect" logic.

This also fixes a regression in startUnit (and cgroupManager.Apply()),
which should never return "unit already exists" error but it did.

Fixes: bacfc2c
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2021-06-03 12:40:41 -07:00
Kir Kolyshkin bf7492ee5d runc update: skip devices
The runc update CLI is not able to modify devices, so let's set SkipDevices
(so that a cgroup controller won't try to update devices cgroup).

This helps use cases when some other device management (NVIDIA GPUs)
applies its configuration on top of what runc does.

Make sure we do not save SkipDevices into state.json.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2021-06-03 10:40:55 -07:00
Mrunal Patel c8653a2506 Merge pull request #2985 from kolyshkin/term-doc
docs/terminals.md: add troubleshooting
2021-06-03 13:13:06 -04:00
Aleksa Sarai 13acae7376 merge branch 'pr-2992'
Kir Kolyshkin (3):
  libct/cg/fs/stats_util_test: use t.Helper
  libct/cg/fs/memory_test: fix formatting
  libct/int/testPids: logging nits

LGTMs: AkihiroSuda cyphar
Closes #2992
2021-06-03 21:05:42 +10:00
Aleksa Sarai a77d031114 merge branch 'pr-2991'
Kir Kolyshkin (2):
  vendor: willf/bitset@v1.1.11 -> bits-and-blooms/bitset@v1.2.0
  Bump selinux to v1.8.2

LGTMs: AkihiroSuda cyphar
Closes #2991
2021-06-03 21:03:55 +10:00
Kir Kolyshkin 2888e6e543 Merge pull request #2989 from crosbymichael/cm-email
update crosbymichael email
2021-06-02 17:46:16 -07:00
Kir Kolyshkin c3831d646d libct/cg/fs/stats_util_test: use t.Helper
These functions are called from multiple places,
and if t.Helper() is not used, the context is not clear.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2021-06-02 17:43:02 -07:00
Kir Kolyshkin 9eb0371bab libct/cg/fs/memory_test: fix formatting
Make it more readable.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2021-06-02 17:42:19 -07:00
Kir Kolyshkin e969d42156 libct/int/testPids: logging nits
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2021-06-02 17:31:03 -07:00
Kir Kolyshkin 48d76adf7b Merge pull request #2974 from thaJeztah/fix_some_linting
Fix various linting issues
2021-06-02 16:53:26 -07:00
Kir Kolyshkin a5bd78ef52 vendor: willf/bitset@v1.1.11 -> bits-and-blooms/bitset@v1.2.0
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2021-06-02 16:28:38 -07:00
Kir Kolyshkin 65cf0e61fb Bump selinux to v1.8.2
This is to include willf/bitset@v1.1.11 ->
bits-and-blooms/bitset@v1.2.0.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2021-06-02 16:27:27 -07:00