1. 12 2月, 2014 3 次提交
  2. 07 2月, 2014 3 次提交
    • J
      libxl: remove unneeded locking of driver when restoring · 630b6456
      Jim Fehlig 提交于
      libxlDomainRestoreFlags acquires the driver lock while reading the
      domain config from the save file and adding it to
      libxlDriverPrivatePtr->domains.  But virDomainObjList provides
      self-locking APIs, so remove the needless driver locking.
      Signed-off-by: NJim Fehlig <jfehlig@suse.com>
      630b6456
    • J
      libxl: handle domain shutdown events in a thread · 03b3f894
      Jim Fehlig 提交于
      Handling the domain shutdown event within the event handler seems
      a bit unfair to libxl's event machinery.  Domain "shutdown" could
      take considerable time.  E.g. if the shutdown reason is reboot,
      the domain must be reaped and then started again.
      
      Spawn a shutdown handler thread to do this work, allowing libxl's
      event machinery to go about its business.
      Signed-off-by: NJim Fehlig <jfehlig@suse.com>
      03b3f894
    • J
      libxl: remove list of timer registrations from libxlDomainObjPrivate · eaa8d9b2
      Jim Fehlig 提交于
      Due to some misunderstanding of requirements libxl places on timer
      handling, I introduced the half-brained idea of maintaining a list
      of timeouts that the driver could force to expire before freeing a
      libxlDomainObjPrivate (and hence libxl_ctx).  But testing all
      the latest versions of Xen supported by the libxl driver (4.2.3,
      4.3.1, 4.4.0 RC3), I see that libxl will handle this just fine and
      there is no need to force expiration behind libxl's back.  Indeed it
      may be harmful to do so.
      
      This patch removes the timer list, allowing libxl to handle cleanup
      of its timer registrations.
      Signed-off-by: NJim Fehlig <jfehlig@suse.com>
      eaa8d9b2
  3. 05 2月, 2014 1 次提交
    • E
      event: move event filtering to daemon (regression fix) · 11f20e43
      Eric Blake 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1058839
      
      Commit f9f56340 for CVE-2014-0028 almost had the right idea - we
      need to check the ACL rules to filter which events to send.  But
      it overlooked one thing: the event dispatch queue is running in
      the main loop thread, and therefore does not normally have a
      current virIdentityPtr.  But filter checks can be based on current
      identity, so when libvirtd.conf contains access_drivers=["polkit"],
      we ended up rejecting access for EVERY event due to failure to
      look up the current identity, even if it should have been allowed.
      
      Furthermore, even for events that are triggered by API calls, it
      is important to remember that the point of events is that they can
      be copied across multiple connections, which may have separate
      identities and permissions.  So even if events were dispatched
      from a context where we have an identity, we must change to the
      correct identity of the connection that will be receiving the
      event, rather than basing a decision on the context that triggered
      the event, when deciding whether to filter an event to a
      particular connection.
      
      If there were an easy way to get from virConnectPtr to the
      appropriate virIdentityPtr, then object_event.c could adjust the
      identity prior to checking whether to dispatch an event.  But
      setting up that back-reference is a bit invasive.  Instead, it
      is easier to delay the filtering check until lower down the
      stack, at the point where we have direct access to the RPC
      client object that owns an identity.  As such, this patch ends
      up reverting a large portion of the framework of commit f9f56340.
      We also have to teach 'make check' to special-case the fact that
      the event registration filtering is done at the point of dispatch,
      rather than the point of registration.  Note that even though we
      don't actually use virConnectDomainEventRegisterCheckACL (because
      the RegisterAny variant is sufficient), we still generate the
      function for the purposes of documenting that the filtering
      takes place.
      
      Also note that I did not entirely delete the notion of a filter
      from object_event.c; I still plan on using that for my upcoming
      patch series for qemu monitor events in libvirt-qemu.so.  In
      other words, while this patch changes ACL filtering to live in
      remote.c and therefore we have no current client of the filtering
      in object_event.c, the notion of filtering in object_event.c is
      still useful down the road.
      
      * src/check-aclrules.pl: Exempt event registration from having to
      pass checkACL filter down call stack.
      * daemon/remote.c (remoteRelayDomainEventCheckACL)
      (remoteRelayNetworkEventCheckACL): New functions.
      (remoteRelay*Event*): Use new functions.
      * src/conf/domain_event.h (virDomainEventStateRegister)
      (virDomainEventStateRegisterID): Drop unused parameter.
      * src/conf/network_event.h (virNetworkEventStateRegisterID):
      Likewise.
      * src/conf/domain_event.c (virDomainEventFilter): Delete unused
      function.
      * src/conf/network_event.c (virNetworkEventFilter): Likewise.
      * src/libxl/libxl_driver.c: Adjust caller.
      * src/lxc/lxc_driver.c: Likewise.
      * src/network/bridge_driver.c: Likewise.
      * src/qemu/qemu_driver.c: Likewise.
      * src/remote/remote_driver.c: Likewise.
      * src/test/test_driver.c: Likewise.
      * src/uml/uml_driver.c: Likewise.
      * src/vbox/vbox_tmpl.c: Likewise.
      * src/xen/xen_driver.c: Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      11f20e43
  4. 01 2月, 2014 1 次提交
    • J
      Resolve Coverity dead_error_begin · 5c36e631
      John Ferlan 提交于
      Coverity complains about default: label in libxl_driver.c not be able
      to be reached. It's by design for the code and since it's not necessary
      in the code nor does it elicit any compiler/make check warnings - just
      remove it rather than adding a coverity[dead_error_begin] tag.
      
      While I'm at it, lxc_driver.c and nodeinfo.c have the same design, so I
      removed the default labels and the existing coverity tags.
      5c36e631
  5. 23 1月, 2014 1 次提交
    • E
      api: require write permission for guest agent interaction · 7f2d27d1
      Eric Blake 提交于
      I noticed that we allow virDomainGetVcpusFlags even for read-only
      connections, but that with a flag, it can require guest agent
      interaction.  It is feasible that a malicious guest could
      intentionally abuse the replies it sends over the guest agent
      connection to possibly trigger a bug in libvirt's JSON parser,
      or withhold an answer so as to prevent the use of the agent
      in a later command such as a shutdown request.  Although we
      don't know of any such exploits now (and therefore don't mind
      posting this patch publicly without trying to get a CVE assigned),
      it is better to err on the side of caution and explicitly require
      full access to any domain where the API requires guest interaction
      to operate correctly.
      
      I audited all commands that are marked as conditionally using a
      guest agent.  Note that at least virDomainFSTrim is documented
      as needing a guest agent, but that such use is unconditional
      depending on the hypervisor (so the existing domain:fs_trim ACL
      should be sufficient there, rather than also requirng domain:write).
      But when designing future APIs, such as the plans for obtaining
      a domain's IP addresses, we should copy the approach of this patch
      in making interaction with the guest be specified via a flag, and
      use that flag to also require stricter access checks.
      
      * src/libvirt.c (virDomainGetVcpusFlags): Forbid guest interaction
      on read-only connection.
      (virDomainShutdownFlags, virDomainReboot): Improve docs on agent
      interaction.
      * src/remote/remote_protocol.x
      (REMOTE_PROC_DOMAIN_SNAPSHOT_CREATE_XML)
      (REMOTE_PROC_DOMAIN_SET_VCPUS_FLAGS)
      (REMOTE_PROC_DOMAIN_GET_VCPUS_FLAGS, REMOTE_PROC_DOMAIN_REBOOT)
      (REMOTE_PROC_DOMAIN_SHUTDOWN_FLAGS): Require domain:write for any
      conditional use of a guest agent.
      * src/xen/xen_driver.c: Fix clients.
      * src/libxl/libxl_driver.c: Likewise.
      * src/uml/uml_driver.c: Likewise.
      * src/qemu/qemu_driver.c: Likewise.
      * src/lxc/lxc_driver.c: Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      7f2d27d1
  6. 16 1月, 2014 1 次提交
    • E
      event: filter global events by domain:getattr ACL [CVE-2014-0028] · f9f56340
      Eric Blake 提交于
      Ever since ACL filtering was added in commit 76397360 (v1.1.1), a
      user could still use event registration to obtain access to a
      domain that they could not normally access via virDomainLookup*
      or virConnectListAllDomains and friends.  We already have the
      framework in the RPC generator for creating the filter, and
      previous cleanup patches got us to the point that we can now
      wire the filter through the entire object event stack.
      
      Furthermore, whether or not domain:getattr is honored, use of
      global events is a form of obtaining a list of networks, which
      is covered by connect:search_domains added in a93cd08f (v1.1.0).
      Ideally, we'd have a way to enforce connect:search_domains when
      doing global registrations while omitting that check on a
      per-domain registration.  But this patch just unconditionally
      requires connect:search_domains, even when no list could be
      obtained, based on the following observations:
      1. Administrators are unlikely to grant domain:getattr for one
      or all domains while still denying connect:search_domains - a
      user that is able to manage domains will want to be able to
      manage them efficiently, but efficient management includes being
      able to list the domains they can access.  The idea of denying
      connect:search_domains while still granting access to individual
      domains is therefore not adding any real security, but just
      serves as a layer of obscurity to annoy the end user.
      2. In the current implementation, domain events are filtered
      on the client; the server has no idea if a domain filter was
      requested, and must therefore assume that all domain event
      requests are global.  Even if we fix the RPC protocol to
      allow for server-side filtering for newer client/server combos,
      making the connect:serach_domains ACL check conditional on
      whether the domain argument was NULL won't benefit older clients.
      Therefore, we choose to document that connect:search_domains
      is a pre-requisite to any domain event management.
      
      Network events need the same treatment, with the obvious
      change of using connect:search_networks and network:getattr.
      
      * src/access/viraccessperm.h
      (VIR_ACCESS_PERM_CONNECT_SEARCH_DOMAINS)
      (VIR_ACCESS_PERM_CONNECT_SEARCH_NETWORKS): Document additional
      effect of the permission.
      * src/conf/domain_event.h (virDomainEventStateRegister)
      (virDomainEventStateRegisterID): Add new parameter.
      * src/conf/network_event.h (virNetworkEventStateRegisterID):
      Likewise.
      * src/conf/object_event_private.h (virObjectEventStateRegisterID):
      Likewise.
      * src/conf/object_event.c (_virObjectEventCallback): Track a filter.
      (virObjectEventDispatchMatchCallback): Use filter.
      (virObjectEventCallbackListAddID): Register filter.
      * src/conf/domain_event.c (virDomainEventFilter): New function.
      (virDomainEventStateRegister, virDomainEventStateRegisterID):
      Adjust callers.
      * src/conf/network_event.c (virNetworkEventFilter): New function.
      (virNetworkEventStateRegisterID): Adjust caller.
      * src/remote/remote_protocol.x
      (REMOTE_PROC_CONNECT_DOMAIN_EVENT_REGISTER)
      (REMOTE_PROC_CONNECT_DOMAIN_EVENT_REGISTER_ANY)
      (REMOTE_PROC_CONNECT_NETWORK_EVENT_REGISTER_ANY): Generate a
      filter, and require connect:search_domains instead of weaker
      connect:read.
      * src/test/test_driver.c (testConnectDomainEventRegister)
      (testConnectDomainEventRegisterAny)
      (testConnectNetworkEventRegisterAny): Update callers.
      * src/remote/remote_driver.c (remoteConnectDomainEventRegister)
      (remoteConnectDomainEventRegisterAny): Likewise.
      * src/xen/xen_driver.c (xenUnifiedConnectDomainEventRegister)
      (xenUnifiedConnectDomainEventRegisterAny): Likewise.
      * src/vbox/vbox_tmpl.c (vboxDomainGetXMLDesc): Likewise.
      * src/libxl/libxl_driver.c (libxlConnectDomainEventRegister)
      (libxlConnectDomainEventRegisterAny): Likewise.
      * src/qemu/qemu_driver.c (qemuConnectDomainEventRegister)
      (qemuConnectDomainEventRegisterAny): Likewise.
      * src/uml/uml_driver.c (umlConnectDomainEventRegister)
      (umlConnectDomainEventRegisterAny): Likewise.
      * src/network/bridge_driver.c
      (networkConnectNetworkEventRegisterAny): Likewise.
      * src/lxc/lxc_driver.c (lxcConnectDomainEventRegister)
      (lxcConnectDomainEventRegisterAny): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      f9f56340
  7. 07 1月, 2014 1 次提交
    • E
      event: make deregister return value match docs · 31b5bad9
      Eric Blake 提交于
      Ever since their introduction (commit 1509b802 in v0.5.0 for
      virConnectDomainEventRegister, commit 44457238 in v0.8.0 for
      virConnectDomainEventDeregisterAny), the event deregistration
      functions have been documented as returning 0 on success;
      likewise for older registration (only the newer RegisterAny
      must return a non-zero callbackID).  And now that we are
      adding virConnectNetworkEventDeregisterAny for v1.2.1, it
      should have the same semantics.
      
      Fortunately, all of the stateful drivers have been obeying
      the docs and returning 0, thanks to the way the remote_driver
      tracks things (in fact, the RPC wire protocol is unable to
      send a return value for DomainEventRegisterAny, at least not
      without adding a new RPC number).  Well, except for vbox,
      which was always failing deregistration, due to failure to
      set the return value to anything besides its initial -1.
      
      But for local drivers, such as test:///default, we've been
      returning non-zero numbers; worse, the non-zero numbers have
      differed over time.  For example, in Fedora 12 (libvirt 0.8.2),
      calling Register twice would return 0 and 1 [the callbackID
      generated under the hood]; while in Fedora 20 (libvirt 1.1.3),
      it returns 1 and 2 [the number of callbacks registered for
      that event type].  Since we have changed the behavior over
      time, and since it differs by local vs. remote, we can safely
      argue that no one could have been reasonably relying on any
      particular behavior, so we might as well obey the docs, as well
      as prepare callers that might deal with older clients to not be
      surprised if the docs are not strictly followed.
      
      For consistency, this patch fixes the code for all drivers,
      even though it only makes an impact for vbox and for local
      drivers.  By fixing all drivers, future copy and paste from
      a remote driver to a local driver is less likely to
      reintroduce the bug.
      
      Finally, update the testsuite to gain some coverage of the
      issue for local drivers, including the first test of old-style
      domain event registration via function pointer instead of
      event id.
      
      * src/libvirt.c (virConnectDomainEventRegister)
      (virConnectDomainEventDeregister)
      (virConnectDomainEventDeregisterAny): Clarify docs.
      * src/libxl/libxl_driver.c (libxlConnectDomainEventRegister)
      (libxlConnectDomainEventDeregister)
      (libxlConnectDomainEventDeregisterAny): Match documentation.
      * src/lxc/lxc_driver.c (lxcConnectDomainEventRegister)
      (lxcConnectDomainEventDeregister)
      (lxcConnectDomainEventDeregisterAny): Likewise.
      * src/test/test_driver.c (testConnectDomainEventRegister)
      (testConnectDomainEventDeregister)
      (testConnectDomainEventDeregisterAny)
      (testConnectNetworkEventDeregisterAny): Likewise.
      * src/uml/uml_driver.c (umlConnectDomainEventRegister)
      (umlConnectDomainEventDeregister)
      (umlConnectDomainEventDeregisterAny): Likewise.
      * src/vbox/vbox_tmpl.c (vboxConnectDomainEventRegister)
      (vboxConnectDomainEventDeregister)
      (vboxConnectDomainEventDeregisterAny): Likewise.
      * src/xen/xen_driver.c (xenUnifiedConnectDomainEventRegister)
      (xenUnifiedConnectDomainEventDeregister)
      (xenUnifiedConnectDomainEventDeregisterAny): Likewise.
      * src/network/bridge_driver.c
      (networkConnectNetworkEventDeregisterAny): Likewise.
      * tests/objecteventtest.c (testDomainCreateXMLOld): New test.
      (mymain): Run it.
      (testDomainCreateXML): Check return values.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      31b5bad9
  8. 24 12月, 2013 3 次提交
    • D
      libxl: correctly handle affinity reset in virDomainPinVcpu[Flags] · 9375ba2a
      Dario Faggioli 提交于
      By actually removing the <vcpupin> element (from within the
      <cputune> section) from the XML, rather than jus update it with
      a fully set vcpu affinity mask.
      Signed-off-by: NDario Faggioli <dario.faggioli@citrix.com>
      Cc: Jim Fehlig <jfehlig@suse.com>
      Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>
      9375ba2a
    • D
      libxl: implement virDomainPinVcpuFlags · 520c3fbd
      Dario Faggioli 提交于
      And use it to implement libxlDomainPinVcpu(), similarly to what
      happens in the QEMU driver. This way, it is possible to both
      query and change the vcpu affinity of a persistent but not
      running domain.
      
      In face, before this patch, we have:
       # virsh list --all
        Id    Name                           State
       ----------------------------------------------------
        5     debian_32                      running
        -     fedora20_64                    shut off
       # virsh vcpupin fedora20_64 0 2-4 --current
       error: this function is not supported by the connection driver: virDomainPinVcpuFlags
      
      After (same situation as above):
       # virsh vcpupin  fedora20_64 0 2-4 --current
       # virsh vcpupin  fedora20_64 0
       VCPU: CPU Affinity
       ----------------------------------
          0: 2-4
      Signed-off-by: NDario Faggioli <dario.faggioli@citrix.com>
      Cc: Jim Fehlig <jfehlig@suse.com>
      Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>
      520c3fbd
    • D
      libxl: implement virDomainGetVcpuPinInfo · 2682d0d5
      Dario Faggioli 提交于
      So that it is possible to query vcpu related information of
      a persistent but not running domain, like it is for the QEMU
      driver.
      
      In fact, before this patch, we have:
       # virsh list --all
        Id    Name                           State
       ----------------------------------------------------
        5     debian_32                      running
        -     fedora20_64                    shut off
       # virsh vcpuinfo fedora20_64
       error: this function is not supported by the connection driver: virDomainGetVcpuPinInfo
      
      After (same situation as above, i.e., fedora20_64 not running):
       # virsh vcpuinfo fedora20_64
       VCPU:           0
       CPU:            N/A
       State:          N/A
       CPU time        N/A
       CPU Affinity:   yyyyyyyy
      
       VCPU:           1
       CPU:            N/A
       State:          N/A
       CPU time        N/A
       CPU Affinity:   yyyyyyyy
      Signed-off-by: NDario Faggioli <dario.faggioli@citrix.com>
      Cc: Jim Fehlig <jfehlig@suse.com>
      Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>
      2682d0d5
  9. 21 12月, 2013 1 次提交
    • D
      libxl: avoid crashing if calling `virsh numatune' on inactive domain · f9ee91d3
      Dario Faggioli 提交于
      by, in libxlDomainGetNumaParameters(), calling libxl_bitmap_init() as soon as
      possible, which avoids getting to 'cleanup:', where libxl_bitmap_dispose()
      happens, without having initialized the nodemap, and hence crashing after some
      invalid free()-s:
      
       # ./daemon/libvirtd -v
       *** Error in `/home/xen/libvirt.git/daemon/.libs/lt-libvirtd': munmap_chunk(): invalid pointer: 0x00007fdd42592666 ***
       ======= Backtrace: =========
       /lib64/libc.so.6(+0x7bbe7)[0x7fdd3f767be7]
       /lib64/libxenlight.so.4.3(libxl_bitmap_dispose+0xd)[0x7fdd2c88c045]
       /home/xen/libvirt.git/daemon/.libs/../../src/.libs/libvirt_driver_libxl.so(+0x12d26)[0x7fdd2caccd26]
       /home/xen/libvirt.git/src/.libs/libvirt.so.0(virDomainGetNumaParameters+0x15c)[0x7fdd4247898c]
       /home/xen/libvirt.git/daemon/.libs/lt-libvirtd(+0x1d9a2)[0x7fdd42ecc9a2]
       /home/xen/libvirt.git/src/.libs/libvirt.so.0(virNetServerProgramDispatch+0x3da)[0x7fdd424e9eaa]
       /home/xen/libvirt.git/src/.libs/libvirt.so.0(+0x1a6f38)[0x7fdd424e3f38]
       /home/xen/libvirt.git/src/.libs/libvirt.so.0(+0xa81e5)[0x7fdd423e51e5]
       /home/xen/libvirt.git/src/.libs/libvirt.so.0(+0xa783e)[0x7fdd423e483e]
       /lib64/libpthread.so.0(+0x7c53)[0x7fdd3febbc53]
       /lib64/libc.so.6(clone+0x6d)[0x7fdd3f7e1dbd]
      Signed-off-by: NDario Faggili <dario.faggioli@citrix.com>
      Cc: Jim Fehlig <jfehlig@suse.com>
      Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>
      f9ee91d3
  10. 19 12月, 2013 1 次提交
    • D
      libxl: libxl_get_max_cpus returning a libxl error from 4.4 onward · 284d2fc2
      Dario Faggioli 提交于
      Starting from commit 2e82c18c in Xen (will be included in Xen 4.4)
      both libxl_get_max_cpus() and libxl_get_max_nodes() start returning
      a proper libxl error code, in case of failure. This patch fixes
      this in the libxl driver.
      
      Note that, although it is now basically impossible for them to return
      0, that would, theoretically, still be wrong. Also, checking that the
      returned value is '<= 0' makes the code correct for both Xen 4.4 and
      Xen 4.3 (and 4.2), and that is why we go for it (rather than
      just '< 0').
      Signed-off-by: NDario Faggioli <dario.faggioli@citrix.com>
      Cc: Jim Fehlig <jfehlig@suse.com>
      Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>
      Cc: Martin Kletzander <mkletzan@redhat.com>
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      284d2fc2
  11. 10 12月, 2013 3 次提交
  12. 21 11月, 2013 1 次提交
    • E
      maint: fix comma style issues: xen · 86f6748b
      Eric Blake 提交于
      Most of our code base uses space after comma but not before;
      fix the remaining uses before adding a syntax check.
      
      * src/libxl/libxl_driver.c: Consistently use commas.
      * src/xen/xend_internal.c: Likewise.
      * src/xen/xs_internal.c: Likewise.
      * src/xenapi/xenapi_driver.c: Likewise.
      * src/xenapi/xenapi_utils.c: Likewise.
      * src/xenxs/xen_sxpr.c: Likewise.
      * src/xenxs/xen_xm.c: Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      86f6748b
  13. 18 11月, 2013 1 次提交
  14. 13 11月, 2013 1 次提交
    • J
      libxl: Fix Xen 4.4 libxlVmStart logic · 7d58c7fc
      Jason Andryuk 提交于
      ifdef LIBXL_HAVE_DOMAIN_CREATE_RESTORE_PARAMS hides a multi-line body
      for a brace-less else.  Add braces to ensure proper logic is applied.
      
      Without this fix, new domains cannot be started.  Both
      libxl_domain_create_new and libxl_domain_create_restore are called when
      starting a new domain leading to this error:
      libxl: error: libxl.c:324:libxl__domain_rename: domain with name "guest" already exists.
      libxl: error: libxl_create.c:800:initiate_domain_create: cannot make domain: -6
      7d58c7fc
  15. 01 11月, 2013 3 次提交
  16. 24 10月, 2013 1 次提交
    • M
      libxl: Fix possible invalid read · 394d6e0a
      Martin Kletzander 提交于
      According to the following valgrind output, there seems to be a
      invalid limit for the iterator (captured on Fedora 19):
      
      ==3945== Invalid read of size 1
      ==3945==    at 0x1E1FA410: libxlVmStart (libxl_driver.c:475)
      ==3945==    by 0x1E1FAD9A: libxlDomainCreateWithFlags (libxl_driver.c:2633)
      ==3945==    by 0x5187D46: virDomainCreate (libvirt.c:9439)
      ==3945==    by 0x13BAA6: remoteDispatchDomainCreateHelper (remote_dispatch.h:2910)
      ==3945==    by 0x51DE5B9: virNetServerProgramDispatch (virnetserverprogram.c:435)
      ==3945==    by 0x51D93E7: virNetServerHandleJob (virnetserver.c:165)
      ==3945==    by 0x50F5BF4: virThreadPoolWorker (virthreadpool.c:144)
      ==3945==    by 0x50F5670: virThreadHelper (virthreadpthread.c:161)
      ==3945==    by 0x8046C52: start_thread (pthread_create.c:308)
      ==3945==    by 0x8758E1C: clone (clone.S:113)
      ==3945==  Address 0x23424d81 is 0 bytes after a block of size 1 alloc'd
      ==3945==    at 0x4A08121: calloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==3945==    by 0x50B1F8C: virAllocN (viralloc.c:189)
      ==3945==    by 0x1E1FA3CA: libxlVmStart (libxl_driver.c:468)
      ==3945==    by 0x1E1FAD9A: libxlDomainCreateWithFlags (libxl_driver.c:2633)
      ==3945==    by 0x5187D46: virDomainCreate (libvirt.c:9439)
      ==3945==    by 0x13BAA6: remoteDispatchDomainCreateHelper (remote_dispatch.h:2910)
      ==3945==    by 0x51DE5B9: virNetServerProgramDispatch (virnetserverprogram.c:435)
      ==3945==    by 0x51D93E7: virNetServerHandleJob (virnetserver.c:165)
      ==3945==    by 0x50F5BF4: virThreadPoolWorker (virthreadpool.c:144)
      ==3945==    by 0x50F5670: virThreadHelper (virthreadpthread.c:161)
      ==3945==    by 0x8046C52: start_thread (pthread_create.c:308)
      ==3945==    by 0x8758E1C: clone (clone.S:113)
      ==3945==
      
      Related: https://bugzilla.redhat.com/show_bug.cgi?id=1013045Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      394d6e0a
  17. 05 9月, 2013 2 次提交
    • J
      libxl: Unconditionally call virSysinfoRead() on driver init · b78e8cb2
      Jim Fehlig 提交于
      No need to check if privileged when reading hostsysinfo, since
      that check was already done in libxlDriverShouldLoad().  The
      libxl driver fails to load if not privileged.
      b78e8cb2
    • J
      libxl: Fix Coverity warning · 5236aed8
      Jim Fehlig 提交于
      John Ferlan reported the following Coverity warning:
      
      In libxlDomainCoreDump() Coverity has noted a FORWARD_NULL reference:
      
      2004 	    if ((flags & VIR_DUMP_CRASH) && !vm->persistent) {
      2005 	        virDomainObjListRemove(driver->domains, vm);
      
      (20) Event assign_zero: 	Assigning: "vm" = "NULL".
      Also see events: 	[var_deref_model]
      
      2006 	        vm = NULL;
      2007 	    }
      2008
      2009 	    ret = 0;
      2010
      2011 	cleanup_unpause:
      
      (21) Event var_deref_model: 	Passing null pointer "vm" to function
           "virDomainObjIsActive(virDomainObjPtr)", which dereferences it. [details]
      Also see events: 	[assign_zero]
      
      2012 	    if (virDomainObjIsActive(vm) && paused) {
      2013 	        if (libxl_domain_unpause(priv->ctx, dom->id) != 0) {
      2014 	            virReportError(VIR_ERR_INTERNAL_ERROR,
      
      Removing the vm from domain obj list and setting it to NULL can be
      done in the previous 'if (flags & VIR_DUMP_CRASH)' conditional.  Fix
      the Coverity warning by ensuring vm is not NULL before testing if it
      is still active.
      5236aed8
  18. 04 9月, 2013 11 次提交
    • J
      libxl: Use standard format for source file copyright notice · edd60d9c
      Jim Fehlig 提交于
      Change source file copyright notice to prevailing libvirt style.
      edd60d9c
    • J
      libxl: Add libxlDomObjFromDomain · 0d87fd0a
      Jim Fehlig 提交于
      Similar to the QEMU and LXC drivers, add a helper function to
      lookup a domain, and use it instead of much copy and paste.
      0d87fd0a
    • J
      libxl: Remove unnecessary driver locking · 21bdbb82
      Jim Fehlig 提交于
      Now that most fields of libxlDriverPrivate struct are immutable
      or self-locking, there is no need to acquire the driver lock in
      much of the libxl driver.
      21bdbb82
    • J
      libxl: Move driver lock/unlock to libxl_conf · cf735fe0
      Jim Fehlig 提交于
      Move the libxl driver lock/unlock functions from libxl_driver.c
      to libxl_conf.h so they can be used by other source files.
      cf735fe0
    • J
      libxl: Use atomic ops for driver->nactive · 6cd43d36
      Jim Fehlig 提交于
      6cd43d36
    • J
      libxl: Introduce libxlDriverConfig object · d9f19c30
      Jim Fehlig 提交于
      The libxlDriverPrivate struct contains an variety of data with
      varying access needs. Similar to the QEMU and LXC drivers,
      move all the static config data into a dedicated libxlDriverConfig
      object. The only locking requirement is to hold the driver lock
      while obtaining an instance of libxlDriverConfig. Once a reference
      is held on the config object, it can be used completely lockless
      since it is immutable.
      d9f19c30
    • J
      libxl: User per-domain ctx in libxlDomainGetInfo · 41475876
      Jim Fehlig 提交于
      libxlDomainGetInfo() uses the driver-wide libxl ctx when
      it would be more appropriate to use the per-domain ctx
      associated with the domain.  Switch to using the per-domain
      libxl ctx.
      41475876
    • J
      libxl: Add libxl_version_info to libxlDriverPrivate · cb0d49af
      Jim Fehlig 提交于
      libxl version info is static data as far as the libxl driver
      is concerned, so retrieve this info when the driver is initialized
      and stash it in the libxlDriverPrivate object.  Subsequently use
      the stashed info instead of repeatedly calling libxl_get_version_info().
      cb0d49af
    • J
      libxl: Earlier detection of not running on Xen · 2f8d0f90
      Jim Fehlig 提交于
      Detect early on in libxl driver initialization if the driver
      should be loaded at all, avoiding needless initialization steps
      that only have to be undone later.  While at it, move the
      detection to a helper function to improve readability.
      
      After detecting that the driver should be loaded, subsequent
      failures such as initializing the log stream, allocating libxl
      ctx, etc. should be treated as failure to initialize the driver.
      2f8d0f90
    • J
      libxl: Introduce libxl_domain.[ch] · 12315cd7
      Jim Fehlig 提交于
      Create libxl_domain.[ch] and move all functions operating on
      libxlDomainObjPrivate to these files.  This will be useful for
      future patches that e.g. add job support for libxlDomainObjPrivate.
      12315cd7
    • J
      libxl: Move detection of autoballoon to libxl_conf · c9d5432d
      Jim Fehlig 提交于
      Detecting whether or not to autoballoon is configuration related,
      so move the code to libxl_conf.
      c9d5432d
  19. 22 8月, 2013 1 次提交
    • J
      libxl: fix libvirtd crash when reconnecting domains · 4d1cf65a
      Jim Fehlig 提交于
      More fallout from commit d72ef888.  When reconnecting to running
      domains, the libxl_ctx in libxlDomainObjPrivate was used before
      initializing it, causing a segfault in libxl and consequently
      crashing libvirtd.
      
      Initialize the libxlDomainObjPrivate libxl_ctx in libxlReconnectDomain,
      and while at it use this ctx in libxlReconnectDomain instead of the
      driver-wide ctx.
      4d1cf65a