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-09-23 08:54:09 -0600
commitac0998a456493e30e497fb6f94102b6d34554a0f (patch)
tree211094e82d4caa2078d6655e232b853504cc7a85 /fs
parent1e8e747f9cd859ad26bd694279c5af3c6173bd07 (diff)
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;