Skip to contentSkip to conversation

virtiofs queue

GIT PULL Applied Dr. David Alan Gilbert (git) 2 participants 7 messages Feb 10, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

From: "Dr. David Alan Gilbert" <[email protected]>

The following changes since commit 2b8a51cdb3e8d15a5c35de7a2e76a813ae7358f0:

Merge remote-tracking branch 'remotes/gkurz/tags/9p-next-2020-02-08' into staging (2020-02-10 16:07:29 +0000)

are available in the Git repository at:

https://gitlab.com/dagrh/qemu.git tags/pull-virtiofs-20200210

for you to fetch changes up to 6a7e2bbee5fa5f167959f05319550d2a49a6b8bb:

docs: add virtiofsd(1) man page (2020-02-10 17:25:52 +0000)

----------------------------------------------------------------
virtiofsd pull 2020-02-10

Coverity fixes and a reworked man page.

----------------------------------------------------------------
Dr. David Alan Gilbert (4):
virtiofsd: Remove fuse_req_getgroups
virtiofsd: fv_create_listen_socket error path socket leak
virtiofsd: load_capng missing unlock
virtiofsd: do_read missing NULL check

Stefan Hajnoczi (1):
docs: add virtiofsd(1) man page

 MAINTAINERS                      |   1 +
 Makefile                         |   9 ++-
 docs/interop/conf.py             |   5 +-
 docs/interop/index.rst           |   1 +
 docs/interop/virtiofsd.rst       | 120 +++++++++++++++++++++++++++++++++++++++
 tools/virtiofsd/fuse.h           |  20 -------
 tools/virtiofsd/fuse_lowlevel.c  |  81 ++------------------------
 tools/virtiofsd/fuse_lowlevel.h  |  21 -------
 tools/virtiofsd/fuse_virtio.c    |   2 +
 tools/virtiofsd/passthrough_ll.c |   1 +
 10 files changed, 141 insertions(+), 120 deletions(-)
 create mode 100644 docs/interop/virtiofsd.rst
#1 lore raw

[PULL 2/5] virtiofsd: fv_create_listen_socket error path socket leak

From: "Dr. David Alan Gilbert" <[email protected]>

If we fail when bringing up the socket we can leak the listen_fd; in practice the daemon will exit so it's not really a problem.

---
 tools/virtiofsd/fuse_virtio.c | 2 ++
 1 file changed, 2 insertions(+)
tools/virtiofsd/fuse_virtio.c +2 -0
index 80a6e929df..dd1c605dbf 100644
@@ -916,6 +916,7 @@ static int fv_create_listen_socket(struct fuse_session *se)
     old_umask = umask(0077);
     if (bind(listen_sock, (struct sockaddr *)&un, addr_len) == -1) {
         fuse_log(FUSE_LOG_ERR, "vhost socket bind: %m\n");
+        close(listen_sock);
         umask(old_umask);
         return -1;
     }
@@ -923,6 +924,7 @@ static int fv_create_listen_socket(struct fuse_session *se)
 
     if (listen(listen_sock, 1) == -1) {
         fuse_log(FUSE_LOG_ERR, "vhost socket listen: %m\n");
+        close(listen_sock);
         return -1;
     }
 
Signature · 1 line
2.24.1
#2 lore raw

[PULL 3/5] virtiofsd: load_capng missing unlock

In reply to Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

Missing unlock in error path.

---
 tools/virtiofsd/passthrough_ll.c | 1 +
 1 file changed, 1 insertion(+)
tools/virtiofsd/passthrough_ll.c +1 -0
index e6f2399efc..c635fc8820 100644
@@ -232,6 +232,7 @@ static int load_capng(void)
          */
         cap.saved = capng_save_state();
         if (!cap.saved) {
+            pthread_mutex_unlock(&cap.mutex);
             fuse_log(FUSE_LOG_ERR, "capng_save_state (thread)\n");
             return -EINVAL;
         }
Signature · 1 line
2.24.1
#3 lore raw

[PULL 5/5] docs: add virtiofsd(1) man page

In reply to Dr. David Alan Gilbert (git)

From: Stefan Hajnoczi <[email protected]>

Document the virtiofsd(1) program and its command-line options. This man page is a rST conversion of the original texi documentation that I wrote.

---
 MAINTAINERS                |   1 +
 Makefile                   |   9 ++-
 docs/interop/conf.py       |   5 +-
 docs/interop/index.rst     |   1 +
 docs/interop/virtiofsd.rst | 120 +++++++++++++++++++++++++++++++++++++
 5 files changed, 134 insertions(+), 2 deletions(-)
 create mode 100644 docs/interop/virtiofsd.rst
