Skip to content
Snippets Groups Projects
  1. Dec 17, 2019
  2. Oct 03, 2019
    • Maxim Levitsky's avatar
      qemu-pr-helper: fix crash in mpath_reconstruct_sense · b2aca78c
      Maxim Levitsky authored
      The 'r' variable was accidently shadowed, and because of this
      we were always passing 0 to mpath_generic_sense, instead of original
      return value, which triggers an abort()
      
      This is an attempt to fix the
      https://bugzilla.redhat.com/show_bug.cgi?id=1720047
      
      
      although there might be other places in the code
      that trigger qemu-pr-helper crash, and this fix might
      not be the root cause.
      
      The crash was reproduced by creating an iscsi target on a test machine,
      and passing it twice to the guest like that:
      
      -blockdev node-name=idisk0,driver=iscsi,transport=...,target=...
      -device scsi-block,drive=idisk0,bus=scsi0.0,bootindex=-1,scsi-id=1,lun=0,share-rw=on
      -device scsi-block,drive=idisk0,bus=scsi0.0,bootindex=-1,scsi-id=1,lun=1,share-rw=on
      
      Then in the guest, both /dev/sda and /dev/sdb were aggregated by multipath to /dev/mpatha,
      which was passed to a nested guest like that
      
      -object pr-manager-helper,id=qemu_pr_helper,path=/root/work/vm/testvm/.run/pr_helper.socket
      -blockdev node-name=test,driver=host_device,filename=/dev/mapper/mpatha,pr-manager=qemu_pr_helper
      -device scsi-block,drive=test,bus=scsi0.0,bootindex=-1,scsi-id=0,lun=0
      
      The nested guest run:
      
      sg_persist --no-inquiry  -v --out --register --param-sark 0x1234 /dev/sda
      
      Strictly speaking this is wrong configuration since qemu is where
      the multipath was split, and thus the iscsi target was not aware of
      multipath, and thus when libmpathpersist code rightfully tried to register
      the PR key on all paths, it failed to do so.
      
      However qemu-pr-helper should not crash in this case.
      
      Signed-off-by: default avatarMaxim Levitsky <mlevitsk@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      b2aca78c
  3. Sep 10, 2019
  4. Sep 03, 2019
  5. Jul 15, 2019
  6. Jun 12, 2019
    • Markus Armbruster's avatar
      Include qemu-common.h exactly where needed · a8d25326
      Markus Armbruster authored
      
      No header includes qemu-common.h after this commit, as prescribed by
      qemu-common.h's file comment.
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20190523143508.25387-5-armbru@redhat.com>
      [Rebased with conflicts resolved automatically, except for
      include/hw/arm/xlnx-zynqmp.h hw/arm/nrf51_soc.c hw/arm/msf2-soc.c
      block/qcow2-refcount.c block/qcow2-cluster.c block/qcow2-cache.c
      target/arm/cpu.h target/lm32/cpu.h target/m68k/cpu.h target/mips/cpu.h
      target/moxie/cpu.h target/nios2/cpu.h target/openrisc/cpu.h
      target/riscv/cpu.h target/tilegx/cpu.h target/tricore/cpu.h
      target/unicore32/cpu.h target/xtensa/cpu.h; bsd-user/main.c and
      net/tap-bsd.c fixed up]
      a8d25326
    • Markus Armbruster's avatar
      Include qemu/module.h where needed, drop it from qemu-common.h · 0b8fa32f
      Markus Armbruster authored
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20190523143508.25387-4-armbru@redhat.com>
      [Rebased with conflicts resolved automatically, except for
      hw/usb/dev-hub.c hw/misc/exynos4210_rng.c hw/misc/bcm2835_rng.c
      hw/misc/aspeed_scu.c hw/display/virtio-vga.c hw/arm/stm32f205_soc.c;
      ui/cocoa.m fixed up]
      0b8fa32f
  7. May 13, 2019
  8. Apr 17, 2019
    • Christophe Fergeau's avatar
      log: Make glib logging go through QEMU · f5852efa
      Christophe Fergeau authored
      
      This commit adds a error_init() helper which calls
      g_log_set_default_handler() so that glib logs (g_log, g_warning, ...)
      are handled similarly to other QEMU logs. This means they will get a
      timestamp if timestamps are enabled, and they will go through the
      HMP monitor if one is configured.
      
      This commit also adds a call to error_init() to the binaries
      installed by QEMU. Since error_init() also calls error_set_progname(),
      this means that *-linux-user, *-bsd-user and qemu-pr-helper messages
      output with error_report, info_report, ... will slightly change: they
      will be prefixed by the binary name.
      
      glib debug messages are enabled through G_MESSAGES_DEBUG similarly to
      the glib default log handler.
      
      At the moment, this change will mostly impact SPICE logging if your
      spice version is >= 0.14.1. With older spice versions, this is not going
      to work as expected, but will not have any ill effect, so this call is
      not conditional on the SPICE version.
      
      Signed-off-by: default avatarChristophe Fergeau <cfergeau@redhat.com>
      Reviewed-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      Message-Id: <20190131164614.19209-3-cfergeau@redhat.com>
      Reviewed-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      f5852efa
  9. Mar 22, 2019
  10. Dec 14, 2018
  11. Nov 27, 2018
  12. Oct 02, 2018
    • Marc-André Lureau's avatar
      util: add qemu_write_pidfile() · 9e6bdef2
      Marc-André Lureau authored
      
      There are variants of qemu_create_pidfile() in qemu-pr-helper and
      qemu-ga. Let's have a common implementation in libqemuutil.
      
      The code is initially based from pr-helper write_pidfile(), with
      various improvements and suggestions from Daniel Berrangé:
      
        QEMU will leave the pidfile existing on disk when it exits which
        initially made me think it avoids the deletion race. The app
        managing QEMU, however, may well delete the pidfile after it has
        seen QEMU exit, and even if the app locks the pidfile before
        deleting it, there is still a race.
      
        eg consider the following sequence
      
              QEMU 1        libvirtd        QEMU 2
      
        1.    lock(pidfile)
      
        2.    exit()
      
        3.                 open(pidfile)
      
        4.                 lock(pidfile)
      
        5.                                  open(pidfile)
      
        6.                 unlink(pidfile)
      
        7.                 close(pidfile)
      
        8.                                  lock(pidfile)
      
        IOW, at step 8 the new QEMU has successfully acquired the lock, but
        the pidfile no longer exists on disk because it was deleted after
        the original QEMU exited.
      
        While we could just say no external app should ever delete the
        pidfile, I don't think that is satisfactory as people don't read
        docs, and admins don't like stale pidfiles being left around on
        disk.
      
        To make this robust, I think we might want to copy libvirt's
        approach to pidfile acquisition which runs in a loop and checks that
        the file on disk /after/ acquiring the lock matches the file that
        was locked. Then we could in fact safely let QEMU delete its own
        pidfiles on clean exit..
      
      Signed-off-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <20180831145314.14736-2-marcandre.lureau@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      9e6bdef2
  13. Aug 28, 2018
  14. Aug 23, 2018
  15. Jul 06, 2018
    • Paolo Bonzini's avatar
      pr-manager-helper: fix memory leak on event · ea3d77c8
      Paolo Bonzini authored
      
      Reported by Coverity.
      
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      ea3d77c8
    • Michal Privoznik's avatar
      pr-helper: Rework socket path handling · 2729d79d
      Michal Privoznik authored
      
      When reviewing Paolo's pr-helper patches I've noticed couple of
      problems:
      
      1) socket_path needs to be calculated at two different places
      (one for printing out help, the other if socket activation is NOT
      used),
      
      2) even though the default socket_path is allocated in
      compute_default_paths() it is the only default path the function
      handles. For instance, pidfile is allocated outside of this
      function. And yet again, at different places than 1)
      
      Signed-off-by: default avatarMichal Privoznik <mprivozn@redhat.com>
      Message-Id: <c791ba035f26ea957e8f3602e3009b621769b1ba.1530611283.git.mprivozn@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      2729d79d
    • Paolo Bonzini's avatar
      pr-helper: avoid error on PR IN command with zero request size · ee8c13b8
      Paolo Bonzini authored
      
      After reading a PR IN command with zero request size in prh_read_request,
      the resp->result field will be uninitialized and the resp.sz field will
      be also uninitialized when returning to prh_co_entry.
      
      If resp->result == GOOD (from a previous successful reply or just luck),
      then the assert in prh_write_response might not be triggered and
      uninitialized response will be sent.
      
      The fix is to remove the whole handling of sz == 0 in prh_co_entry.
      Those errors apply only to PR OUT commands and it's perfectly okay to
      catch them later in do_pr_out and multipath_pr_out; the check for
      too-short parameters in fact doesn't apply in the easy SG_IO case, as
      it can be left to the target firmware even.
      
      The result is that prh_read_request does not fail requests anymore and
      prh_co_entry becomes simpler.
      
      Reported-by: default avatarDima Stepanov <dimastep@yandex-team.ru>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      ee8c13b8
  16. Jun 28, 2018
  17. Apr 09, 2018
  18. Mar 26, 2018
  19. Mar 12, 2018
    • Thomas Huth's avatar
      Polish the version strings containing the package version · 7e563bfb
      Thomas Huth authored
      Since commit 67a1de0d there is no space anymore between the
      version number and the parentheses when running configure with
      --with-pkgversion=foo :
      
       $ qemu-system-s390x --version
       QEMU emulator version 2.11.50(foo)
      
      But the space is included when building without that option
      when building from a git checkout:
      
       $ qemu-system-s390x --version
       QEMU emulator version 2.11.50 (v2.11.0-1494-gbec9c64-dirty)
      
      The same confusion exists with the "query-version" QMP command.
      Let's fix this by introducing a proper QEMU_FULL_VERSION definition
      that includes the space and parentheses, while the QEMU_PKGVERSION
      should just cleanly contain the package version string itself.
      Note that this also changes the behavior of the "query-version" QMP
      command (the space and parentheses are not included there anymore),
      but that's supposed to be OK since the strings there are not meant
      to be parsed by other tools.
      
      Fixes: 67a1de0d
      Buglink: https://bugs.launchpad.net/qemu/+bug/1673373
      
      
      Signed-off-by: default avatarThomas Huth <thuth@redhat.com>
      Message-Id: <1518692807-25859-1-git-send-email-thuth@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      7e563bfb
  20. Feb 09, 2018
  21. Jan 12, 2018
  22. Dec 21, 2017
  23. Dec 20, 2017
  24. Oct 18, 2017
    • Paolo Bonzini's avatar
      qemu-pr-helper: use new libmultipath API · b3f1c8c4
      Paolo Bonzini authored
      
      libmultipath has recently changed its API.  The new API supports multi-threaded
      clients better.  Unfortunately there is no backwards-compatibility, so we just
      switch to the new one.  Running QEMU compiled with the new library on the old
      library will likely crash, while doing the opposite will cause QEMU not to
      start at all (because udev, get_multipath_config and put_multipath_config
      are undefined).
      
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      b3f1c8c4
  25. Sep 22, 2017
    • Paolo Bonzini's avatar
      scsi: add persistent reservation manager using qemu-pr-helper · 9bad2a6b
      Paolo Bonzini authored
      
      This adds a concrete subclass of pr-manager that talks to qemu-pr-helper.
      
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      9bad2a6b
    • Paolo Bonzini's avatar
      scsi: add multipath support to qemu-pr-helper · fe8fc5ae
      Paolo Bonzini authored
      
      Proper support of persistent reservation for multipath devices requires
      communication with the multipath daemon, so that the reservation is
      registered and applied when a path comes up.  The device mapper
      utilities provide a library to do so; this patch makes qemu-pr-helper.c
      detect multipath devices and, when one is found, delegate the operation
      to libmpathpersist.
      
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      fe8fc5ae
    • Paolo Bonzini's avatar
      scsi: build qemu-pr-helper · b855f8d1
      Paolo Bonzini authored
      
      Introduce a privileged helper to run persistent reservation commands.
      This lets virtual machines send persistent reservations without using
      CAP_SYS_RAWIO or out-of-tree patches.  The helper uses Unix permissions
      and SCM_RIGHTS to restrict access to processes that can access its socket
      and prove that they have an open file descriptor for a raw SCSI device.
      
      The next patch will also correct the usage of persistent reservations
      with multipath devices.
      
      It would also be possible to support for Linux's IOC_PR_* ioctls in
      the future, to support NVMe devices.  For now, however, only SCSI is
      supported.
      
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      b855f8d1
Loading