1. 18 12月, 2018 2 次提交
    • D
      qmp: query-current-machine with wakeup-suspend-support · 46ea94ca
      Daniel Henrique Barboza 提交于
      When issuing the qmp/hmp 'system_wakeup' command, what happens in a
      nutshell is:
      
      - qmp_system_wakeup_request set runstate to RUNNING, sets a wakeup_reason
      and notify the event
      - in the main_loop, all vcpus are paused, a system reset is issued, all
      subscribers of wakeup_notifiers receives a notification, vcpus are then
      resumed and the wake up QAPI event is fired
      
      Note that this procedure alone doesn't ensure that the guest will awake
      from SUSPENDED state - the subscribers of the wake up event must take
      action to resume the guest, otherwise the guest will simply reboot. At
      this moment, only the ACPI machines via acpi_pm1_cnt_init and xen_hvm_init
      have wake-up from suspend support.
      
      However, only the presence of 'system_wakeup' is required for QGA to
      support 'guest-suspend-ram' and 'guest-suspend-hybrid' at this moment.
      This means that the user/management will expect to suspend the guest using
      one of those suspend commands and then resume execution using system_wakeup,
      regardless of the support offered in system_wakeup in the first place.
      
      This patch creates a new API called query-current-machine [1], that holds
      a new flag called 'wakeup-suspend-support' that indicates if the guest
      supports wake up from suspend via system_wakeup. The machine is considered
      to implement wake-up support if a call to a new 'qemu_register_wakeup_support'
      is made during its init, as it is now being done inside acpi_pm1_cnt_init
      and xen_hvm_init. This allows for any other machine type to declare wake-up
      support regardless of ACPI state or wakeup_notifiers subscription, making easier
      for newer implementations that might have their own mechanisms in the future.
      
      This is the expected output of query-current-machine when running a x86
      guest:
      
      {"execute" : "query-current-machine"}
      {"return": {"wakeup-suspend-support": true}}
      
      Running the same x86 guest, but with the --no-acpi option:
      
      {"execute" : "query-current-machine"}
      {"return": {"wakeup-suspend-support": false}}
      
      This is the output when running a pseries guest:
      
      {"execute" : "query-current-machine"}
      {"return": {"wakeup-suspend-support": false}}
      
      With this extra tool, management can avoid situations where a guest
      that does not have proper suspend/wake capabilities ends up in
      inconsistent state (e.g.
      https://github.com/open-power-host-os/qemu/issues/31).
      
      [1] the decision of creating the query-current-machine API is based
      on discussions in the QEMU mailing list where it was decided that
      query-target wasn't a proper place to store the wake-up flag, neither
      was query-machines because this isn't a static property of the
      machine object. This new API can then be used to store other
      dynamic machine properties that are scattered around the code
      ATM. More info at:
      https://lists.gnu.org/archive/html/qemu-devel/2018-05/msg04235.htmlReported-by: NBalamuruhan S <bala24@linux.vnet.ibm.com>
      Signed-off-by: NDaniel Henrique Barboza <danielhb413@gmail.com>
      Message-Id: <20181205194701.17836-2-danielhb413@gmail.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Acked-by: NEduardo Habkost <ehabkost@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      46ea94ca
    • D
      qapi: Turn ShutdownCause into QAPI enum · d43013e2
      Dominik Csapak 提交于
      Needed so the patch after next can add ShutdownCause to QMP events
      SHUTDOWN and RESET.
      Signed-off-by: NDominik Csapak <d.csapak@proxmox.com>
      Message-Id: <20181205110131.23049-2-d.csapak@proxmox.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      d43013e2
  2. 17 12月, 2018 3 次提交
  3. 14 12月, 2018 12 次提交
  4. 13 12月, 2018 3 次提交
  5. 12 12月, 2018 19 次提交
  6. 04 12月, 2018 1 次提交
    • J
      net: drop too large packet early · 25c01bd1
      Jason Wang 提交于
      We try to detect and drop too large packet (>INT_MAX) in 1592a994
      ("net: ignore packet size greater than INT_MAX") during packet
      delivering. Unfortunately, this is not sufficient as we may hit
      another integer overflow when trying to queue such large packet in
      qemu_net_queue_append_iov():
      
      - size of the allocation may overflow on 32bit
      - packet->size is integer which may overflow even on 64bit
      
      Fixing this by moving the check to qemu_sendv_packet_async() which is
      the entrance of all networking codes and reduce the limit to
      NET_BUFSIZE to be more conservative. This works since:
      
      - For the callers that call qemu_sendv_packet_async() directly, they
        only care about if zero is returned to determine whether to prevent
        the source from producing more packets. A callback will be triggered
        if peer can accept more then source could be enabled. This is
        usually used by high speed networking implementation like virtio-net
        or netmap.
      - For the callers that call qemu_sendv_packet() that calls
        qemu_sendv_packet_async() indirectly, they often ignore the return
        value. In this case qemu will just the drop packets if peer can't
        receive.
      
      Qemu will copy the packet if it was queued. So it was safe for both
      kinds of the callers to assume the packet was sent.
      
      Since we move the check from qemu_deliver_packet_iov() to
      qemu_sendv_packet_async(), it would be safer to make
      qemu_deliver_packet_iov() static to prevent any external user in the
      future.
      
      This is a revised patch of CVE-2018-17963.
      
      Cc: qemu-stable@nongnu.org
      Cc: Li Qiang <liq3ea@163.com>
      Fixes: 1592a994 ("net: ignore packet size greater than INT_MAX")
      Reported-by: NLi Qiang <liq3ea@gmail.com>
      Reviewed-by: NLi Qiang <liq3ea@gmail.com>
      Signed-off-by: NJason Wang <jasowang@redhat.com>
      Reviewed-by: NThomas Huth <thuth@redhat.com>
      Message-id: 20181204035347.6148-2-jasowang@redhat.com
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      25c01bd1