Commit Graph

5425 Commits

Author SHA1 Message Date
Kailun Qin 3640499a88 libct/rootfs: consolidate utils imports
Signed-off-by: Kailun Qin <kailun.qin@intel.com>
(cherry picked from commit c508a7bc0a)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2021-11-16 13:50:36 -08:00
Sebastiaan van Stijn 3125814f48 Merge pull request #3282 from kolyshkin/1.0-fix-ci-for-criu-3.16
[1.0] fix ci
2021-11-16 19:50:42 +01:00
Odin Ugedal aa1d1ca564 tests/int/dev: add CAP_SYSLOG to /dev/kmsg tests
Add CAP_SYSLOG to ensure that /dev/kmsg can be accesses on systems where
the sysctl kernel.dmesg_restrict = 1.

Signed-off-by: Odin Ugedal <odin@uged.al>
(cherry picked from commit 6be088d69d)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2021-11-15 11:39:26 -08:00
Kir Kolyshkin fdee8658df libct/int/checkpoint_test: fix ParentImage
The ParentImage set by the test should be a path relative to
ImagesDirectory, pointing to a parent images directory (created
by pre-dump).

The parent directory is created by TempDir and so its name is not
constant but has a variable suffix. So, the config was pointing to
a non-existent directory.

This left unnoticed by criu as it assumed the parent image does not
exist, and performed a full dump.

Since criu PR 1403 (will be a part of criu 3.16) that is no longer the
case -- the invalid parent path is treated as an error, and so our
test fails like this:

== RUN   TestCheckpoint
    checkpoint_test.go:145: === /tmp/criu070876105/dump.log ===
    checkpoint_test.go:145: open /tmp/criu070876105/dump.log: no such file or directory
    checkpoint_test.go:146: criu failed: type DUMP errno 56
        log file: /tmp/criu070876105/dump.log
--- FAIL: TestCheckpoint (0.26s)

Fix this by using the actual name of the parent image dir.

Fixes: 98f004182b
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2021-11-15 11:27:09 -08:00
Sebastiaan van Stijn 23c6e4f54f Merge pull request #3212 from AkihiroSuda/cherrypick-3186
[1.0] rootless+cgroup2+systemd: improve error message when dbus-user-session is not installed #3186
2021-09-17 18:29:56 +02:00
Akihiro Suda cbb5ef5c6a improve error message when dbus-user-session is not installed
Before:

```console
$ docker --context=rootless run -it --rm alpine
docker: Error response from daemon: OCI runtime create failed: unable to start
container process: unable to apply cgroup configuration: unable to start unit
"docker-7ef2c29ccafc1ed9c7fd9859337e5b79870d8ccb282f560e43060a847a6c5310.scope"
(properties [{Name:Description Value:"libcontainer container
7ef2c29ccafc1ed9c7fd9859337e5b79870d8ccb282f560e43060a847a6c5310"} {Name:Slice
Value:"user.slice"} {Name:PIDs Value:@au [6286]} {Name:Delegate Value:true}
{Name:MemoryAccounting Value:true} {Name:CPUAccounting Value:true}
{Name:IOAccounting Value:true} {Name:TasksAccounting Value:true}
{Name:DefaultDependencies Value:false}]): read unix @->/run/systemd/private:
read: connection reset by peer: unknown.
```

After:

```console
$ docker --context=rootless run -it --rm alpine
docker: Error response from daemon: OCI runtime create failed: unable to start
container process: unable to apply cgroup configuration: unable to start unit
"docker-8527d83e046da46d1b56b1c6a89324e687da1c365e044b8dde52cfbf1c461c5a.scope"
(properties [{Name:Description Value:"libcontainer container
8527d83e046da46d1b56b1c6a89324e687da1c365e044b8dde52cfbf1c461c5a"} {Name:Slice
Value:"user.slice"} {Name:PIDs Value:@au [10012]} {Name:Delegate Value:true}
{Name:MemoryAccounting Value:true} {Name:CPUAccounting Value:true}
{Name:IOAccounting Value:true} {Name:TasksAccounting Value:true}
{Name:DefaultDependencies Value:false}]): failed to connect to dbus (hint: for
rootless containers, maybe you need to install dbus-user-session package, see
https://github.com/opencontainers/runc/blob/master/docs/cgroup-v2.md): read
unix @->/run/systemd/private: read: connection reset by peer: unknown.
```

