1. 24 11月, 2014 1 次提交
    • P
      event: Add guest agent lifecycle event · 1a460910
      Peter Krempa 提交于
      As qemu is now able to notify us about change of the channel state used
      for communication with the guest agent we now can more precisely track
      the state of the guest agent.
      
      To allow notifying management apps this patch implements a new event
      that will be triggered on changes of the guest agent state.
      1a460910
  2. 15 11月, 2014 1 次提交
  3. 25 9月, 2014 2 次提交
    • P
      tunable_event: extend debug message and tweak limit for remote message · ceb7c90e
      Pavel Hrdina 提交于
      It would be nice to also print a params pointer and number of params in
      the debug message and the previous limit for number of params in the rpc
      message was too large. The 2048 params will be enough for future events.
      Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
      ceb7c90e
    • M
      Introduce virNodeAllocPages · fa5c5580
      Michal Privoznik 提交于
      A long time ago in a galaxy far, far away it has been decided
      that libvirt will manage not only domains but host as well. And
      with my latest work on qemu driver supporting huge pages, we miss
      the cherry on top: an API to allocate huge pages on the run.
      Currently users are forced to log into the host and adjust the
      huge pages pool themselves.  However, with this API the problem
      is gone - they can both size up and size down the pool.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      fa5c5580
  4. 24 9月, 2014 2 次提交
  5. 18 9月, 2014 1 次提交
  6. 04 9月, 2014 1 次提交
  7. 28 8月, 2014 2 次提交
  8. 27 8月, 2014 2 次提交
    • E
      API: Tweak virDomainOpenGraphics to return fd directly · b259e459
      Eric Blake 提交于
      Let's fix this before we bake in a painful API.  Since we know
      that we have exactly one non-negative fd on success, we might
      as well return the fd directly instead of forcing the user to
      pass in a pointer.  Furthermore, I found some memory and fd
      leaks while reviewing the code - the idea is that on success,
      libvirtd will have handed two fds in two different directions:
      one to qemu, and one to the RPC client.
      
      * include/libvirt/libvirt.h.in (virDomainOpenGraphicsFD): Drop
      unneeded parameter.
      * src/driver.h (virDrvDomainOpenGraphicsFD): Likewise.
      * src/libvirt.c (virDomainOpenGraphicsFD): Adjust interface to
      return fd directly.
      * daemon/remote.c (remoteDispatchDomainOpenGraphicsFd): Adjust
      semantics.
      * src/qemu/qemu_driver.c (qemuDomainOpenGraphicsFD): Likewise,
      and plug fd leak.
      * src/remote/remote_driver.c (remoteDomainOpenGraphicsFD):
      Likewise, and plug memory and fd leak.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      b259e459
    • J
      Add RPC implementation for virDomainOpenGraphicsFd · 408aae38
      Ján Tomko 提交于
      408aae38
  9. 27 6月, 2014 1 次提交
  10. 24 6月, 2014 3 次提交
    • J
      Rework remoteSerializeDHCPLease · 364586d3
      Ján Tomko 提交于
      Don't leak the temporary variables on success if NULL is returned
      for that field.
      
      Don't dereference NULL on failure to allocate some of the temporaries.
      
      Introduced by commit 990c3b65
      364586d3
    • D
      Change 'interface' to 'iface' in virNetworkDHCPLease · 6512c8b4
      Daniel P. Berrange 提交于
      Variables/fields named 'interface' clash with system
      header symbols on some platforms.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      6512c8b4
    • N
      net-dhcp-leases: Implement the remote protocol · 990c3b65
      Nehal J Wani 提交于
      Implement RPC calls for virNetworkGetDHCPLeases, virNetworkGetDHCPLeasesForMAC
      
      daemon/remote.c
         * Define remoteSerializeNetworkDHCPLeases,
                  remoteDispatchNetworkGetDHCPLeases
         * Define remoteDispatchNetworkGetDHCPLeasesForMAC
         * Define helper function remoteSerializeDHCPLease
      
      src/remote/remote_driver.c
         * Define remoteNetworkGetDHCPLeases
         * Define remoteNetworkGetDHCPLeasesForMAC
         * Define helper function remoteSerializeDHCPLease
      
      src/remote/remote_protocol.x
         * New RPC procedure: REMOTE_PROC_NETWORK_GET_DHCP_LEASES
         * Define structs remote_network_dhcp_leases, remote_network_get_dhcp_leases_args,
                          remote_network_get_dhcp_leases_ret
         * New RPC procedure: REMOTE_PROC_NETWORK_GET_DHCP_LEASES_FOR_MAC
         * Define structs remote_network_dhcp_leases_for_mac, remote_network_get_dhcp_leases_for_mac_args,
                          remote_network_get_dhcp_leases_for_mac_ret
      
      src/remote_protocol-structs
         * New structs added
      
      src/rpc/gendispatch.pl
         * Add exception (s/Dhcp/DHCP) for auto-generating names of the remote functions
           in daemon/remote_dispatch.h
      990c3b65
  11. 19 6月, 2014 2 次提交
    • M
      Introduce virNodeGetFreePages · 34f2d031
      Michal Privoznik 提交于
      The aim of the API is to get information on number of free pages
      on the system. The API behaves similar to the
      virNodeGetCellsFreeMemory(). User passes starting NUMA cell, the
      count of nodes that he's interested in, pages sizes (yes,
      multiple sizes can be queried at once) and the counts are
      returned in an array.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      34f2d031
    • E
      blockjob: use stable disk string in job event · 1bfe73a1
      Eric Blake 提交于
      When the block job event was first added, it was for block pull,
      where the active layer of the disk remains the same name.  It was
      also in a day where we only cared about local files, and so we
      always had a canonical absolute file name.  But two things have
      changed since then: we now have network disks, where determining
      a single absolute string does not really make sense; and we have
      two-phase jobs (copy and active commit) where the name of the
      active layer changes between the first event (ready, on the old
      name) and second (complete, on the pivoted name).
      
      Adam Litke reported that having an unstable string between events
      makes life harder for clients.  Furthermore, all of our API that
      operate on a particular disk of a domain accept multiple strings:
      not only the absolute name of the active layer, but also the
      destination device name (such as 'vda').  As this latter name is
      stable, even for network sources, it serves as a better string
      to supply in block job events.
      
      But backwards-compatibility demands that we should not change the
      name handed to users unless they explicitly request it.  Therefore,
      this patch adds a new event, BLOCK_JOB_2 (alas, I couldn't think of
      any nicer name - but at least Migrate2 and Migrate3 are precedent
      for a number suffix).  We must double up on emitting both old-style
      and new-style events according to what clients have registered for
      (see also how IOError and IOErrorReason emits double events, but
      there the difference was a larger struct rather than changed
      meaning of one of the struct members).
      
      Unfortunately, adding a new event isn't something that can easily
      be broken into pieces, so the commit is rather large.
      
      * include/libvirt/libvirt.h.in (virDomainEventID): Add a new id
      for VIR_DOMAIN_EVENT_ID_BLOCK_JOB_2.
      (virConnectDomainEventBlockJobCallback): Document new semantics.
      * src/conf/domain_event.c (_virDomainEventBlockJob): Rename field,
      to ensure we catch all clients.
      (virDomainEventBlockJobNew): Add parameter.
      (virDomainEventBlockJobDispose)
      (virDomainEventBlockJobNewFromObj)
      (virDomainEventBlockJobNewFromDom)
      (virDomainEventDispatchDefaultFunc): Adjust clients.
      (virDomainEventBlockJob2NewFromObj)
      (virDomainEventBlockJob2NewFromDom): New functions.
      * src/conf/domain_event.h: Add new prototypes.
      * src/libvirt_private.syms (domain_event.h): Export new functions.
      * src/qemu/qemu_driver.c (qemuDomainBlockJobImpl): Generate two
      different events.
      * src/qemu/qemu_process.c (qemuProcessHandleBlockJob): Likewise.
      * src/remote/remote_protocol.x
      (remote_domain_event_block_job_2_msg): New struct.
      (REMOTE_PROC_DOMAIN_EVENT_BLOCK_JOB_2): New RPC.
      * src/remote/remote_driver.c
      (remoteDomainBuildEventBlockJob2): New handler.
      (remoteEvents): Register new event.
      * daemon/remote.c (remoteRelayDomainEventBlockJob2): New handler.
      (domainEventCallbacks): Register new event.
      * tools/virsh-domain.c (vshEventCallbacks): Likewise.
      (vshEventBlockJobPrint): Adjust client.
      * src/remote_protocol-structs: Regenerate.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      1bfe73a1
  12. 15 5月, 2014 1 次提交
    • M
      Introduce virDomain{Get,Set}Time APIs · 0abb3693
      Michal Privoznik 提交于
      These APIs allow users to get or set time in a domain, which may come
      handy if the domain has been resumed just recently and NTP is not
      configured or hasn't kicked in yet and the guest is running
      something time critical. In addition, NTP may refuse to re-set the clock
      if the skew is too big.
      
      In addition, new ACL attribute is introduced 'set_time'.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      0abb3693
  13. 25 3月, 2014 1 次提交
  14. 21 3月, 2014 1 次提交
    • E
      qemu: wire up RPC for qemu monitor events · e7708a1c
      Eric Blake 提交于
      These are the first async events in the qemu protocol, so this
      patch looks rather big compared to most RPC additions.  However,
      a large majority of this patch is just mechanical copy-and-paste
      from recently-added network events.  It didn't help that this
      is also the first virConnect rather than virDomain prefix
      associated with a qemu-specific API.
      
      * src/remote/qemu_protocol.x (qemu_*_domain_monitor_event_*): New
      structs and RPC messages.
      * src/rpc/gendispatch.pl: Adjust naming conventions.
      * daemon/libvirtd.h (daemonClientPrivate): Track qemu events.
      * daemon/remote.c (remoteClientFreeFunc): Likewise.
      (remoteRelayDomainQemuMonitorEvent)
      (qemuDispatchConnectDomainMonitorEventRegister)
      (qemuDispatchConnectDomainMonitorEventDeregister): New functions.
      * src/remote/remote_driver.c (qemuEvents): Handle qemu events.
      (doRemoteOpen): Register for events.
      (remoteNetworkBuildEventLifecycle)
      (remoteConnectDomainQemuMonitorEventRegister)
      (remoteConnectDomainQemuMonitorEventDeregister): New functions.
      * src/qemu_protocol-structs: Regenerate.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      e7708a1c
  15. 18 3月, 2014 3 次提交
  16. 04 3月, 2014 1 次提交
    • E
      util: make it easier to grab only regular command exit · b9dd878f
      Eric Blake 提交于
      Auditing all callers of virCommandRun and virCommandWait that
      passed a non-NULL pointer for exit status turned up some
      interesting observations.  Many callers were merely passing
      a pointer to avoid the overall command dying, but without
      caring what the exit status was - but these callers would
      be better off treating a child death by signal as an abnormal
      exit.  Other callers were actually acting on the status, but
      not all of them remembered to filter by WIFEXITED and convert
      with WEXITSTATUS; depending on the platform, this can result
      in a status being reported as 256 times too big.  And among
      those that correctly parse the output, it gets rather verbose.
      Finally, there were the callers that explicitly checked that
      the status was 0, and gave their own message, but with fewer
      details than what virCommand gives for free.
      
      So the best idea is to move the complexity out of callers and
      into virCommand - by default, we return the actual exit status
      already cleaned through WEXITSTATUS and treat signals as a
      failed command; but the few callers that care can ask for raw
      status and act on it themselves.
      
      * src/util/vircommand.h (virCommandRawStatus): New prototype.
      * src/libvirt_private.syms (util/command.h): Export it.
      * docs/internals/command.html.in: Document it.
      * src/util/vircommand.c (virCommandRawStatus): New function.
      (virCommandWait): Adjust semantics.
      * tests/commandtest.c (test1): Test it.
      * daemon/remote.c (remoteDispatchAuthPolkit): Adjust callers.
      * src/access/viraccessdriverpolkit.c (virAccessDriverPolkitCheck):
      Likewise.
      * src/fdstream.c (virFDStreamCloseInt): Likewise.
      * src/lxc/lxc_process.c (virLXCProcessStart): Likewise.
      * src/qemu/qemu_command.c (qemuCreateInBridgePortWithHelper):
      Likewise.
      * src/xen/xen_driver.c (xenUnifiedXendProbe): Simplify.
      * tests/reconnect.c (mymain): Likewise.
      * tests/statstest.c (mymain): Likewise.
      * src/bhyve/bhyve_process.c (virBhyveProcessStart)
      (virBhyveProcessStop): Don't overwrite virCommand error.
      * src/libvirt.c (virConnectAuthGainPolkit): Likewise.
      * src/openvz/openvz_driver.c (openvzDomainGetBarrierLimit)
      (openvzDomainSetBarrierLimit): Likewise.
      * src/util/virebtables.c (virEbTablesOnceInit): Likewise.
      * src/util/viriptables.c (virIpTablesOnceInit): Likewise.
      * src/util/virnetdevveth.c (virNetDevVethCreate): Fix debug
      message.
      * src/qemu/qemu_capabilities.c (virQEMUCapsInitQMP): Add comment.
      * src/storage/storage_backend_iscsi.c
      (virStorageBackendISCSINodeUpdate): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      b9dd878f
  17. 13 2月, 2014 4 次提交
    • E
      event: pass reason for PM events · 6831c1d3
      Eric Blake 提交于
      Commit 57ddcc23 (v0.9.11) introduced the pmwakeup event, with
      an optional 'reason' field reserved for possible future expansion.
      But it failed to wire the field through RPC, so even if we do
      add a reason in the future, we will be unable to get it back
      to the user.
      
      Worse, commit 7ba5defb (v1.0.0) repeated the same mistake with
      the pmsuspend_disk event.
      
      As long as we are adding new RPC calls, we might as well fix
      the events to actually match the signature so that we don't have
      to add yet another RPC in the future if we do decide to start
      using the reason field.
      
      * src/remote/remote_protocol.x
      (remote_domain_event_callback_pmwakeup_msg)
      (remote_domain_event_callback_pmsuspend_msg)
      (remote_domain_event_callback_pmsuspend_disk_msg): Add reason
      field.
      * daemon/remote.c (remoteRelayDomainEventPMWakeup)
      (remoteRelayDomainEventPMSuspend)
      (remoteRelayDomainEventPMSuspendDisk): Pass reason to client.
      * src/conf/domain_event.h (virDomainEventPMWakeupNewFromDom)
      (virDomainEventPMSuspendNewFromDom)
      (virDomainEventPMSuspendDiskNewFromDom): Require additional
      parameter.
      * src/conf/domain_event.c (virDomainEventPMClass): New class.
      (virDomainEventPMDispose): New function.
      (virDomainEventPMWakeupNew*, virDomainEventPMSuspendNew*)
      (virDomainEventPMSuspendDiskNew*)
      (virDomainEventDispatchDefaultFunc): Use new class.
      * src/remote/remote_driver.c (remoteDomainBuildEvent*PM*): Pass
      reason through.
      * src/remote_protocol-structs: Regenerate.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      6831c1d3
    • E
      event: convert remaining domain events to new style · 158795d2
      Eric Blake 提交于
      Following the patterns established by lifecycle events, this
      creates all the new RPC calls needed to pass callback IDs
      for every domain event, and changes the limits in client and
      server codes to use modern style when possible.
      
      I've tested all combinations: both 'old client and new server'
      and 'new client and old server' continue to work with the old
      RPCs, and 'new client and new server' benefit from server-side
      filtering with the new RPCs.
      
      * src/remote/remote_protocol.x (REMOTE_PROC_DOMAIN_EVENT_*): Add
      REMOTE_PROC_DOMAIN_EVENT_CALLBACK_* counterparts.
      * daemon/remote.c (remoteRelayDomainEvent*): Send callbackID via
      newer RPC when used with new-style registration.
      (remoteDispatchConnectDomainEventCallbackRegisterAny): Extend to
      cover all domain events.
      * src/remote/remote_driver.c (remoteDomainBuildEvent*): Add new
      Callback and Helper functions.
      (remoteEvents): Match order of RPC numbers, register new handlers.
      (remoteConnectDomainEventRegisterAny)
      (remoteConnectDomainEventDeregisterAny): Extend to cover all
      domain events.
      * src/remote_protocol-structs: Regenerate.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      158795d2
    • E
      event: server RPC protocol tweaks for domain lifecycle events · 03722957
      Eric Blake 提交于
      This patch adds some new RPC call numbers, but for ease of review,
      they sit idle until a later patch adds the client counterpart to
      drive the new RPCs.  Also for ease of review, I limited this patch
      to just the lifecycle event; although converting the remaining
      15 domain events will be quite mechanical.  On the server side,
      we have to have a function per RPC call, largely with duplicated
      bodies (the key difference being that we store in our callback
      opaque pointer whether events should be fired with old or new
      style); meanwhile, a single function can drive multiple RPC
      messages.  With a strategic choice of XDR struct layout, we can
      make the event generation code for both styles fairly compact.
      
      I debated about adding a tri-state witness variable per
      connection (values 'unknown', 'legacy', 'modern').  It would start
      as 'unknown', move to 'legacy' if any RPC call is made to a legacy
      event call, and move to 'modern' if the feature probe is made;
      then the event code could issue an error if the witness state is
      incorrect (a legacy RPC call while in 'modern', a modern RPC call
      while in 'unknown' or 'legacy', and a feature probe while in
      'legacy' or 'modern').  But while it might prevent odd behavior
      caused by protocol fuzzing, I don't see that it would prevent
      any security holes, so I considered it bloat.
      
      Note that sticking @acl markers on the new RPCs generates unused
      functions in access/viraccessapicheck.c, because there is no new
      API call that needs to use the new checks; however, having a
      consistent .x file is worth the dead code.
      
      * src/libvirt_internal.h (VIR_DRV_FEATURE_REMOTE_EVENT_CALLBACK):
      New feature.
      * src/remote/remote_protocol.x
      (REMOTE_PROC_CONNECT_DOMAIN_EVENT_CALLBACK_REGISTER_ANY)
      (REMOTE_PROC_CONNECT_DOMAIN_EVENT_CALLBACK_DEREGISTER_ANY)
      (REMOTE_PROC_DOMAIN_EVENT_CALLBACK_LIFECYCLE): New RPCs.
      * daemon/remote.c (daemonClientCallback): Add field.
      (remoteDispatchConnectDomainEventCallbackRegisterAny)
      (remoteDispatchConnectDomainEventCallbackDeregisterAny): New
      functions.
      (remoteDispatchConnectDomainEventRegisterAny)
      (remoteDispatchConnectDomainEventDeregisterAny): Mark legacy use.
      (remoteRelayDomainEventLifecycle): Change message based on legacy
      or new use.
      (remoteDispatchConnectSupportsFeature): Advertise new feature.
      * src/remote_protocol-structs: Regenerate.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      03722957
    • E
      event: dynamically manage server-side RPC domain events · 047fd2e8
      Eric Blake 提交于
      This patch continues the earlier conversion made for network
      events, with a goal of introducing server-side event filtering
      in a later patch.  Actual behavior is unchanged without
      further RPC changes.
      
      * daemon/libvirtd.h (daemonClientPrivate): Alter the tracking of
      domain events.
      * daemon/remote.c (remoteClientInitHook, remoteClientFreeFunc)
      (remoteRelayDomainEvent*)
      (remoteDispatchConnectDomainEventRegister)
      (remoteDispatchConnectDomainEventRegisterAny): Track domain
      callbacks dynamically.
      047fd2e8
  18. 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
  19. 16 1月, 2014 2 次提交
    • E
      event: wire up RPC for server-side network event filtering · 8d9d098b
      Eric Blake 提交于
      We haven't had a release with network events yet, so we are free
      to fix the RPC so that it actually does what we want.  Doing
      client-side filtering of per-network events is inefficient if a
      connection is only interested in events on a single network out
      of hundreds available on the server.  But to do server-side
      per-network filtering, the server needs to know which network
      to filter on - so we need to pass an optional network over on
      registration.  Furthermore, it is possible to have a client with
      both a global and per-network filter; in the existing code, the
      server sends only one event and the client replicates to both
      callbacks.  But with server-side filtering, the server will send
      the event twice, so we need a way for the client to know which
      callbackID is sending an event, to ensure that the client can
      filter out events from a registration that does not match the
      callbackID from the server.  Likewise, the existing style of
      deregistering by eventID alone is fine; but in the new style,
      we have to remember which callbackID to delete.
      
      This patch fixes the RPC wire definition to contain all the
      needed pieces of information, and hooks into the server and
      client side improvements of the previous patches, in order to
      switch over to full server-side filtering of network events.
      Also, since we fixed this in time, all released versions of
      libvirtd that support network events also support per-network
      filtering, so we can hard-code that assumption into
      network_event.c.
      
      Converting domain events to server-side filtering will require
      the introduction of new RPC numbers, as well as a server
      feature bit that the client can use to tell whether to use
      old-style (server only supports global events) or new-style
      (server supports filtered events), so that is deferred to a
      later set of patches.
      
      * src/conf/network_event.c (virNetworkEventStateRegisterClient):
      Assume server-side filtering.
      * src/remote/remote_protocol.x
      (remote_connect_network_event_register_any_args): Add network
      argument.
      (remote_connect_network_event_register_any_ret): Return callbackID
      instead of count.
      (remote_connect_network_event_deregister_any_args): Pass
      callbackID instead of eventID.
      (remote_connect_network_event_deregister_any_ret): Drop unused
      type.
      (remote_network_event_lifecycle_msg): Add callbackID.
      * daemon/remote.c
      (remoteDispatchConnectNetworkEventDeregisterAny): Drop unused arg,
      and deal with callbackID from client.
      (remoteRelayNetworkEventLifecycle): Pass callbackID.
      (remoteDispatchConnectNetworkEventRegisterAny): Likewise, and
      recognize non-NULL network.
      * src/remote/remote_driver.c
      (remoteConnectNetworkEventRegisterAny): Pass network, and track
      server side id.
      (remoteConnectNetworkEventDeregisterAny): Deregister by callback id.
      (remoteNetworkBuildEventLifecycle): Pass remote id to event queue.
      * src/remote_protocol-structs: Regenerate.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      8d9d098b
    • E
      event: track callbackID on daemon side of RPC · b9d14ef0
      Eric Blake 提交于
      Right now, the daemon side of RPC events is hard-coded to at most
      one callback per eventID.  But when there are hundreds of domains
      or networks coupled and multiple conections, then sending every
      event to every connection that wants an event, even for the
      connections that only care about events for a particular object,
      is inefficient.  In order to track more than one callback in the
      server, we need to store callbacks by more than just their
      eventID.  This patch rearranges the daemon side to store network
      callbacks in a dynamic array, which can eventually be used for
      multiple callbacks of the same eventID, although actual behavior
      is unchanged without further patches to the RPC protocol.  For
      ease of review, domain events are saved for a later patch, as
      they touch more code.
      
      While at it, fix a bug where a malicious client could send a
      negative eventID to cause network event registration to access
      outside of array bounds (thankfully not a CVE, since domain
      events were already doing the bounds check, and since network
      events have not been released).
      
      * daemon/libvirtd.h (daemonClientPrivate): Alter the tracking of
      network events.
      * daemon/remote.c (daemonClientEventCallback): New struct.
      (remoteEventCallbackFree): New function.
      (remoteClientInitHook, remoteRelayNetworkEventLifecycle)
      (remoteClientFreeFunc)
      (remoteDispatchConnectNetworkEventRegisterAny): Track network
      callbacks differently.
      (remoteDispatchConnectNetworkEventDeregisterAny): Enforce bounds.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      b9d14ef0
  20. 11 12月, 2013 1 次提交
  21. 10 12月, 2013 1 次提交
  22. 18 10月, 2013 1 次提交
  23. 27 9月, 2013 1 次提交
    • D
      Fix crash in libvirtd when events are registered & ACLs active · 8294aa0c
      Daniel P. Berrange 提交于
      When a client disconnects from libvirtd, all event callbacks
      must be removed. This involves running the public API
      
        virConnectDomainEventDeregisterAny
      
      This code does not run in normal API dispatch context, so no
      identity was set. The result was that the access control drivers
      denied the attempt to deregister callbacks. The callbacks thus
      continued to trigger after the client was free'd causing fairly
      predictable use of free memory & a crash.
      
      This can be triggered by any client with readonly access when
      the ACL drivers are active.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      8294aa0c
  24. 24 9月, 2013 1 次提交
  25. 20 9月, 2013 1 次提交
  26. 19 9月, 2013 1 次提交
    • D
      Fix crash in remoteDispatchDomainMemoryStats (CVE-2013-4296) · e7f400a1
      Daniel P. Berrange 提交于
      The 'stats' variable was not initialized to NULL, so if some
      early validation of the RPC call fails, it is possible to jump
      to the 'cleanup' label and VIR_FREE an uninitialized pointer.
      This is a security flaw, since the API can be called from a
      readonly connection which can trigger the validation checks.
      
      This was introduced in release v0.9.1 onwards by
      
        commit 158ba873
        Author: Daniel P. Berrange <berrange@redhat.com>
        Date:   Wed Apr 13 16:21:35 2011 +0100
      
          Merge all returns paths from dispatcher into single path
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      e7f400a1
  27. 18 9月, 2013 1 次提交
    • D
      Add support for using 3-arg pkcheck syntax for process (CVE-2013-4311) · 922b7fda
      Daniel P. Berrange 提交于
      With the existing pkcheck (pid, start time) tuple for identifying
      the process, there is a race condition, where a process can make
      a libvirt RPC call and in another thread exec a setuid application,
      causing it to change to effective UID 0. This in turn causes polkit
      to do its permission check based on the wrong UID.
      
      To address this, libvirt must get the UID the caller had at time
      of connect() (from SO_PEERCRED) and pass a (pid, start time, uid)
      triple to the pkcheck program.
      
      This fix requires that libvirt is re-built against a version of
      polkit that has the fix for its CVE-2013-4288, so that libvirt
      can see 'pkg-config --variable pkcheck_supports_uid polkit-gobject-1'
      Signed-off-by: NColin Walters <walters@redhat.com>
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      922b7fda