aboutsummaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@suse.cz>2011-07-15 14:49:21 +0200
committerJohn Rigby <john.rigby@linaro.org>2011-11-16 14:25:04 -0700
commitab5147b0239c30d8d42c9fa9464e4b92aa544e44 (patch)
tree6d09e0a1e4c11c8e3bca3d16174013421940ad93 /fs
parent64c9efed874cf221fb117a45d7a2461d886c5f38 (diff)
downloadlinux-linaro-precise-ab5147b0239c30d8d42c9fa9464e4b92aa544e44.tar.gz
UBUNTU: ubuntu: overlayfs -- ovl: make lower mount read-only
If a file only existing on the lower fs is operned for O_RDONLY and fchmod/fchown/etc is performed on the open file then this will modify the lower fs, which is not what we want. Copying up at this point is not possible. The best solution is to return an error for this corner case and hope applications are not relying on it. Reported-by: "J. R. Okajima" <hooanon05@yahoo.co.jp> Signed-off-by: Miklos Szeredi <mszeredi@suse.cz> Signed-off-by: Andy Whitcroft <apw@canonical.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/overlayfs/super.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
index a64f0f4820e..508cf19a217 100644
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -569,6 +569,12 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent)
goto out_put_upper_mnt;
}
+ /*
+ * Make lower_mnt R/O. That way fchmod/fchown on lower file
+ * will fail instead of modifying lower fs.
+ */
+ ufs->lower_mnt->mnt_flags |= MNT_READONLY;
+
/* If the upper fs is r/o, we mark overlayfs r/o too */
if (ufs->upper_mnt->mnt_sb->s_flags & MS_RDONLY)
sb->s_flags |= MS_RDONLY;