For moby/moby issue 42793

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
(cherry picked from commit 1f5798f784)
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2021-09-13 15:13:10 +09:00
Kir Kolyshkin 04bcb7c715 Merge pull request #3173 from cyphar/release-1.0.2
*: release 1.0.2
2021-08-20 11:08:34 -07:00
Aleksa Sarai 86d83333d7 VERSION: back to development
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2021-08-20 17:24:25 +10:00
Aleksa Sarai 52b36a2dd8 VERSION: release 1.0.2
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
v1.0.2
2021-08-20 17:24:11 +10:00
Akihiro Suda 133bcfb9b8 Merge pull request #3167 from kolyshkin/1.0-fix-freeze
[1.0] libct/cg/sd/v1: fix freezeBeforeSet (alt 2)
2021-08-20 14:30:00 +09:00
Kir Kolyshkin 8ec5762888 libct/cg/sd/v1: add SkipFreezeOnSet knob
This is helpful to kubernetes in cases it knows for sure that the freeze
is not required (since it created the systemd unit with no device
restrictions).

As the code is trivial, no tests are required.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit 9a095e44db)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2021-08-18 13:01:00 -07:00
Kir Kolyshkin 1850dc16e0 libct/cg/sd/v1: add freezeBeforeSet unit test
Add a test for freezeBeforeSet, checking various scenarios including
those that were failing before the fix in the previous commit.

[v2: add more cases, add a check before creating a unit.]

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit fec49f2a6c)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2021-08-18 13:01:00 -07:00
Odin Ugedal 4ce440f22a libct/cg/sd/v1: Fix unnecessary freeze/thaw
This fixes the behavior intended to avoid freezing containers/control
groups without it being necessary. This is important for end users of
libcontainer who rely on the behavior of no freeze.

The previous implementation would always get error trying to get
DevicePolicy from the Unit via dbus, since the Unit interface doesn't
contain DevicePolicy.

Signed-off-by: Odin Ugedal <odin@uged.al>
(cherry picked from commit 41043673b7)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2021-08-18 13:01:00 -07:00
Mrunal Patel 9c4d5c6ffe Merge pull request #3169 from kolyshkin/1.0-fix-cc-warn
[1.0] libct/nsenter: fix unused-result warning
2021-08-18 07:53:13 -07:00
Kir Kolyshkin 13b45cb420 libct/nsenter: fix unused-result warning
Commit 2bab4a5 resulted in a warning from gcc:

	nsexec.c: In function ‘write_log’:
	nsexec.c:171:2: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
	  171 |  write(logfd, json, ret);
	      |  ^~~~~~~~~~~~~~~~~~~~~~~

As there's nothing we can or want to do in case write fails,
let's just tell the compiler we're not going to use it.

Fixes: 2bab4a5
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit db8330c9e5)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2021-08-17 15:42:16 -07:00
Mrunal Patel 62f38ade41 Merge pull request #3130 from kolyshkin/1.0-nsexec-log-race
[1.0] fix logging race in nsexec (regression in rc94)
2021-08-12 15:00:34 -07:00
Mrunal Patel 0280d063e1 Merge pull request #3142 from kolyshkin/1.0-reproducible-builds
[1.0] script/release.sh: make builds reproducible
2021-08-11 13:25:43 -07:00
Mrunal Patel ed60a98ad2 Merge pull request #3129 from kolyshkin/1.0-seccomp
[1.0] libct/seccomp: skip redundant rules
2021-08-11 13:24:48 -07:00
Mrunal Patel 4f08893484 Merge pull request #3115 from kolyshkin/1.0-cpu-quota-period
[1.0] libct/cg/v1: work around CPU quota period set failure
2021-08-11 13:23:40 -07:00
Kir Kolyshkin 7cf1952fcb libct/nsenter: fix logging race in nsexec
As reported in issue 3119, there is a race in nsexec logging
that can lead to garbled json received by log forwarder, which
complains about it with a "failed to decode" error.

This happens because dprintf (used since the very beginning of nsexec
logging introduced in commit ba3cabf932) relies on multiple write(2)
calls, and with additional logging added by 64bb59f592 a race is
possible between runc init parent and its children.

The fix is to prepare a string and write it using a single call to
write(2).

[v2: NULLify json on error from asprintf]

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit 2bab4a56f1)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2021-08-11 10:02:43 -07:00
Kir Kolyshkin e2e5267cee [1.0] script/release.sh: make builds reproducible
This is a manual backport of commits 61e201abb2 and
18f434e10a to release-1.0 branch.

