Skip to content
Snippets Groups Projects
  1. Feb 22, 2020
  2. Jan 08, 2020
  3. Jan 07, 2020
  4. Sep 03, 2019
  5. Aug 21, 2019
    • Alberto Garcia's avatar
      char-socket: Lock tcp_chr_disconnect() and socket_reconnect_timeout() · 78d01598
      Alberto Garcia authored
      
      There's a race condition in which the tcp_chr_read() ioc handler can
      close a connection that is being written to from another thread.
      
      Running iotest 136 in a loop triggers this problem and crashes QEMU.
      
       (gdb) bt
       #0  0x00005558b842902d in object_get_class (obj=0x0) at qom/object.c:860
       #1  0x00005558b84f92db in qio_channel_writev_full (ioc=0x0, iov=0x7ffc355decf0, niov=1, fds=0x0, nfds=0, errp=0x0) at io/channel.c:76
       #2  0x00005558b84e0e9e in io_channel_send_full (ioc=0x0, buf=0x5558baf5beb0, len=138, fds=0x0, nfds=0) at chardev/char-io.c:123
       #3  0x00005558b84e4a69 in tcp_chr_write (chr=0x5558ba460380, buf=0x5558baf5beb0 "...", len=138) at chardev/char-socket.c:135
       #4  0x00005558b84dca55 in qemu_chr_write_buffer (s=0x5558ba460380, buf=0x5558baf5beb0 "...", len=138, offset=0x7ffc355dedd0, write_all=false) at chardev/char.c:112
       #5  0x00005558b84dcbc2 in qemu_chr_write (s=0x5558ba460380, buf=0x5558baf5beb0 "...", len=138, write_all=false) at chardev/char.c:147
       #6  0x00005558b84dfb26 in qemu_chr_fe_write (be=0x5558ba476610, buf=0x5558baf5beb0 "...", len=138) at chardev/char-fe.c:42
       #7  0x00005558b8088c86 in monitor_flush_locked (mon=0x5558ba476610) at monitor.c:406
       #8  0x00005558b8088e8c in monitor_puts (mon=0x5558ba476610, str=0x5558ba921e49 "") at monitor.c:449
       #9  0x00005558b8089178 in qmp_send_response (mon=0x5558ba476610, rsp=0x5558bb161600) at monitor.c:498
       #10 0x00005558b808920c in monitor_qapi_event_emit (event=QAPI_EVENT_SHUTDOWN, qdict=0x5558bb161600) at monitor.c:526
       #11 0x00005558b8089307 in monitor_qapi_event_queue_no_reenter (event=QAPI_EVENT_SHUTDOWN, qdict=0x5558bb161600) at monitor.c:551
       #12 0x00005558b80896c0 in qapi_event_emit (event=QAPI_EVENT_SHUTDOWN, qdict=0x5558bb161600) at monitor.c:626
       #13 0x00005558b855f23b in qapi_event_send_shutdown (guest=false, reason=SHUTDOWN_CAUSE_HOST_QMP_QUIT) at qapi/qapi-events-run-state.c:43
       #14 0x00005558b81911ef in qemu_system_shutdown (cause=SHUTDOWN_CAUSE_HOST_QMP_QUIT) at vl.c:1837
       #15 0x00005558b8191308 in main_loop_should_exit () at vl.c:1885
       #16 0x00005558b819140d in main_loop () at vl.c:1924
       #17 0x00005558b8198c84 in main (argc=18, argv=0x7ffc355df3f8, envp=0x7ffc355df490) at vl.c:4665
      
      This patch adds a lock to protect tcp_chr_disconnect() and
      socket_reconnect_timeout()
      
      Signed-off-by: default avatarAlberto Garcia <berto@igalia.com>
      Signed-off-by: default avatarAndrey Shinkevich <andrey.shinkevich@virtuozzo.com>
      Message-Id: <1565625509-404969-3-git-send-email-andrey.shinkevich@virtuozzo.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      78d01598
  6. Aug 16, 2019
  7. Jun 18, 2019
  8. 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
  9. Apr 18, 2019
  10. Apr 16, 2019
  11. Mar 22, 2019
  12. Mar 11, 2019
    • Daniel P. Berrangé's avatar
      chardev: add support for authorization for TLS clients · fd4a5fd4
      Daniel P. Berrangé authored
      
      Currently any client which can complete the TLS handshake is able to use
      a chardev server. The server admin can turn on the 'verify-peer' option
      for the x509 creds to require the client to provide a x509
      certificate. This means the client will have to acquire a certificate
      from the CA before they are permitted to use the chardev server. This is
      still a fairly low bar.
      
      This adds a 'tls-authz=OBJECT-ID' option to the socket chardev backend
      which takes the ID of a previously added 'QAuthZ' object instance. This
      will be used to validate the client's x509 distinguished name. Clients
      failing the check will not be permitted to use the chardev server.
      
      For example to setup authorization that only allows connection from a
      client whose x509 certificate distinguished name contains 'CN=fred', you
      would use:
      
        $QEMU -object tls-creds-x509,id=tls0,dir=/home/berrange/qemutls,\
                      endpoint=server,verify-peer=yes \
              -object authz-simple,id=authz0,identity=CN=laptop.example.com,,\
                      O=Example Org,,L=London,,ST=London,,C=GB \
              -chardev socket,host=127.0.0.1,port=9000,server,\
      	         tls-creds=tls0,tls-authz=authz0 \
              ...other qemu args...
      
      Signed-off-by: default avatarDaniel P. Berrange <berrange@redhat.com>
      Reviewed-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
      fd4a5fd4
  13. Mar 07, 2019
  14. Feb 21, 2019
    • Marc-André Lureau's avatar
      char: register spice ports after spice started · 8afbff16
      Marc-André Lureau authored
      
      Spice port registration is delayed until the server is started. But
      ports created after are not being registered. If the server is already
      started, do vmc_register_interface() to register it from
      qemu_chr_open_spice_port().
      
      Signed-off-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
      Tested-by: default avatarVictor Toso <victortoso@redhat.com>
      Message-id: 20190221110703.5775-8-marcandre.lureau@redhat.com
      Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
      8afbff16
    • Marc-André Lureau's avatar
      char: move SpiceChardev and open_spice_port() to spice.h header · 24fa7da3
      Marc-André Lureau authored
      
      This will allow easier subclassing of SpiceChardev, in upcoming
      "display: add -display spice-app launching external application"
      patch.
      
      Signed-off-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
      Tested-by: default avatarVictor Toso <victortoso@redhat.com>
      Message-id: 20190221110703.5775-7-marcandre.lureau@redhat.com
      Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
      24fa7da3
    • Marc-André Lureau's avatar
      char/spice: discard write() if backend is disconnected · a2dc3c8e
      Marc-André Lureau authored
      
      Most chardev backend handle write() as discarded data if underlying
      system is disconnected. For unknown historical reasons, the Spice
      backend has "reliable" write: it will wait until the client end is
      reconnected to do further successful write().
      
      To decide whether it make sense to wait until the client is
      reconnected (or queue the writes), let's review Spice chardev usage
      and handling of a disconnected client:
      
       * spice vdagent
         The agents reopen the virtio port on disconnect. In qemu side,
         virtio_serial_close() will also discard pending data.
      
       * usb redirection
         A disconnect creates a device disconnection.
      
       * smartcard emulation
         Data is discarded in passthru_apdu_from_guest().
      
         (Spice doesn't explicitly open the smartcard char device until
         upcoming 0.14.2, commit 69a5cfc74131ec0459f2eb5a231139f5a69a8037)
      
       * spice webdavd
         The daemon will restart the service, and reopen the virtio port.
      
       * spice ports (serial console, qemu monitor..)
         Depends on the associated device or usage.
      
         - serial, may be throttled or discarded on write, depending on
           device
      
         - QMP/HMP monitor have some CLOSED event handling, but want to
           flush the write, which will finish when a new client connects.
      
      On disconnect/reconnect, the client starts with fresh sessions. If it
      is a seamless migration, the client disconnects after the source
      migrated. The handling of source disconnect in qemu is thus irrelevant
      for the Spice session migration.
      
      For all these use cases, it is better to discard writes when the
      client is disconnected, and require the vm-side device/agent to behave
      correctly on CHR_EVENT_CLOSED, to stop reading and writing from
      the spice chardev.
      
      Signed-off-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
      Tested-by: default avatarVictor Toso <victortoso@redhat.com>
      Message-id: 20190221110703.5775-3-marcandre.lureau@redhat.com
      Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
      a2dc3c8e
    • Marc-André Lureau's avatar
      char/spice: trigger HUP event · 805189ab
      Marc-André Lureau authored
      
      Inform the front-end of disconnected state (spice client
      disconnected).
      
      This will wakeup the source handler immediately, so it can detect the
      disconnection asap.
      
      Signed-off-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
      Tested-by: default avatarVictor Toso <victortoso@redhat.com>
      Message-id: 20190221110703.5775-2-marcandre.lureau@redhat.com
      Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
      805189ab
  15. Feb 13, 2019
  16. Feb 12, 2019
Loading