]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
cgfsng: use safe_mount_beneath()
authorChristian Brauner <christian.brauner@ubuntu.com>
Sun, 9 Aug 2020 13:48:35 +0000 (15:48 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Sun, 9 Aug 2020 17:52:31 +0000 (19:52 +0200)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/cgroups/cgfsng.c

index 8d9e3d5117780db06b3d5057e9abaf6ecbe99f53..85afc63af91547a297e0646577f5672ec41d7322 100644 (file)
@@ -1872,9 +1872,17 @@ __cgfsng_ops static bool cgfsng_mount(struct cgroup_ops *ops,
        }
 
        /* mount tmpfs */
-       ret = safe_mount(NULL, cgroup_root, "tmpfs",
-                        MS_NOSUID | MS_NODEV | MS_NOEXEC | MS_RELATIME,
-                        "size=10240k,mode=755", root);
+       ret = safe_mount_beneath(root, NULL, DEFAULT_CGROUP_MOUNTPOINT, "tmpfs",
+                                MS_NOSUID | MS_NODEV | MS_NOEXEC | MS_RELATIME,
+                                "size=10240k,mode=755");
+       if (ret < 0) {
+               if (errno != ENOSYS)
+                       return false;
+
+               ret = safe_mount(NULL, cgroup_root, "tmpfs",
+                                MS_NOSUID | MS_NODEV | MS_NOEXEC | MS_RELATIME,
+                                "size=10240k,mode=755", root);
+       }
        if (ret < 0)
                return false;