Co-authored-by: Kailun Qin <kailun.qin@intel.com>
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2021-08-10 10:52:39 -07:00
Kir Kolyshkin 960182fdf0 libct/seccomp: skip redundant rules
This fixes using runc with podman on my system (Fedora 34).

> $ podman --runtime `pwd`/runc run --rm --memory 4M fedora echo it works
> Error: unable to start container process: error adding seccomp filter rule for syscall bdflush: permission denied: OCI permission denied

The problem is, libseccomp returns EPERM when a redundant rule (i.e. the
rule with the same action as the default one) is added, and podman (on
my machine) sets the following rules in config.json:

    <....>
    "seccomp": {
      "defaultAction": "SCMP_ACT_ERRNO",
      "architectures": [
        "SCMP_ARCH_X86_64",
        "SCMP_ARCH_X86",
        "SCMP_ARCH_X32"
      ],
      "syscalls": [
        {
          "names": [
            "bdflush",
            "io_pgetevents",
            <....>
          ],
          "action": "SCMP_ACT_ERRNO",
          "errnoRet": 1
        },
        <....>

(Note that defaultErrnoRet is not set, but it defaults to 1).

With this commit, it works:

> $ podman --runtime `pwd`/runc run --memory 4M fedora echo it works
> it works

Add an integration test (that fails without the fix).

Similar crun commit:
 * https://github.com/containers/crun/commit/08229f3fb904c5ea19a7d9

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>

Cherry picked from commit 5dd92fd9b4.
Minor conflict in libcontainer/seccomp/seccomp_linux.go due to
missing commit e44bee1026.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2021-08-04 13:04:11 -07:00
Kir Kolyshkin 4c70105b92 libct/cg/v1: workaround CPU quota period set failure
As reported in issue 3084, sometimes setting CPU quota period fails
when a new period is lower and a parent cgroup has CPU quota limit set.

This happens as in cgroup v1 the quota and the period can not be set
together (this is fixed in v2), and since the period is being set first,
new_limit = old_quota/new_period may be higher than the parent cgroup
limit.

The fix is to retry setting the period after the quota, to cover all
possible scenarios.

Add a test case to cover a regression caused by an earlier version of
this patch (ignoring a failure of setting invalid period when quota is
not set).

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit 1b77ebe2c4fa0c6d576dc587aa69e05f6bafd898)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2021-07-28 10:53:05 -07:00
Kir Kolyshkin 0b77b2d1d5 Merge pull request #3101 from AkihiroSuda/cirrus-10
[1.0] Use Cirrus CI for Vagrant tests
2021-07-28 10:47:41 -07:00
Adrian Reber 1d45404592 Do not use Vagrant for CentOS 7/8
As Cirrus CI does not provide a real terminal this uses the same
'ssh -tt' workaround as the Vagrant setup. This sets up the
CentOS 7 and 8 to allow SSH as root to localhost so that we can run
all the tests via 'ssh -tt'.

Not going through vagrant reduces CI times for CentOS 7 and 8 from 6
minutes to 4 minutes.

Signed-off-by: Adrian Reber <areber@redhat.com>
(cherry picked from commit 9f656dbb11)
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2021-07-27 15:21:06 +09:00
Kir Kolyshkin c8d8fd5b5c tests/rootless.sh: fixup for "update rt" test
Without this, the test case fails with

> Writing 1000000 to /sys/fs/cgroup/cpu,cpuacct/runc-cgroups-integration-test/cpu.rt_period_us
> /tmp/bats-run-106836/bats.116418.src: line 548: /sys/fs/cgroup/cpu,cpuacct/runc-cgroups-integration-test/cpu.rt_period_us: Permission denied

Since we do not currently have a setup to test this, this went
unnoticed (can be seen in RHEL8 though).

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Signed-off-by: Adrian Reber <areber@redhat.com>
(cherry picked from commit d448016486)
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2021-07-27 15:20:59 +09:00
Kir Kolyshkin 257018e76c tests/int: fix "update rt period and runtime" for rootless
Since commit f09a3e1b8d, the value passed on to read starts with
a slash, resulting in the first element of the array to be empty.

As a result, the test tries to write to the top-level cgroup, which
fails when rootless:

> # Writing 1000000 to /sys/fs/cgroup/cpu,cpuacct//cpu.rt_period_us
> # /tmp/bats-run-106184/bats.115768.src: line 548: /sys/fs/cgroup/cpu,cpuacct//cpu.rt_period_us: Permission denied

To fix, remove the leading slash.

An alternative fix would be to do "for ((i = 1;" instead of "i = 0", but
that seems less readable.

Fixes: f09a3e1b8d
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit 86af524866)
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2021-07-27 15:20:54 +09:00
Akihiro Suda 76c047f1b1 Evaluate Cirrus CI for Vagrant tests
ref: issue 3078

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
(cherry picked from commit 87bfd20fbd)
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2021-07-20 13:53:50 +09:00
Kir Kolyshkin 2881afb65b Merge pull request #3095 from cyphar/release-1.0.1
[1.0] VERSION: release 1.0.1
2021-07-16 08:00:48 -07:00
Aleksa Sarai 466d1a1ad8 VERSION: back to development
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2021-07-16 14:39:38 +10:00
Aleksa Sarai 4144b63817 VERSION: release 1.0.1
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
v1.0.1
2021-07-16 14:39:19 +10:00
Aleksa Sarai 40dcf1f748 merge branch 'pr-3093' into release-1.0
Kir Kolyshkin (6):
  libct/cg/sd: add TestPodSkipDevicesUpdate
  libct/cg/sd: TestFreezePodCgroup: rm explicit freeze
  libct/cg/sd/v1: Set: avoid unnecessary freeze/thaw
  libct/int/TestFreeze: test freeze/thaw via Set
  libct/int: allow subtests
  libct/cg/sd/v1: Set: don't overwrite r.Freezer

