[Toybox] [PATCH] Support mount -o private mountpoint

Yi-yo Chiang yochiang at google.com
Tue Jun 21 09:30:58 PDT 2022


`mount -o private mountpoint` should change the mount propagation type
of mountpoint to MS_PRIVATE. This didn't work because it falls into
the "read /etc/fstab" branch (one argument), and fails when mountpoint
is not found in the fstab, or fstab is not found (Android case).

`mount -o private blah mountpoint` kind of works, as long as `blah`
doesn't look like a directory, otherwise toybox would assume bind mount
and MS_BIND would win over MS_PRIVATE.

Even if `blah mountpoint` looks sufficient unlike a bind mount, the
underlying mount() syscall would be a bit off,
  mount(blah, mountpoint, "ext3", MS_SILENT|MS_PRIVATE, "")

The "ext3" (or whatever comes first in /proc/filesystems) is because
unspecified `-t` defaults to `-t auto`, which means "try mount FS in
/proc/filesystems one-by-one", which is not what we want here. We don't
want to mount anything, but change an existing mountpoint's propagation
type.

This patch adds "mount -o private mountpoint" machinery and unit test.

-- 

Yi-yo Chiang
Software Engineer
yochiang at google.com

I support flexible work schedules, and I’m sending this email now because
it is within the hours I’m working today. Please do not feel obliged to
reply straight away - I understand that you will reply during the hours you
work, which may not match mine.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20220622/34dfc781/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Support-mount-o-private-mountpoint.patch
Type: text/x-patch
Size: 5233 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20220622/34dfc781/attachment-0001.bin>


More information about the Toybox mailing list