Re: UML mount failure with Linux 6.11

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 2024/11/13 9:23, Hongbo Li wrote:


On 2024/11/13 4:10, Karel Zak wrote:

  Hi,

On Mon, Nov 11, 2024 at 09:16:18AM GMT, Hongbo Li wrote:
We are discussing about the hostfs mount with new mount API in [1]. And may
need your help.

After finishing the conversion to the new mount API for hostfs, it
encountered a situation where the old version supported only one mount
option, and the whole mount option was used as the root path (it is also
valid for the path to contain commas). But when switching to the new mount API, the option part will be split using commas (if I'm not mistaken, this step would be done in libmount), which could potentially split a complete
path into multiple parts, and the call fsconfig syscall to set the mount
options for underline filesystems. This is different from the original
intention of hostfs. And this kind of situation is not common in other
filesystems.

The options has been always parsed by mount(8) and it's very fragile
to assume that kernel get as in the original order (etc.).

For decades, commas have been supported in mount options. For example,
SeLinux uses them frequently in context settings. All you need to do
is use quotes, but be careful because the shell will strip them off.
Therefore, double quoting is required.


Thanks for your reply!

If I'm not mistaken, we should add double quoting explicitly if we need commas in mount options. However, it seems different for hostfs. For example, with hostfs, if we use "mount -t hostfs none -o /home/hostfs,dir /mnt" in the older interface, which can successfully mount the host directory `/home/hostfs,dir`, then we should use "mount -t hostfs none -o '"/home/hostfs,dir"' /mnt" in the new interface. If that is the case, we should change the mount command which is hardcoded in the original project.
Sorry for the disturbance. So am I right?

Thanks,
Hongbo


Thanks,
Hongbo

    mount -o 'rw,bbb="this,is,value",ccc'

It's also supported in fstab, just use name="v,a,l,u,e"

You can try it:

  # strace -e fsconfig mount -t tmpfs -o 'rw,bbb="this,is,value",ccc' tmpfs /dontexist

  fsconfig(3, FSCONFIG_SET_STRING, "source", "tmpfs", 0) = 0
  fsconfig(3, FSCONFIG_SET_FLAG, "rw", NULL, 0) = 0
  fsconfig(3, FSCONFIG_SET_STRING, "bbb", "this,is,value", 0) = -1 EINVAL

You can see the expected result when using fsconfig().

  Karel








[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux