diff options
author | Karel Zak <kzak@redhat.com> | 2010-08-27 12:22:27 +0200 |
---|---|---|
committer | Karel Zak <kzak@redhat.com> | 2010-08-27 12:22:27 +0200 |
commit | 0828125895f7323e39b87673dbdbef4c70da5fdb (patch) | |
tree | 77569e6303f1cf72ca2ad123dbd61d3fe56ecf66 /mount | |
parent | 5adaf9f120131f030ce15c5a312746059608e762 (diff) | |
download | util-linux-old-0828125895f7323e39b87673dbdbef4c70da5fdb.tar.gz |
mount: sanity check mount flags for MS_PROPAGATION
mount(8) reuses mount flags from fstab/mtab, the problem is that for
MS_PROPAGATION operations kernel incorrectly evaluates mount flags if
the flags contains any non-propagation stuff (e.g. MS_RDONLY). For
example --make-shared on read-only FS:
# strace -e mount mount --make-shared /mnt/test
mount("/dev/sda1", "/mnt/test", "none", MS_RDONLY|MS_SHARED, NULL) = 0
must be:
# strace -e mount mount --make-shared /mnt/test
mount("/dev/sda1", "/mnt/test", "none", MS_SHARED, NULL) = 0
Reported-by: Valerie Aurora <vaurora@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'mount')
-rw-r--r-- | mount/mount.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/mount/mount.c b/mount/mount.c index 2e819e95..f2b6ee23 100644 --- a/mount/mount.c +++ b/mount/mount.c @@ -491,9 +491,11 @@ parse_opts (const char *options, int *flags, char **extra_opts) { if (readwrite) *flags &= ~MS_RDONLY; - if (mounttype & MS_PROPAGATION) - *flags &= ~MS_BIND; *flags |= mounttype; + + /* The propagation flags should not be used together with any other flags */ + if (*flags & MS_PROPAGATION) + *flags &= MS_PROPAGATION; } /* Try to build a canonical options string. */ |