1. 19 7月, 2013 27 次提交
  2. 18 7月, 2013 5 次提交
  3. 17 7月, 2013 5 次提交
  4. 16 7月, 2013 3 次提交
    • L
      qapi: qapi-commands: fix possible leaks on visitor dealloc · 8f91ad8a
      Luiz Capitulino 提交于
      In qmp-marshal.c the dealloc visitor calls use the same errp
      pointer of the input visitor calls. This means that if any of
      the input visitor calls fails, then the dealloc visitor will
      return early, before freeing the object's memory.
      
      Here's an example, consider this code:
      
      int qmp_marshal_input_block_passwd(Monitor *mon, const QDict *qdict, QObject **ret)
      {
      	[...]
      
          char * device = NULL;
          char * password = NULL;
      
          mi = qmp_input_visitor_new_strict(QOBJECT(args));
          v = qmp_input_get_visitor(mi);
          visit_type_str(v, &device, "device", errp);
          visit_type_str(v, &password, "password", errp);
          qmp_input_visitor_cleanup(mi);
      
          if (error_is_set(errp)) {
              goto out;
          }
          qmp_block_passwd(device, password, errp);
      
      out:
          md = qapi_dealloc_visitor_new();
          v = qapi_dealloc_get_visitor(md);
          visit_type_str(v, &device, "device", errp);
          visit_type_str(v, &password, "password", errp);
          qapi_dealloc_visitor_cleanup(md);
      
      	[...]
      
          return 0;
      }
      
      Consider errp != NULL when the out label is reached, we're going
      to leak device and password.
      
      This patch fixes this by always passing errp=NULL for dealloc
      visitors, meaning that we always try to free them regardless of
      any previous failure. The above example would then be:
      
      out:
          md = qapi_dealloc_visitor_new();
          v = qapi_dealloc_get_visitor(md);
          visit_type_str(v, &device, "device", NULL);
          visit_type_str(v, &password, "password", NULL);
          qapi_dealloc_visitor_cleanup(md);
      Signed-off-by: NLuiz Capitulino <lcapitulino@redhat.com>
      Reviewed-by: NLaszlo Ersek <lersek@redhat.com>
      Reviewed-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      8f91ad8a
    • V
      vfio: QEMU-AER: Qemu changes to support AER for VFIO-PCI devices · 7b4b0e9e
      Vijay Mohan Pandarathil 提交于
      Add support for error containment when a VFIO device assigned to a KVM
      guest encounters an error. This is for PCIe devices/drivers that support AER
      functionality. When the host OS is notified of an error in a device either
      through the firmware first approach or through an interrupt handled by the AER
      root port driver, the error handler registered by the vfio-pci driver gets
      invoked. The qemu process is signaled through an eventfd registered per
      VFIO device by the qemu process. In the eventfd handler, qemu decides on
      what action to take. In this implementation, guest is brought down to
      contain the error.
      
      The kernel patches for the above functionality has been already accepted.
      
      This is a refresh of the QEMU patch which was reviewed earlier.
      http://marc.info/?l=linux-kernel&m=136281557608087&w=2
      This patch has the same contents and has been built after refreshing
      to latest upstream and after the linux headers have been updated in qemu.
      
      	- Create eventfd per vfio device assigned to a guest and register an
                event handler
      
      	- This fd is passed to the vfio_pci driver through the SET_IRQ ioctl
      
      	- When the device encounters an error, the eventfd is signalled
                and the qemu eventfd handler gets invoked.
      
      	- In the handler decide what action to take. Current action taken
                is to stop the guest.
      Signed-off-by: NVijay Mohan Pandarathil <vijaymohan.pandarathil@hp.com>
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      7b4b0e9e
    • A
      vfio-pci: VGA quirk update · 39360f0b
      Alex Williamson 提交于
      Turns out all the suspicions for AMD devices were correct, everywhere
      we read a BAR address that the address matches the config space offset,
      there's full access to PCI config space.  Attempt to generalize some
      helpers to allow quirks to easily be added for mirrors and windows.
      Also fill in complete config space for AMD.
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      39360f0b