qemu-commits
[Top][All Lists]
Advanced

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

[Qemu-commits] [qemu/qemu] 0adb3a: virtiofsd: Fix side-effect in assert(


From: Peter Maydell
Subject: [Qemu-commits] [qemu/qemu] 0adb3a: virtiofsd: Fix side-effect in assert()
Date: Tue, 11 May 2021 08:07:09 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 0adb3aff3932d05b069bd2cb13480f1611cce654
      
https://github.com/qemu/qemu/commit/0adb3aff3932d05b069bd2cb13480f1611cce654
  Author: Greg Kurz <groug@kaod.org>
  Date:   2021-05-06 (Thu, 06 May 2021)

  Changed paths:
    M tools/virtiofsd/passthrough_ll.c

  Log Message:
  -----------
  virtiofsd: Fix side-effect in assert()

It is bad practice to put an expression with a side-effect in
assert() because the side-effect won't happen if the code is
compiled with -DNDEBUG.

Use an intermediate variable. Consolidate this in an macro to
have proper line numbers when the assertion is hit.

virtiofsd: ../../tools/virtiofsd/passthrough_ll.c:2797: lo_getxattr:
 Assertion `fchdir_res == 0' failed.
Aborted

  2796          /* fchdir should not fail here */
=>2797          FCHDIR_NOFAIL(lo->proc_self_fd);
  2798          ret = getxattr(procname, name, value, size);
  2799          FCHDIR_NOFAIL(lo->root.fd);

Fixes: bdfd66788349 ("virtiofsd: Fix xattr operations")
Cc: misono.tomohiro@jp.fujitsu.com
Signed-off-by: Greg Kurz <groug@kaod.org>
Message-Id: <20210409100627.451573-1-groug@kaod.org>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>


  Commit: a87d29e0d7879c7284a9441de1252f458bca6c2e
      
https://github.com/qemu/qemu/commit/a87d29e0d7879c7284a9441de1252f458bca6c2e
  Author: Carlos Venegas <jose.carlos.venegas.munoz@intel.com>
  Date:   2021-05-06 (Thu, 06 May 2021)

  Changed paths:
    M tools/virtiofsd/passthrough_ll.c

  Log Message:
  -----------
  virtiofsd: Allow use "-o xattrmap" without "-o xattr"

When -o xattrmap is used, it will not work unless xattr is enabled.

This patch enables xattr when -o xattrmap is used.

Signed-off-by: Carlos Venegas <jose.carlos.venegas.munoz@intel.com>
Message-Id: <20210414201207.3612432-2-jose.carlos.venegas.munoz@intel.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Connor Kuehl <ckuehl@redhat.com>


  Commit: 1221a929be9c91e679f1983c5f1af5052f309d60
      
https://github.com/qemu/qemu/commit/1221a929be9c91e679f1983c5f1af5052f309d60
  Author: Carlos Venegas <jose.carlos.venegas.munoz@intel.com>
  Date:   2021-05-06 (Thu, 06 May 2021)

  Changed paths:
    M tools/virtiofsd/helper.c

  Log Message:
  -----------
  virtiofsd: Add help for -o xattr-mapping

The option is not documented in help.

Add small help about the option.

Signed-off-by: Carlos Venegas <jose.carlos.venegas.munoz@intel.com>
Message-Id: <20210414201207.3612432-3-jose.carlos.venegas.munoz@intel.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Connor Kuehl <ckuehl@redhat.com>


  Commit: d02a3c5a1b3d579eec0531b9453a6beb5189edad
      
https://github.com/qemu/qemu/commit/d02a3c5a1b3d579eec0531b9453a6beb5189edad
  Author: Dr. David Alan Gilbert <dgilbert@redhat.com>
  Date:   2021-05-06 (Thu, 06 May 2021)

  Changed paths:
    M tools/virtiofsd/passthrough_ll.c

  Log Message:
  -----------
  virtiofs: Fixup printf args

Fixup some fuse_log printf args for 32bit compatibility.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Message-Id: <20210428110100.27757-2-dgilbert@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>


  Commit: 5bf5188a116a4b7663662b1f19b2fe91ff0b5974
      
https://github.com/qemu/qemu/commit/5bf5188a116a4b7663662b1f19b2fe91ff0b5974
  Author: Dr. David Alan Gilbert <dgilbert@redhat.com>
  Date:   2021-05-06 (Thu, 06 May 2021)

  Changed paths:
    M tools/virtiofsd/fuse_virtio.c

  Log Message:
  -----------
  virtiofsd: Don't assume header layout

virtiofsd incorrectly assumed a fixed set of header layout in the virt
queue; assuming that the fuse and write headers were conveniently
separated from the data;  the spec doesn't allow us to take that
convenience, so fix it up to deal with it the hard way.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Message-Id: <20210428110100.27757-3-dgilbert@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>


  Commit: 98bbd186ed49ead7419ca9d9f2915c7cc1dd0083
      
https://github.com/qemu/qemu/commit/98bbd186ed49ead7419ca9d9f2915c7cc1dd0083
  Author: Mahmoud Mandour <ma.mandourr@gmail.com>
  Date:   2021-05-06 (Thu, 06 May 2021)

  Changed paths:
    M tools/virtiofsd/fuse_lowlevel.c

  Log Message:
  -----------
  virtiofsd: Changed allocations of fuse_req to GLib functions

Replaced the allocation and deallocation of fuse_req structs
using calloc()/free() call pairs to a GLib's g_try_new0()
and g_free().

Signed-off-by: Mahmoud Mandour <ma.mandourr@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20210420154643.58439-2-ma.mandourr@gmail.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>


  Commit: 01c6c6f982196458d60d4d7cfa963c38947949f5
      
https://github.com/qemu/qemu/commit/01c6c6f982196458d60d4d7cfa963c38947949f5
  Author: Mahmoud Mandour <ma.mandourr@gmail.com>
  Date:   2021-05-06 (Thu, 06 May 2021)

  Changed paths:
    M tools/virtiofsd/fuse_lowlevel.c
    M tools/virtiofsd/fuse_virtio.c

  Log Message:
  -----------
  virtiofsd: Changed allocations of iovec to GLib's functions

Replaced the calls to malloc()/calloc() and their respective
calls to free() of iovec structs with GLib's allocation and
deallocation functions and used g_autofree when appropriate.

Replaced the allocation of in_sg_cpy to g_new() instead of a call
to calloc() and a null-checking assertion. Not g_new0()
because the buffer is immediately overwritten using memcpy.

Signed-off-by: Mahmoud Mandour <ma.mandourr@gmail.com>
Message-Id: <20210427181333.148176-1-ma.mandourr@gmail.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>


  Commit: f90a2d68c073c6a0a57790fae6b64eeb14ae78bb
      
https://github.com/qemu/qemu/commit/f90a2d68c073c6a0a57790fae6b64eeb14ae78bb
  Author: Mahmoud Mandour <ma.mandourr@gmail.com>
  Date:   2021-05-06 (Thu, 06 May 2021)

  Changed paths:
    M tools/virtiofsd/fuse_lowlevel.c

  Log Message:
  -----------
  virtiofsd: Changed allocations of fuse_session to GLib's functions

Replaced the allocation and deallocation of fuse_session structs
from calloc() and free() calls to g_try_new0() and g_free().

Signed-off-by: Mahmoud Mandour <ma.mandourr@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20210420154643.58439-4-ma.mandourr@gmail.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>


  Commit: e85d6d1ef2b950b55ec8b31b78335d320be13c0b
      
https://github.com/qemu/qemu/commit/e85d6d1ef2b950b55ec8b31b78335d320be13c0b
  Author: Mahmoud Mandour <ma.mandourr@gmail.com>
  Date:   2021-05-06 (Thu, 06 May 2021)

  Changed paths:
    M tools/virtiofsd/passthrough_ll.c

  Log Message:
  -----------
  virtiofsd: Changed allocation of lo_map_elems to GLib's functions

Replaced (re)allocation of lo_map_elem structs from realloc() to
GLib's g_try_realloc_n() and replaced the respective free() call
with a g_free().

Signed-off-by: Mahmoud Mandour <ma.mandourr@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20210420154643.58439-5-ma.mandourr@gmail.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>


  Commit: 31dfd22d7c8babae608eaf776d6d078fd6d7464f
      
https://github.com/qemu/qemu/commit/31dfd22d7c8babae608eaf776d6d078fd6d7464f
  Author: Mahmoud Mandour <ma.mandourr@gmail.com>
  Date:   2021-05-06 (Thu, 06 May 2021)

  Changed paths:
    M tools/virtiofsd/fuse_virtio.c

  Log Message:
  -----------
  virtiofsd: Changed allocations of fv_VuDev & its internals to GLib functions

Changed the allocations of fv_VuDev structs, VuDev structs, and
fv_QueueInfo strcuts from using calloc()/realloc() & free() to using
the equivalent functions from GLib.

In instances, removed the pair of allocation and assertion for
non-NULL checking with a GLib function that aborts on error.

Removed NULL-checking for fv_VuDev struct allocation and used
a GLib function that crashes on error; namely, g_new0(). This
is because allocating one struct should not be a problem on an
healthy system. Also following the pattern of aborting-on-null
behaviour that is taken with allocating VuDev structs and
fv_QueueInfo structs.

Signed-off-by: Mahmoud Mandour <ma.mandourr@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20210420154643.58439-6-ma.mandourr@gmail.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>


  Commit: c9a276f57cd59ead43a62f0662b3d18f5072641b
      
https://github.com/qemu/qemu/commit/c9a276f57cd59ead43a62f0662b3d18f5072641b
  Author: Mahmoud Mandour <ma.mandourr@gmail.com>
  Date:   2021-05-06 (Thu, 06 May 2021)

  Changed paths:
    M tools/virtiofsd/passthrough_ll.c

  Log Message:
  -----------
  virtiofsd/passthrough_ll.c: Changed local allocations to GLib functions

Changed the allocations of some local variables to GLib's allocation
functions, such as g_try_malloc0(), and annotated those variables
as g_autofree. Subsequently, I was able to remove the calls to free().

Signed-off-by: Mahmoud Mandour <ma.mandourr@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20210420154643.58439-7-ma.mandourr@gmail.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>


  Commit: 67a010f64cc9e33ba19ab389dedaa52013a9de8a
      
https://github.com/qemu/qemu/commit/67a010f64cc9e33ba19ab389dedaa52013a9de8a
  Author: Mahmoud Mandour <ma.mandourr@gmail.com>
  Date:   2021-05-06 (Thu, 06 May 2021)

  Changed paths:
    M tools/virtiofsd/fuse_virtio.c

  Log Message:
  -----------
  virtiofsd/fuse_virtio.c: Changed allocations of locals to GLib

Replaced the allocation of local variables from malloc() to
GLib allocation functions.

In one instance, dropped the usage to an assert after a malloc()
call and used g_malloc() instead.

Signed-off-by: Mahmoud Mandour <ma.mandourr@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20210420154643.58439-8-ma.mandourr@gmail.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>


  Commit: f9a576a818044133f8564e0d243ebd97df0b3280
      
https://github.com/qemu/qemu/commit/f9a576a818044133f8564e0d243ebd97df0b3280
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2021-05-11 (Tue, 11 May 2021)

  Changed paths:
    M tools/virtiofsd/fuse_lowlevel.c
    M tools/virtiofsd/fuse_virtio.c
    M tools/virtiofsd/helper.c
    M tools/virtiofsd/passthrough_ll.c

  Log Message:
  -----------
  Merge remote-tracking branch 
'remotes/dgilbert-gitlab/tags/pull-virtiofs-20210506' into staging

virtiofsd pull 2021-05-06

A pile of cleanups:

  Use of glib allocators from Mahmoud
  Virtio spec compliance and printf cleanup from me.
  Sugar to turn on xattr when defining xattr mapping from Carlos
  an assert cleanup from Greg

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

# gpg: Signature made Thu 06 May 2021 19:54:18 BST
# gpg:                using RSA key 45F5C71B4A0CB7FB977A9FA90516331EBC5BFDE7
# gpg: Good signature from "Dr. David Alan Gilbert (RH2) <dgilbert@redhat.com>" 
[full]
# Primary key fingerprint: 45F5 C71B 4A0C B7FB 977A  9FA9 0516 331E BC5B FDE7

* remotes/dgilbert-gitlab/tags/pull-virtiofs-20210506:
  virtiofsd/fuse_virtio.c: Changed allocations of locals to GLib
  virtiofsd/passthrough_ll.c: Changed local allocations to GLib functions
  virtiofsd: Changed allocations of fv_VuDev & its internals to GLib functions
  virtiofsd: Changed allocation of lo_map_elems to GLib's functions
  virtiofsd: Changed allocations of fuse_session to GLib's functions
  virtiofsd: Changed allocations of iovec to GLib's functions
  virtiofsd: Changed allocations of fuse_req to GLib functions
  virtiofsd: Don't assume header layout
  virtiofs: Fixup printf args
  virtiofsd: Add help for -o xattr-mapping
  virtiofsd: Allow use "-o xattrmap" without "-o xattr"
  virtiofsd: Fix side-effect in assert()

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


Compare: https://github.com/qemu/qemu/compare/e4f3ede95ce8...f9a576a81804



reply via email to

[Prev in Thread] Current Thread [Next in Thread]