MAINTAINERS +1 -0
index ce46c0a552..c7717df720 100644
@@ -1613,6 +1613,7 @@ S: Supported
 F: tools/virtiofsd/*
 F: hw/virtio/vhost-user-fs*
 F: include/hw/virtio/vhost-user-fs.h
+F: docs/interop/virtiofsd.rst
 
 virtio-input
 M: Gerd Hoffmann <[email protected]>
Makefile +8 -1
index 461d40bea6..f0e1a2fc1d 100644
@@ -348,6 +348,9 @@ DOCS=qemu-doc.html qemu-doc.txt qemu.1
 DOCS+=$(MANUAL_BUILDDIR)/interop/qemu-img.1
 DOCS+=$(MANUAL_BUILDDIR)/interop/qemu-nbd.8
 DOCS+=$(MANUAL_BUILDDIR)/interop/qemu-ga.8
+ifeq ($(CONFIG_LINUX)$(CONFIG_SECCOMP)$(CONFIG_LIBCAP_NG),yyy)
+DOCS+=$(MANUAL_BUILDDIR)/interop/virtiofsd.1
+endif
 DOCS+=$(MANUAL_BUILDDIR)/system/qemu-block-drivers.7
 DOCS+=docs/interop/qemu-qmp-ref.html docs/interop/qemu-qmp-ref.txt docs/interop/qemu-qmp-ref.7
 DOCS+=docs/interop/qemu-ga-ref.html docs/interop/qemu-ga-ref.txt docs/interop/qemu-ga-ref.7
@@ -861,6 +864,9 @@ ifdef CONFIG_VIRTFS
 	$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
 	$(INSTALL_DATA) $(MANUAL_BUILDDIR)/interop/virtfs-proxy-helper.1 "$(DESTDIR)$(mandir)/man1"
 endif
+ifeq ($(CONFIG_LINUX)$(CONFIG_SECCOMP)$(CONFIG_LIBCAP_NG),yyy)
+	$(INSTALL_DATA) docs/interop/virtiofsd.1 "$(DESTDIR)$(mandir)/man1"
+endif
 
 install-datadir:
 	$(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)"
@@ -1051,7 +1057,8 @@ $(MANUAL_BUILDDIR)/system/index.html: $(call manual-deps,system)
 	$(call build-manual,system,html)
 
 $(call define-manpage-rule,interop,\
-       qemu-ga.8 qemu-img.1 qemu-nbd.8 qemu-trace-stap.1 virtfs-proxy-helper.1,\
+       qemu-ga.8 qemu-img.1 qemu-nbd.8 qemu-trace-stap.1\
+       virtiofsd.1 virtfs-proxy-helper.1,\
        $(SRC_PATH/qemu-img-cmds.hx))
 
 $(call define-manpage-rule,system,qemu-block-drivers.7)
docs/interop/conf.py +4 -1
index b0f322207c..b3cda17042 100644
@@ -27,5 +27,8 @@ man_pages = [
      [], 1),
     ('virtfs-proxy-helper', 'virtfs-proxy-helper',
      u'QEMU 9p virtfs proxy filesystem helper',
-     ['M. Mohan Kumar'], 1)
+     ['M. Mohan Kumar'], 1),
+    ('virtiofsd', 'virtiofsd', u'QEMU virtio-fs shared file system daemon',
+     ['Stefan Hajnoczi <[email protected]>',
+      'Masayoshi Mizuma <[email protected]>'], 1),
 ]
docs/interop/index.rst +1 -0
index 3b763b1eeb..e8455b4270 100644
@@ -24,3 +24,4 @@ Contents:
    vhost-user
    vhost-user-gpu
    virtfs-proxy-helper
+   virtiofsd
docs/interop/virtiofsd.rst new file +120 -0

120 lines not on this page · raw message

Signature · 1 line
2.24.1
#4 lore raw

[PULL 4/5] virtiofsd: do_read missing NULL check

In reply to Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

Missing a NULL check if the argument fetch fails.

---
 tools/virtiofsd/fuse_lowlevel.c | 4 ++++
 1 file changed, 4 insertions(+)
tools/virtiofsd/fuse_lowlevel.c +4 -0
index 01c418aade..704c0369b2 100644
@@ -1116,6 +1116,10 @@ static void do_read(fuse_req_t req, fuse_ino_t nodeid,
         struct fuse_file_info fi;
 
         arg = fuse_mbuf_iter_advance(iter, sizeof(*arg));
+        if (!arg) {
+            fuse_reply_err(req, EINVAL);
+            return;
+        }
 
         memset(&fi, 0, sizeof(fi));
         fi.fh = arg->fh;
Signature · 1 line
2.24.1
#5 lore raw

[PULL 1/5] virtiofsd: Remove fuse_req_getgroups

In reply to Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

Remove fuse_req_getgroups that's unused in virtiofsd; it came in from libfuse but we don't actually use it. It was called from fuse_getgroups which we previously removed (but had left it's header in).

Coverity had complained about null termination in it, but removing it is the easiest answer.

Fixes Coverity CID: 1413117 (String not null terminated)
---
 tools/virtiofsd/fuse.h          | 20 ---------
 tools/virtiofsd/fuse_lowlevel.c | 77 ---------------------------------
 tools/virtiofsd/fuse_lowlevel.h | 21 ---------
 3 files changed, 118 deletions(-)
tools/virtiofsd/fuse.h +0 -20
index 7a4c713559..aba13fef2d 100644
@@ -1006,26 +1006,6 @@ void fuse_exit(struct fuse *f);
  */
 struct fuse_context *fuse_get_context(void);
 
