diff options
author | Miklos Szeredi <mszeredi@suse.cz> | 2011-07-15 14:49:21 +0200 |
---|---|---|
committer | John Rigby <john.rigby@linaro.org> | 2011-09-23 08:54:09 -0600 |
commit | ac0998a456493e30e497fb6f94102b6d34554a0f (patch) | |
tree | 211094e82d4caa2078d6655e232b853504cc7a85 /fs | |
parent | 1e8e747f9cd859ad26bd694279c5af3c6173bd07 (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.c | 6 |
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; |