]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
conf: verify that the rootfs can support idmapped mounts
authorChristian Brauner <christian.brauner@ubuntu.com>
Wed, 17 Mar 2021 15:43:15 +0000 (16:43 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Wed, 21 Apr 2021 08:05:59 +0000 (10:05 +0200)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/conf.c

index e3096d257cbde3dd73746469662747954a68cb32..baacf928940459d1d772800e490d893b63dac1b3 100644 (file)
@@ -494,6 +494,12 @@ int lxc_rootfs_prepare(struct lxc_rootfs *rootfs, bool userns)
        struct statfs stfs;
 
        if (!is_empty_string(rootfs->mnt_opts.userns_path)) {
+               if (!rootfs->path)
+                       return syserror_set(-EINVAL, "Idmapped rootfs currently only supported with separate rootfs for container");
+
+               if (rootfs->bdev_type && !strequal(rootfs->bdev_type, "dir"))
+                       return syserror_set(-EINVAL, "Idmapped rootfs currently only supports the \"dir\" storage driver");
+
                fd_userns = open_at(-EBADF, rootfs->mnt_opts.userns_path,
                                    PROTECT_OPEN_WITH_TRAILING_SYMLINKS, 0, 0);
                if (fd_userns < 0)