Skip to content

Fixing unprivileged mount -o remount,ro

Eric W. Biederman containers 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 8 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5mnt: Only change user settable mount flags in remountfs/namespace.c include/linux/mount.h+4 -22 replies
2/5mnt: Move the test for MNT_LOCK_READONLY from change_mount_flags into do_remountfs/namespace.c+10 -31 reply
3/5mnt: Correct permission checks in do_remountfs/namespace.c include/linux/mount.h+38 -31 reply
4/5mnt: Change the default remount atime from relatime to the existing valuefs/namespace.c+8 -01 reply
5/5mnt: Add tests for unprivileged remount cases that have found to be faultytools/testing/selftests/Makefile tools/testing/selftests/mount/Makefile tools/testing/selftests/mount/unprivileged-remount-test.c+260 -03 replies

Reviews trailers per patch

All 5 patches have a Reviewed-by or Acked-by.

PatchSerge E. Hallyn
1/5A-b
2/5A-b
3/5A-b
4/5A-b
5/5A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [REVIEW][0/5] Fixing unprivileged mount -o remount,ro

This patchset addresses a nasty bug where
"unshare --user --mount mount --bind -o remount,ro /path" would allow a following "mount --bind -o remount,rw" to succeed even when /path started out read-only in the initial mount namespace.

The fixes are quite simple and since they are user namespace specific I plan on carrying them in my user namespace tree and ultimately pushing them to Linus.

If anyone has any concerns about the code before I do that please speak up so the issues can be addressed.

Eric W. Biederman (5):
mnt: Only change user settable mount flags in remount
mnt: Move the test for MNT_LOCK_READONLY from change_mount_flags into do_remount
mnt: Correct permission checks in do_remount
mnt: Change the default remount atime from relatime to the existing value
mnt: Add tests for unprivileged remount cases that have found to be faulty

 fs/namespace.c                                     |  59 ++++-
 include/linux/mount.h                              |   9 +-
 tools/testing/selftests/Makefile                   |   1 +
 tools/testing/selftests/mount/Makefile             |  17 ++
 .../selftests/mount/unprivileged-remount-test.c    | 242 +++++++++++++++++++++
 5 files changed, 320 insertions(+), 8 deletions(-)

Eric