LGTMs: mrunalp cyphar
Closes #3093
2021-07-16 14:37:17 +10:00
Kir Kolyshkin 4efb7a697e libct/cg/sd: add TestPodSkipDevicesUpdate
TestPodSkipDevicesUpdate checks that updating a pod having SkipDevices: true
does not result in spurious "permission denied" errors in a container
running under the pod. The test is somewhat similar in nature to the
@test "update devices [minimal transition rules]" in tests/integration,
but uses a pod.

This tests the validity of freezeBeforeSet in v1.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit a71102624d)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2021-07-15 15:27:23 -07:00
Kir Kolyshkin 82d3eb6915 libct/cg/sd: TestFreezePodCgroup: rm explicit freeze
This was initially added by commit 3e5c199708 because Set (with
r.Freezer = Frozen) was not able to freeze a container.

Now (see a few previous commits) Set can do the freeze, so the explicit
Freeze is no longer needed.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit 52dd96db6b)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2021-07-15 15:27:23 -07:00
Kir Kolyshkin 2fc2e3d675 libct/cg/sd/v1: Set: avoid unnecessary freeze/thaw
Introduce freezeBeforeSet, which contains the logic of figuring out
whether we need to freeze/thaw around setting systemd unit properties.

In particular, if SkipDevices is set, and the current unit properties
allow all devices, there is no need to freeze and thaw, as systemd
won't write any device rules in this case.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit f2db87986c,
 minor conflict in include() due to missing commit
 b60e2edf75)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2021-07-15 15:27:23 -07:00
Kir Kolyshkin ef0aa849ed libct/int/TestFreeze: test freeze/thaw via Set
In addition to freezing and thawing a container via Pause/Resume,
there is a way to also do so via Set.

This way was broken though and is being fixed by a few preceding
commits. The test is added to make sure this is fixed and won't regress.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit 5dc3260431)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2021-07-15 15:27:23 -07:00
Kir Kolyshkin 01cd4b5f3f libct/int: allow subtests
The t.Name() usage in libcontainer/integration prevented subtests
to be used, since in such case it returns a string containing "/",
and thus it can't be used to name a container.

Fix this by replacing slashes with underscores where appropriate.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit af1688a544)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2021-07-15 15:27:23 -07:00
Kir Kolyshkin 22b2ff0f34 libct/cg/sd/v1: Set: don't overwrite r.Freezer
m.Freeze method changes m.cgroups.Resources.Freezer field, which should
not be done while we're temporarily freezing the cgroup in Set. If this
field is changed, and r == m.cgroups.Resources (as it often happens),
this results in inability to freeze the container using Set().

To fix, add and use a method which does not change r.Freezer field.

A test case for the bug will be added separately.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit 67cfd3d400)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2021-07-15 15:27:23 -07:00
Aleksa Sarai e14c1347e6 merge branch 'pr-3092' into release-1.0
Odin Ugedal (2):
  libct/cg/sd: Don't freeze cgroup on cgroup v2 Set
  Update device update tests

