summaryrefslogtreecommitdiff
path: root/src/shared/mount-util.h
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2020-01-09 15:06:06 +0100
committerLennart Poettering <lennart@poettering.net>2020-01-09 15:18:08 +0100
commit7cce68e1e042e84decae21cd5d67750235f3d539 (patch)
tree058f33fdae9568b89765e1309564eb7d64914b16 /src/shared/mount-util.h
parent8403219fc13abebde55e24c19280b1b481c68dd1 (diff)
downloadsystemd-7cce68e1e042e84decae21cd5d67750235f3d539.tar.gz
core: make sure we use the correct mount flag when re-mounting bind mounts
When in a userns environment we cannot take away per-mount point flags set on a mount point that was passed to us. Hence we need to be careful to always check the actual mount flags in place and manipulate only those flags of them that we actually want to change and not reset more as side-effect. We mostly got this right already in bind_remount_recursive_with_mountinfo(), but didn't in the simpler bind_remount_one_with_mountinfo(). Catch up. (The old code assumed that the MountEntry.flags field contained the right flag settings, but it actually doesn't for new mounts we just established as for those mount() establishes the initial flags for us, and we have to read them back to figure out which ones the kernel picked.) Fixes: #13622
Diffstat (limited to 'src/shared/mount-util.h')
-rw-r--r--src/shared/mount-util.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/shared/mount-util.h b/src/shared/mount-util.h
index 9a8d073631..06fddacf16 100644
--- a/src/shared/mount-util.h
+++ b/src/shared/mount-util.h
@@ -10,6 +10,7 @@ int repeat_unmount(const char *path, int flags);
int umount_recursive(const char *target, int flags);
int bind_remount_recursive(const char *prefix, unsigned long new_flags, unsigned long flags_mask, char **blacklist);
int bind_remount_recursive_with_mountinfo(const char *prefix, unsigned long new_flags, unsigned long flags_mask, char **blacklist, FILE *proc_self_mountinfo);
+int bind_remount_one_with_mountinfo(const char *path, unsigned long new_flags, unsigned long flags_mask, FILE *proc_self_mountinfo);
int mount_move_root(const char *path);