Commit 80d4d8397a96b79d4562f68596ba33432ab47cd1

Authored by Eric W. Biederman
Committed by Greg Kroah-Hartman
1 parent 16811f0192

mnt: Implicitly add MNT_NODEV on remount when it was implicitly added by mount

commit 3e1866410f11356a9fd869beb3e95983dc79c067 upstream.

Now that remount is properly enforcing the rule that you can't remove
nodev at least sandstorm.io is breaking when performing a remount.

It turns out that there is an easy intuitive solution implicitly
add nodev on remount when nodev was implicitly added on mount.

Tested-by: Cedric Bosdonnat <cbosdonnat@suse.com>
Tested-by: Richard Weinberger <richard@nod.at>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Showing 1 changed file with 7 additions and 1 deletions Side-by-side Diff

... ... @@ -2100,7 +2100,13 @@
2100 2100 }
2101 2101 if ((mnt->mnt.mnt_flags & MNT_LOCK_NODEV) &&
2102 2102 !(mnt_flags & MNT_NODEV)) {
2103   - return -EPERM;
  2103 + /* Was the nodev implicitly added in mount? */
  2104 + if ((mnt->mnt_ns->user_ns != &init_user_ns) &&
  2105 + !(sb->s_type->fs_flags & FS_USERNS_DEV_MOUNT)) {
  2106 + mnt_flags |= MNT_NODEV;
  2107 + } else {
  2108 + return -EPERM;
  2109 + }
2104 2110 }
2105 2111 if ((mnt->mnt.mnt_flags & MNT_LOCK_NOSUID) &&
2106 2112 !(mnt_flags & MNT_NOSUID)) {