UML mount failure with Linux 6.11
Hongbo Li
lihongbo22 at huawei.com
Tue Nov 12 17:23:45 PST 2024
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.
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
>
>
More information about the linux-um
mailing list