LGTMs: mrunalp cyphar
Closes #3092
2021-07-16 07:57:26 +10:00
Odin Ugedal 04edd79d39 libct/cg/sd: Don't freeze cgroup on cgroup v2 Set
Since device updates in cgroup v2 are atomic for systemd, there is no
need to freeze the processes before running the updates.

Signed-off-by: Odin Ugedal <odin@uged.al>
(cherry picked from commit f33be7cc98, trivial conflict
 due to missing commit b60e2edf75)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2021-07-14 23:30:31 -07:00
Odin Ugedal 298a3100b0 Update device update tests
Run device update tests on cgroup v2, and add a test verifying that we
don't allow access to devices when we don't intend to.

Signed-off-by: Odin Ugedal <odin@uged.al>
(cherry picked from commit d41a273dae)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2021-07-14 23:28:26 -07:00
Aleksa Sarai 7250587156 merge branch 'pr-3091' into release-1.0
Kir Kolyshkin (1):
  ci/gha: run on release-* branches after a push

LGTMs: mrunalp cyphar
Closes #3091
2021-07-15 12:39:52 +10:00
Kir Kolyshkin 257723b3f6 ci/gha: run on release-* branches after a push
A CI is needed after PR merges.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit d02b0061d2)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2021-07-14 18:23:57 -07:00
Aleksa Sarai fc2918d950 merge branch 'pr-3087' into release-1.0
Aleksa Sarai (2):
  cgroupv2: ebpf: ignore inaccessible existing programs
  vendor: update github.com/cilium/ebpf

Closes: #3087
LGTMs: mrunalp cyphar
2021-07-15 10:34:57 +10:00
Aleksa Sarai 4dc207a6c0 cgroupv2: ebpf: ignore inaccessible existing programs
This is necessary in order for runc to be able to configure device
cgroups with --systemd-cgroup on distributions that have very strict
SELinux policies such as openSUSE MicroOS[1].

The core issue here is that systemd is adding its own BPF policy that
has an SELinux label such that runc cannot interact with it. In order to
work around this, we can just ignore the policy -- in theory this
behaviour is not correct but given that the most obvious case
(--systemd-cgroup) will still handle updates correctly, this logic is
reasonable.

[1]: https://bugzilla.suse.com/show_bug.cgi?id=1182428

Fixes: d0f2c25f52 ("cgroup2: devices: replace all existing filters when attaching")
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
(cherry picked from commit 57e3c54182)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2021-07-14 00:17:44 -07:00
Aleksa Sarai 90d01a0480 vendor: update github.com/cilium/ebpf
We need to update the eBPF library so that we can get the raw syscall
errors from bpf(2) syscalls using errors.Is.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
(cherry picked from commit fe518a0678)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2021-07-14 00:17:34 -07:00
Aleksa Sarai 4f88ed68e3 merge branch 'pr-3085' into release-1.0
Odin Ugedal (1):
  libct/cg/sd: Add freezer tests
  libct/cg/fs/freezer.GetState: report current cgroup state

LGTMs: AkihiroSuda cyphar
Closes #3085
2021-07-14 16:25:05 +10:00
Odin Ugedal 3f40fbff17 libct/cg/sd: Add freezer tests
This test the issues fixed by the two preceding commits.

Co-Authored-By: Kir Kolyshkin <kolyshkin@gmail.com>
Signed-off-by: Odin Ugedal <odin@uged.al>
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit 3e5c199708)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2021-07-12 02:03:05 -07:00
Odin Ugedal c1a5b3e109 libct/cg/fs/freezer.GetState: report current cgroup state
If a control group is frozen, all its descendants will report FROZEN
in freezer.state cgroup file.

OTOH cgroup v2 cgroup.freeze is not reporting the cgroup as frozen
unless it is frozen directly (i.e. not via an ancestor).

Fix the discrepancy between v1 and v2 drivers behavior by
looking into freezer.self_freezing cgroup file, which, according
to kernel documentation, will show 1 iff the cgroup was frozen directly.

Co-authored-by: Kir Kolyshkin <kolyshkin@gmail.com>
Signed-off-by: Odin Ugedal <odin@uged.al>
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit 294c4866ea)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2021-07-12 02:02:25 -07:00
Mrunal Patel 8e259d29e5 Merge pull request #3079 from kolyshkin/1.0-backport-3062
[1.0] libct/user: fix parsing long /etc/group lines
2021-07-09 17:23:56 -04:00