* [PATCH v2] vfs: use "none" if mount source is empty string
@ 2018-04-19 3:47 Yecheng Fu
2018-04-19 11:32 ` Matthew Wilcox
0 siblings, 1 reply; 5+ messages in thread
From: Yecheng Fu @ 2018-04-19 3:47 UTC (permalink / raw)
To: Alexander Viro, Matthew Wilcox; +Cc: linux-fsdevel, Karel Zak, Yecheng Fu
`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.
This fixes issues in parsing when user uses empty string as mount
source.
Cc: Karel Zak <kzak@redhat.com>
Signed-off-by: Yecheng Fu <cofyc.jackson@gmail.com>
---
PATCH v2 updates `show_vfsstat()` too.
fs/proc_namespace.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/proc_namespace.c b/fs/proc_namespace.c
index 3f1190d..24591b8 100644
--- a/fs/proc_namespace.c
+++ b/fs/proc_namespace.c
@@ -104,7 +104,7 @@ static int show_vfsmnt(struct seq_file *m, struct vfsmount *mnt)
if (err)
goto out;
} else {
- mangle(m, r->mnt_devname ? r->mnt_devname : "none");
+ mangle(m, (r->mnt_devname && r->mnt_devname[0] != '\0') ? r->mnt_devname : "none");
}
seq_putc(m, ' ');
/* mountpoints outside of chroot jail will give SEQ_SKIP on this */
@@ -174,7 +174,7 @@ static int show_mountinfo(struct seq_file *m, struct vfsmount *mnt)
if (err)
goto out;
} else {
- mangle(m, r->mnt_devname ? r->mnt_devname : "none");
+ mangle(m, (r->mnt_devname && r->mnt_devname[0] != '\0') ? r->mnt_devname : "none");
}
seq_puts(m, sb->s_flags & MS_RDONLY ? " ro" : " rw");
err = show_sb_opts(m, sb);
@@ -202,7 +202,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
--
Yecheng Fu
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2] vfs: use "none" if mount source is empty string
2018-04-19 3:47 [PATCH v2] vfs: use "none" if mount source is empty string Yecheng Fu
@ 2018-04-19 11:32 ` Matthew Wilcox
2018-05-15 5:18 ` Yecheng Fu
0 siblings, 1 reply; 5+ messages in thread
From: Matthew Wilcox @ 2018-04-19 11:32 UTC (permalink / raw)
To: Yecheng Fu; +Cc: Alexander Viro, linux-fsdevel, Karel Zak
On Thu, Apr 19, 2018 at 11:47:21AM +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.
>
> This fixes issues in parsing when user uses empty string as mount
> source.
>
> Cc: Karel Zak <kzak@redhat.com>
> Signed-off-by: Yecheng Fu <cofyc.jackson@gmail.com>
Reviewed-by: Matthew Wilcox <mawilcox@microsoft.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] vfs: use "none" if mount source is empty string
2018-04-19 11:32 ` Matthew Wilcox
@ 2018-05-15 5:18 ` Yecheng Fu
2018-07-12 2:29 ` Yecheng Fu
0 siblings, 1 reply; 5+ messages in thread
From: Yecheng Fu @ 2018-05-15 5:18 UTC (permalink / raw)
To: Matthew Wilcox; +Cc: Alexander Viro, linux-fsdevel, Karel Zak
On Thu, Apr 19, 2018 at 04:32:56AM -0700, Matthew Wilcox wrote:
> On Thu, Apr 19, 2018 at 11:47:21AM +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.
> >
> > This fixes issues in parsing when user uses empty string as mount
> > source.
> >
> > Cc: Karel Zak <kzak@redhat.com>
> > Signed-off-by: Yecheng Fu <cofyc.jackson@gmail.com>
>
> Reviewed-by: Matthew Wilcox <mawilcox@microsoft.com>
hi, I'm a newbie here. Will this be merged or is there still something I
need to do?
I had submitted a patch to [util-linux](https://github.com/karelzak/util-linux/pull/619). Karel prefer kernel side bugfix than rewrite all the sscanf() stuff and I agree. Kernel side bugfix also fixes all parsers too.
--
Yecheng Fu
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] vfs: use "none" if mount source is empty string
2018-05-15 5:18 ` Yecheng Fu
@ 2018-07-12 2:29 ` Yecheng Fu
2018-07-12 8:43 ` Karel Zak
0 siblings, 1 reply; 5+ messages in thread
From: Yecheng Fu @ 2018-07-12 2:29 UTC (permalink / raw)
To: Matthew Wilcox, Alexander Viro; +Cc: linux-fsdevel, Karel Zak
On Tue, May 15, 2018 at 01:18:00PM +0800, Yecheng Fu wrote:
> On Thu, Apr 19, 2018 at 04:32:56AM -0700, Matthew Wilcox wrote:
> > On Thu, Apr 19, 2018 at 11:47:21AM +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.
> > >
> > > This fixes issues in parsing when user uses empty string as mount
> > > source.
> > >
> > > Cc: Karel Zak <kzak@redhat.com>
> > > Signed-off-by: Yecheng Fu <cofyc.jackson@gmail.com>
> >
> > Reviewed-by: Matthew Wilcox <mawilcox@microsoft.com>
>
> hi, I'm a newbie here. Will this be merged or is there still something I
> need to do?
>
> I had submitted a patch to [util-linux](https://github.com/karelzak/util-linux/pull/619). Karel prefer kernel side bugfix than rewrite all the sscanf() stuff and I agree. Kernel side bugfix also fixes all parsers too.
>
> --
> Yecheng Fu
hi, didn't receive any updates for months, sorry to ping again in case
someone missed it.
Karel patched util-linux to work around this issue now [^1], but I hope this
can be fixed on kernel side too to improve compatibility.
[^1]: https://github.com/karelzak/util-linux/commit/18a52a5094f820b5da013daf5972eb8e65be9680
--
Yecheng Fu
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] vfs: use "none" if mount source is empty string
2018-07-12 2:29 ` Yecheng Fu
@ 2018-07-12 8:43 ` Karel Zak
0 siblings, 0 replies; 5+ messages in thread
From: Karel Zak @ 2018-07-12 8:43 UTC (permalink / raw)
To: Yecheng Fu; +Cc: Matthew Wilcox, Alexander Viro, linux-fsdevel
On Thu, Jul 12, 2018 at 10:29:50AM +0800, Yecheng Fu wrote:
> On Tue, May 15, 2018 at 01:18:00PM +0800, Yecheng Fu wrote:
> > On Thu, Apr 19, 2018 at 04:32:56AM -0700, Matthew Wilcox wrote:
> > > On Thu, Apr 19, 2018 at 11:47:21AM +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.
> > > >
> > > > This fixes issues in parsing when user uses empty string as mount
> > > > source.
> > > >
> > > > Cc: Karel Zak <kzak@redhat.com>
> > > > Signed-off-by: Yecheng Fu <cofyc.jackson@gmail.com>
> > >
> > > Reviewed-by: Matthew Wilcox <mawilcox@microsoft.com>
> >
> > hi, I'm a newbie here. Will this be merged or is there still something I
> > need to do?
> >
> > I had submitted a patch to [util-linux](https://github.com/karelzak/util-linux/pull/619). Karel prefer kernel side bugfix than rewrite all the sscanf() stuff and I agree. Kernel side bugfix also fixes all parsers too.
> >
> > --
> > Yecheng Fu
>
> hi, didn't receive any updates for months, sorry to ping again in case
> someone missed it.
>
> Karel patched util-linux to work around this issue now [^1], but I hope this
> can be fixed on kernel side too to improve compatibility.
I agree. I'm absolutely sure that in userspace are many many another
places where nobody expects empty mount source in /proc/self/mountinfo.
It would be really nice to use there "none" as placeholder.
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-07-12 8:52 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-19 3:47 [PATCH v2] vfs: use "none" if mount source is empty string Yecheng Fu
2018-04-19 11:32 ` Matthew Wilcox
2018-05-15 5:18 ` Yecheng Fu
2018-07-12 2:29 ` Yecheng Fu
2018-07-12 8:43 ` Karel Zak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).