RFR: 8253435: Cgroup: 'stomping of _mount_path' crash if manually mounted cpusets exist [v2]

Volker Simonis simonis at openjdk.java.net
Fri Sep 25 07:28:36 UTC 2020


On Thu, 24 Sep 2020 15:43:47 GMT, Severin Gehwolf <sgehwolf at openjdk.org> wrote:

>> Volker Simonis has refreshed the contents of this pull request, and previous commits have been removed. The incremental
>> views will show differences compared to the previous content of the PR. The pull request contains one new commit since
>> the last revision:
>>   8253435: Cgroup: 'stomping of _mount_path' crash if manually mounted cpusets exist
>
> test/hotspot/jtreg/containers/cgroup/CgroupSubsystemFactory.java line 271:
> 
>> 269:             test.testCgroupv2NoCgroup2Fs(wb);
>> 270:             test.testCgroupv1MultipleCpusetMounts(wb, test.cgroupv1MntInfoDoubleCpuset);
>> 271:             test.testCgroupv1MultipleCpusetMounts(wb, test.cgroupv1MntInfoDoubleCpuset2);
> 
> For this test to actually work properly we need an additional new line in the hybrid snippet. Sorry about this, was
> probably my fault at the time. Like this:
> +++ b/test/hotspot/jtreg/containers/cgroup/CgroupSubsystemFactory.java
> @@ -104,7 +104,7 @@ public class CgroupSubsystemFactory {
>              "41 30 0:37 / /sys/fs/cgroup/devices rw,nosuid,nodev,noexec,relatime shared:13 - cgroup none rw,seclabel,devices\n" +
>              "42 30 0:38 / /sys/fs/cgroup/cpuset rw,nosuid,nodev,noexec,relatime shared:14 - cgroup none rw,seclabel,cpuset\n" +
>              "43 30 0:39 / /sys/fs/cgroup/blkio rw,nosuid,nodev,noexec,relatime shared:15 - cgroup none rw,seclabel,blkio\n" +
> -            "44 30 0:40 / /sys/fs/cgroup/freezer rw,nosuid,nodev,noexec,relatime shared:16 - cgroup none rw,seclabel,freezer";
> +            "44 30 0:40 / /sys/fs/cgroup/freezer rw,nosuid,nodev,noexec,relatime shared:16 - cgroup none
> rw,seclabel,freezer\n";
>      private String mntInfoHybridRest = cgroupv1MountInfoLineMemory + mntInfoHybridStub;
>      private String mntInfoHybridMissingMemory = mntInfoHybridStub;
>      private String mntInfoHybrid = cgroupV2LineHybrid + mntInfoHybridRest;
> 
> Without it the generated `cgroupv1MntInfoDoubleCpuset2` file ends up containing:
> 
> 31 30 0:27 / /sys/fs/cgroup/unified rw,nosuid,nodev,noexec,relatime shared:5 - cgroup2 none rw,seclabel,nsdelegate
> 35 30 0:31 / /sys/fs/cgroup/memory rw,nosuid,nodev,noexec,relatime shared:7 - cgroup none rw,seclabel,memory
> 30 23 0:26 / /sys/fs/cgroup ro,nosuid,nodev,noexec shared:4 - tmpfs tmpfs ro,seclabel,mode=755
> 32 30 0:28 / /sys/fs/cgroup/systemd rw,nosuid,nodev,noexec,relatime shared:6 - cgroup none
> rw,seclabel,xattr,name=systemd 36 30 0:32 / /sys/fs/cgroup/pids rw,nosuid,nodev,noexec,relatime shared:8 - cgroup none
> rw,seclabel,pids 37 30 0:33 / /sys/fs/cgroup/perf_event rw,nosuid,nodev,noexec,relatime shared:9 - cgroup none
> rw,seclabel,perf_event 38 30 0:34 / /sys/fs/cgroup/net_cls,net_prio rw,nosuid,nodev,noexec,relatime shared:10 - cgroup
> none rw,seclabel,net_cls,net_prio 39 30 0:35 / /sys/fs/cgroup/hugetlb rw,nosuid,nodev,noexec,relatime shared:11 -
> cgroup none rw,seclabel,hugetlb 40 30 0:36 / /sys/fs/cgroup/cpu,cpuacct rw,nosuid,nodev,noexec,relatime shared:12 -
> cgroup none rw,seclabel,cpu,cpuacct 41 30 0:37 / /sys/fs/cgroup/devices rw,nosuid,nodev,noexec,relatime shared:13 -
> cgroup none rw,seclabel,devices 42 30 0:38 / /sys/fs/cgroup/cpuset rw,nosuid,nodev,noexec,relatime shared:14 - cgroup
> none rw,seclabel,cpuset 43 30 0:39 / /sys/fs/cgroup/blkio rw,nosuid,nodev,noexec,relatime shared:15 - cgroup none
> rw,seclabel,blkio 44 30 0:40 / /sys/fs/cgroup/freezer rw,nosuid,nodev,noexec,relatime shared:16 - cgroup none
> rw,seclabel,freezer121 32 0:37 / /cpusets rw,relatime shared:69 - cgroup none rw,cpuset which doesn't trigger the bug.

Good catch! Fixed

> src/hotspot/os/linux/cgroupSubsystem_linux.cpp line 318:
> 
>> 316:         // Skip controllers created manually or by cset/cpuset (https://github.com/lpechacek/cpuset). E.g.:
>> 317:         // 121 32 0:37 / /cpusets rw,relatime shared:69 - cgroup none rw,cpuset
>> 318:         // Controllers beloning to a Cgroup are usually mounted under "/sys/fs/cgroup" while
> 
> s/beloning/belonging/

Fixed

-------------

PR: https://git.openjdk.java.net/jdk/pull/295


More information about the hotspot-runtime-dev mailing list