Re: [PATCH] vfs: use "none" if mount source is empty string

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

 



On Wed, Apr 18, 2018 at 11:18:06PM +0800, Yecheng Fu wrote:
> `libmount` from util-linux and many softwares in userspace (e.g.
> kubelet) did not expect empty string as mount source:
> 
> ```
> $ mount -t tmpfs "" /mnt/tmpfs
> $ findmnt /mnt/tmpfs
> findmnt: /proc/self/mountinfo: parse error at line 51
> $ cat /proc/self/mountinfo | grep -P '\/mnt\/tmpfs'
> 74 25 0:59 / /mnt/tmpfs rw,relatime shared:38 - tmpfs  rw
> $ cat /proc/self/mounts | grep -P '\/mnt\/tmpfs'
>  /mnt/tmpfs tmpfs rw,relatime 0 0
> ```
> 
> `source` field in mounts/mountinfo is empty, which breaks a lot of
> mounts/mountinfo parsers when user use empty string as mount source.
> 
> This fixes issues in parsing when user use empty string as mount
> source.
> 
> Cc: Karel Zak <kzak@xxxxxxxxxx>
> Signed-off-by: Yecheng Fu <cofyc.jackson@xxxxxxxxx>

What about show_vfsstat()?  Doesn't it need:

+++ b/fs/proc_namespace.c
@@ -205,7 +205,7 @@ static int show_vfsstat(struct seq_file *m, struct vfsmount *mnt)
                if (err)
                        goto out;
        } else {
-               if (r->mnt_devname) {
+               if (r->mnt_devname && r->mnt_devname[0] != '\0') {
                        seq_puts(m, "device ");
                        mangle(m, r->mnt_devname);
                } else




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

  Powered by Linux