-/**
- * Get the current supplementary group IDs for the current request
- *
- * Similar to the getgroups(2) system call, except the return value is
- * always the total number of group IDs, even if it is larger than the
- * specified size.
- *
- * The current fuse kernel module in linux (as of 2.6.30) doesn't pass
- * the group list to userspace, hence this function needs to parse
- * "/proc/$TID/task/$TID/status" to get the group IDs.
- *
- * This feature may not be supported on all operating systems.  In
- * such a case this function will return -ENOSYS.
- *
- * @param size size of given array
- * @param list array of group IDs to be filled in
- * @return the total number of supplementary group IDs or -errno on failure
- */
-int fuse_getgroups(int size, gid_t list[]);
-
 /**
  * Check if the current request has already been interrupted
  *
tools/virtiofsd/fuse_lowlevel.c +0 -77

83 lines not on this page · raw message

tools/virtiofsd/fuse_lowlevel.h +0 -21
index 138041e5f1..8f6d705b5c 100644
@@ -1704,27 +1704,6 @@ void *fuse_req_userdata(fuse_req_t req);
  */
 const struct fuse_ctx *fuse_req_ctx(fuse_req_t req);
 
-/**
- * Get the current supplementary group IDs for the specified request
- *
- * Similar to the getgroups(2) system call, except the return value is
- * always the total number of group IDs, even if it is larger than the
- * specified size.
- *
- * The current fuse kernel module in linux (as of 2.6.30) doesn't pass
- * the group list to userspace, hence this function needs to parse
- * "/proc/$TID/task/$TID/status" to get the group IDs.
- *
- * This feature may not be supported on all operating systems.  In
- * such a case this function will return -ENOSYS.
- *
- * @param req request handle
- * @param size size of given array
- * @param list array of group IDs to be filled in
- * @return the total number of supplementary group IDs or -errno on failure
- */
-int fuse_req_getgroups(fuse_req_t req, int size, gid_t list[]);
-
 /**
  * Callback function for an interrupt
  *
Signature · 1 line
2.24.1
#6 lore raw
In reply to Dr. David Alan Gilbert (git)
Quoted 27 lines · Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

The following changes since commit 2b8a51cdb3e8d15a5c35de7a2e76a813ae7358f0:

Merge remote-tracking branch 'remotes/gkurz/tags/9p-next-2020-02-08' into staging (2020-02-10 16:07:29 +0000)

are available in the Git repository at:

https://gitlab.com/dagrh/qemu.git tags/pull-virtiofs-20200210

for you to fetch changes up to 6a7e2bbee5fa5f167959f05319550d2a49a6b8bb:

docs: add virtiofsd(1) man page (2020-02-10 17:25:52 +0000)

----------------------------------------------------------------
virtiofsd pull 2020-02-10

Coverity fixes and a reworked man page.

----------------------------------------------------------------
Dr. David Alan Gilbert (4):
virtiofsd: Remove fuse_req_getgroups
virtiofsd: fv_create_listen_socket error path socket leak
virtiofsd: load_capng missing unlock
virtiofsd: do_read missing NULL check

Quoted 2 lines

Stefan Hajnoczi (1):
docs: add virtiofsd(1) man page

Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/5.0
for any user-visible changes.

-- PMM