jail: fix some more mount options
authorDaniel Golle <daniel@makrotopia.org>
Thu, 16 Jul 2020 12:14:51 +0000 (13:14 +0100)
committerDaniel Golle <daniel@makrotopia.org>
Thu, 16 Jul 2020 12:14:51 +0000 (13:14 +0100)
Make sure 'rbind' works as expected and add support for 'iversion' and
'noiversion' options.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
jail/fs.c

index da6f588ea711ef19045573e4221be8fb6b46f138..352fa0d087233b735db502062d1d5b189d7f3cf9 100644 (file)
--- a/jail/fs.c
+++ b/jail/fs.c
@@ -104,7 +104,7 @@ static int do_mount(const char *root, const char *source, const char *target, co
        }
 
        if (mountflags & MS_BIND) {
-               if (mount(source, new, filesystemtype, MS_BIND, optstr)) {
+               if (mount(source, new, filesystemtype, MS_BIND | (mountflags & MS_REC), optstr)) {
                        ERROR("failed to mount -B %s %s: %m\n", source, new);
                        return error;
                }
@@ -217,6 +217,10 @@ static int parseOCImountopts(struct blob_attr *msg, unsigned long *mount_flags,
                        mf &= ~MS_NODEV;
                else if (!strcmp("nodev", tmp))
                        mf |= MS_NODEV;
+               else if (!strcmp("iversion", tmp))
+                       mf |= MS_I_VERSION;
+               else if (!strcmp("noiversion", tmp))
+                       mf &= ~MS_I_VERSION;
                else if (!strcmp("diratime", tmp))
                        mf &= ~MS_NODIRATIME;
                else if (!strcmp("nodiratime", tmp))