Skip to content

storage sheepdog: allow to specify redundancy level - #1

Closed
vtolstov wants to merge 1 commit into
libvirt:masterfrom
sheepdog:copies
Closed

vtolstov wants to merge 1 commit into
libvirt:masterfrom
sheepdog:copies

Conversation

@vtolstov

Copy link
Copy Markdown
Contributor

Some storage backends allows to specify per volume redundancy options.
Sheepdog use x format for specify copies, and x:y format to specify
data and parity block count.

Signed-off-by: Alexey Tyabin [email protected]
Signed-off-by: Vasiliy Tolstov [email protected]

Some storage backends allows to specify per volume redundancy options.
Sheepdog use x format for specify copies, and x:y format to specify
data and parity block count.

Signed-off-by: Alexey Tyabin <[email protected]>
Signed-off-by: Vasiliy Tolstov <[email protected]>
@berrange

Copy link
Copy Markdown
Contributor

Libvirt does not use pull requests. This is a readonly mirror only.

@berrange berrange closed this Nov 19, 2015
@vtolstov

Copy link
Copy Markdown
Contributor Author

sorry about the noise, i'm try to create pr between own branches in my fork and miss that the pr created to original repo.

crobinso pushed a commit to crobinso/libvirt that referenced this pull request Jan 9, 2016
While this thread is cleaning up the client and connection objects:
 libvirt#2  virFileReadAll (path=0x7f28780012b0 "/proc/1319/stat", maxlen=maxlen@entry=1024, buf=buf@entry=0x7f289c60fc40) at util/virfile.c:1287
 libvirt#3  0x00007f28adbb1539 in virProcessGetStartTime (pid=<optimized out>, timestamp=timestamp@entry=0x7f289c60fc98) at util/virprocess.c:838
 libvirt#4  0x00007f28adb91981 in virIdentityGetSystem () at util/viridentity.c:151
 libvirt#5  0x00007f28ae73f17c in remoteClientFreeFunc (data=<optimized out>) at remote.c:1131
 libvirt#6  0x00007f28adcb7f33 in virNetServerClientDispose (obj=0x7f28aecad180) at rpc/virnetserverclient.c:858
 libvirt#7  0x00007f28adba8eeb in virObjectUnref (anyobj=<optimized out>) at util/virobject.c:265
 libvirt#8  0x00007f28ae74ad05 in virNetServerHandleJob (jobOpaque=<optimized out>, opaque=0x7f28aec93ff0) at rpc/virnetserver.c:205
 libvirt#9  0x00007f28adbbef4e in virThreadPoolWorker (opaque=opaque@entry=0x7f28aec88030) at util/virthreadpool.c:145

In stack frame libvirt#6 the client->identity object got unref'd, but the code
that removes the event callbacks in frame libvirt#5 did not run yet as we are
trying to obtain the system identity (frames libvirt#4, libvirt#3, libvirt#2).

In other thead:
 #0  virObjectUnref (anyobj=anyobj@entry=0x7f288c162c60) at util/virobject.c:264
        klass = 0xdeadbeef
        obj = 0x7f288c162c60
 libvirt#1  0x00007f28ae71c709 in remoteRelayDomainEventCheckACL (client=<optimized out>, conn=<optimized out>, dom=dom@entry=0x7f28aecaafc0) at remote.c:164
 libvirt#2  0x00007f28ae71fc83 in remoteRelayDomainEventTrayChange (conn=<optimized out>, dom=0x7f28aecaafc0, ... ) at remote.c:717
 libvirt#3  0x00007f28adc04e53 in virDomainEventDispatchDefaultFunc (conn=0x7f287c0009a0, event=0x7f28aecab1a0, ...) at conf/domain_event.c:1455
 libvirt#4  0x00007f28adc03831 in virObjectEventStateDispatchCallbacks (callbacks=<optimized out>, ....) at conf/object_event.c:724
 libvirt#5  virObjectEventStateQueueDispatch (callbacks=0x7f288c083730, queue=0x7fff51f90030, state=0x7f288c18da20) at conf/object_event.c:738
 libvirt#6  virObjectEventStateFlush (state=0x7f288c18da20) at conf/object_event.c:816
 libvirt#7  virObjectEventTimer (timer=<optimized out>, opaque=0x7f288c18da20) at conf/object_event.c:562
 libvirt#8  0x00007f28adb859cd in virEventPollDispatchTimeouts () at util/vireventpoll.c:459

Frame #0 is unrefing an invalid identity object while frame libvirt#2 hints
that the client is still dispatching the event.

For untrimmed backtrace see the bugzilla attachment.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1203030
(cherry picked from commit a98129c)
crobinso pushed a commit to crobinso/libvirt that referenced this pull request Jan 9, 2016
The destination libvirt daemon in a migration may segfault if the client
disconnects immediately after the migration has begun:

  # virsh -c qemu+tls://remote/system list --all
   Id    Name                           State
  ----------------------------------------------------
  ...

  # timeout --signal KILL 1 \
      virsh migrate example qemu+tls://remote/system \
        --verbose --compressed --live --auto-converge \
        --abort-on-error --unsafe --persistent \
        --undefinesource --copy-storage-all --xml example.xml
  Killed

  # virsh -c qemu+tls://remote/system list --all
  error: failed to connect to the hypervisor
  error: unable to connect to server at 'remote:16514': Connection refused

The crash is in:

   1531 void
   1532 qemuDomainObjEndJob(virQEMUDriverPtr driver, virDomainObjPtr obj)
   1533 {
   1534     qemuDomainObjPrivatePtr priv = obj->privateData;
   1535     qemuDomainJob job = priv->job.active;
   1536
   1537     priv->jobs_queued--;

Backtrace:

  #0  at qemuDomainObjEndJob at qemu/qemu_domain.c:1537
  libvirt#1  in qemuDomainRemoveInactive at qemu/qemu_domain.c:2497
  libvirt#2  in qemuProcessAutoDestroy at qemu/qemu_process.c:5646
  libvirt#3  in virCloseCallbacksRun at util/virclosecallbacks.c:350
  libvirt#4  in qemuConnectClose at qemu/qemu_driver.c:1154
  ...

qemuDomainRemoveInactive calls virDomainObjListRemove, which in this
case is holding the last remaining reference to the domain.
qemuDomainRemoveInactive then calls qemuDomainObjEndJob, but the domain
object has been freed and poisoned by then.

This patch bumps the domain's refcount until qemuDomainRemoveInactive
has completed. We also ensure qemuProcessAutoDestroy does not return the
domain to virCloseCallbacksRun to be unlocked in this case. There is
similar logic in bhyveProcessAutoDestroy and lxcProcessAutoDestroy
(which call virDomainObjListRemove directly).

Signed-off-by: Michael Chapman <[email protected]>
(cherry picked from commit 7578cc1)
crobinso pushed a commit to crobinso/libvirt that referenced this pull request Jan 9, 2016
So, after some movement in virt-aa-helper, I've noticed the
virt-aa-helper-test failing. I've ran gdb (it took me a while to
realize how to do that) and this showed up immediately:

  Program received signal SIGSEGV, Segmentation fault.
  strlen () at ../sysdeps/x86_64/strlen.S:106
  106     ../sysdeps/x86_64/strlen.S: No such file or directory.
  (gdb) bt
  #0  strlen () at ../sysdeps/x86_64/strlen.S:106
  libvirt#1  0x0000555555561a13 in array_starts_with (str=0x5555557ce910 "/tmp/tmp.6nI2Fkv0KL/1.img", arr=0x7fffffffd160, size=-1540438016) at security/virt-aa-helper.c:525
  libvirt#2  0x0000555555561d49 in valid_path (path=0x5555557ce910 "/tmp/tmp.6nI2Fkv0KL/1.img", readonly=false) at security/virt-aa-helper.c:617
  libvirt#3  0x0000555555562506 in vah_add_path (buf=0x7fffffffd3e0, path=0x5555557cb910 "/tmp/tmp.6nI2Fkv0KL/1.img", perms=0x555555581585 "rw", recursive=false) at security/virt-aa-helper.c:823
  libvirt#4  0x0000555555562693 in vah_add_file (buf=0x7fffffffd3e0, path=0x5555557cb910 "/tmp/tmp.6nI2Fkv0KL/1.img", perms=0x555555581585 "rw") at security/virt-aa-helper.c:854
  libvirt#5  0x0000555555562918 in add_file_path (disk=0x5555557d4440, path=0x5555557cb910 "/tmp/tmp.6nI2Fkv0KL/1.img", depth=0, opaque=0x7fffffffd3e0) at security/virt-aa-helper.c:931
  libvirt#6  0x00007ffff78f18b1 in virDomainDiskDefForeachPath (disk=0x5555557d4440, ignoreOpenFailure=true, iter=0x5555555628a6 <add_file_path>, opaque=0x7fffffffd3e0) at conf/domain_conf.c:23286
  libvirt#7  0x0000555555562b5f in get_files (ctl=0x7fffffffd670) at security/virt-aa-helper.c:982
  libvirt#8  0x0000555555564100 in vahParseArgv (ctl=0x7fffffffd670, argc=5, argv=0x7fffffffd7e8) at security/virt-aa-helper.c:1277
  libvirt#9  0x00005555555643d6 in main (argc=5, argv=0x7fffffffd7e8) at security/virt-aa-helper.c:1332

So I've taken look at valid_path() because it is obviously
calling array_starts_with() with malformed @SiZe. And here's the
result: there are two variables to hold the size of three arrays
and their value is recalculated before each call of
array_starts_with(). What if we just use three variables,
initialize them and do not touch them afterwards?

Signed-off-by: Michal Privoznik <[email protected]>
(cherry picked from commit 52970de)
andreabolognani pushed a commit to andreabolognani/libvirt that referenced this pull request Jan 18, 2016
So, after some movement in virt-aa-helper, I've noticed the
virt-aa-helper-test failing. I've ran gdb (it took me a while to
realize how to do that) and this showed up immediately:

  Program received signal SIGSEGV, Segmentation fault.
  strlen () at ../sysdeps/x86_64/strlen.S:106
  106     ../sysdeps/x86_64/strlen.S: No such file or directory.
  (gdb) bt
  #0  strlen () at ../sysdeps/x86_64/strlen.S:106
  libvirt#1  0x0000555555561a13 in array_starts_with (str=0x5555557ce910 "/tmp/tmp.6nI2Fkv0KL/1.img", arr=0x7fffffffd160, size=-1540438016) at security/virt-aa-helper.c:525
  libvirt#2  0x0000555555561d49 in valid_path (path=0x5555557ce910 "/tmp/tmp.6nI2Fkv0KL/1.img", readonly=false) at security/virt-aa-helper.c:617
  libvirt#3  0x0000555555562506 in vah_add_path (buf=0x7fffffffd3e0, path=0x5555557cb910 "/tmp/tmp.6nI2Fkv0KL/1.img", perms=0x555555581585 "rw", recursive=false) at security/virt-aa-helper.c:823
  libvirt#4  0x0000555555562693 in vah_add_file (buf=0x7fffffffd3e0, path=0x5555557cb910 "/tmp/tmp.6nI2Fkv0KL/1.img", perms=0x555555581585 "rw") at security/virt-aa-helper.c:854
  libvirt#5  0x0000555555562918 in add_file_path (disk=0x5555557d4440, path=0x5555557cb910 "/tmp/tmp.6nI2Fkv0KL/1.img", depth=0, opaque=0x7fffffffd3e0) at security/virt-aa-helper.c:931
  libvirt#6  0x00007ffff78f18b1 in virDomainDiskDefForeachPath (disk=0x5555557d4440, ignoreOpenFailure=true, iter=0x5555555628a6 <add_file_path>, opaque=0x7fffffffd3e0) at conf/domain_conf.c:23286
  libvirt#7  0x0000555555562b5f in get_files (ctl=0x7fffffffd670) at security/virt-aa-helper.c:982
  libvirt#8  0x0000555555564100 in vahParseArgv (ctl=0x7fffffffd670, argc=5, argv=0x7fffffffd7e8) at security/virt-aa-helper.c:1277
  libvirt#9  0x00005555555643d6 in main (argc=5, argv=0x7fffffffd7e8) at security/virt-aa-helper.c:1332

So I've taken look at valid_path() because it is obviously
calling array_starts_with() with malformed @SiZe. And here's the
result: there are two variables to hold the size of three arrays
and their value is recalculated before each call of
array_starts_with(). What if we just use three variables,
initialize them and do not touch them afterwards?

Signed-off-by: Michal Privoznik <[email protected]>
andreabolognani pushed a commit to andreabolognani/libvirt that referenced this pull request Jan 18, 2016
We use the function to create a virDomainXMLOption object that is
required for some functions. However, we don't pass the driver
pointer to the object anywhere - rather than pass NULL. This
causes trouble later when parsing a domain XML and calling post
parse callbacks:

  Program received signal SIGSEGV, Segmentation fault.
  0x000000000043fa3e in qemuDomainDefPostParse (def=0x7d36c0, caps=0x7caf10, opaque=0x0) at qemu/qemu_domain.c:1043
  1043        qemuCaps = virQEMUCapsCacheLookup(driver->qemuCapsCache, def->emulator);
  (gdb) bt
  #0  0x000000000043fa3e in qemuDomainDefPostParse (def=0x7d36c0, caps=0x7caf10, opaque=0x0) at qemu/qemu_domain.c:1043
  libvirt#1  0x00007ffff2928bf9 in virDomainDefPostParse (def=0x7d36c0, caps=0x7caf10, xmlopt=0x7c82c0) at conf/domain_conf.c:4269
  libvirt#2  0x00007ffff294de04 in virDomainDefParseXML (xml=0x7da8c0, root=0x7dab80, ctxt=0x7da980, caps=0x7caf10, xmlopt=0x7c82c0, flags=0) at conf/domain_conf.c:16400
  libvirt#3  0x00007ffff294e5b5 in virDomainDefParseNode (xml=0x7da8c0, root=0x7dab80, caps=0x7caf10, xmlopt=0x7c82c0, flags=0) at conf/domain_conf.c:16582
  libvirt#4  0x00007ffff294e424 in virDomainDefParse (xmlStr=0x0, filename=0x7c7ef0 "/home/zippy/work/libvirt/libvirt.git/tests/securityselinuxlabeldata/disks.xml", caps=0x7caf10, xmlopt=0x7c82c0, flags=0) at conf/domain_conf.c:16529
  libvirt#5  0x00007ffff294e4b2 in virDomainDefParseFile (filename=0x7c7ef0 "/home/zippy/work/libvirt/libvirt.git/tests/securityselinuxlabeldata/disks.xml", caps=0x7caf10, xmlopt=0x7c82c0, flags=0) at conf/domain_conf.c:16553
  libvirt#6  0x00000000004303ca in testSELinuxLoadDef (testname=0x53c929 "disks") at securityselinuxlabeltest.c:192
  libvirt#7  0x00000000004309e8 in testSELinuxLabeling (opaque=0x53c929) at securityselinuxlabeltest.c:313
  libvirt#8  0x0000000000431207 in virtTestRun (title=0x53c92f "Labelling \"disks\"", body=0x430964 <testSELinuxLabeling>, data=0x53c929) at testutils.c:211
  libvirt#9  0x0000000000430c5d in mymain () at securityselinuxlabeltest.c:373
  libvirt#10 0x00000000004325c2 in virtTestMain (argc=1, argv=0x7fffffffd7e8, func=0x430b4a <mymain>) at testutils.c:863
  libvirt#11 0x0000000000430deb in main (argc=1, argv=0x7fffffffd7e8) at securityselinuxlabeltest.c:381

Signed-off-by: Michal Privoznik <[email protected]>
libvirtmirror pushed a commit that referenced this pull request Feb 3, 2016
… fix

A pretty nasty deadlock occurs while trying to rename a VM in parallel
with virDomainObjListNumOfDomains.
The short description of the problem is as follows:

Thread #1:

qemuDomainRename:
    ------> aquires domain lock by qemuDomObjFromDomain
       ---------> waits for domain list lock in any of the listed functions:
          - virDomainObjListFindByName
          - virDomainObjListRenameAddNew
          - virDomainObjListRenameRemove

Thread #2:

virDomainObjListNumOfDomains:
    ------> aquires domain list lock
       ---------> waits for domain lock in virDomainObjListCount

Introduce generic virDomainObjListRename function for renaming domains.
It aquires list lock in right order to avoid deadlock. Callback is used
to make driver specific domain updates.

Signed-off-by: Nikolay Shirokovskiy <[email protected]>
Signed-off-by: Michal Privoznik <[email protected]>
libvirtmirror pushed a commit that referenced this pull request Feb 11, 2016
Apparently we are not the only ones with dumb free functions
because dbus_message_unref() does not accept NULL either. But if
I were to vote, this one is even more evil. Instead of returning
an error just like we do it immediately dereference any pointer
passed and thus crash you app. Well done DBus!

  Program received signal SIGSEGV, Segmentation fault.
  [Switching to Thread 0x7f878ebda700 (LWP 31264)]
  0x00007f87be4016e5 in ?? () from /usr/lib64/libdbus-1.so.3
  (gdb) bt
  #0  0x00007f87be4016e5 in ?? () from /usr/lib64/libdbus-1.so.3
  #1  0x00007f87be3f004e in dbus_message_unref () from /usr/lib64/libdbus-1.so.3
  #2  0x00007f87bf6ecf95 in virSystemdGetMachineNameByPID (pid=9849) at util/virsystemd.c:228
  #3  0x00007f879761bd4d in qemuConnectCgroup (driver=0x7f87600a32a0, vm=0x7f87600c7550) at qemu/qemu_cgroup.c:909
  #4  0x00007f87976386b7 in qemuProcessReconnect (opaque=0x7f87600db840) at qemu/qemu_process.c:3386
  #5  0x00007f87bf6edfff in virThreadHelper (data=0x7f87600d5580) at util/virthread.c:206
  #6  0x00007f87bb602334 in start_thread (arg=0x7f878ebda700) at pthread_create.c:333
  #7  0x00007f87bb3481bd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
  (gdb) frame 2
  #2  0x00007f87bf6ecf95 in virSystemdGetMachineNameByPID (pid=9849) at util/virsystemd.c:228
  228         dbus_message_unref(reply);
  (gdb) p reply
  $1 = (DBusMessage *) 0x0

Signed-off-by: Michal Privoznik <[email protected]>
libvirtmirror pushed a commit that referenced this pull request May 24, 2016
Below is backtraces of two deadlocked threads:

thread #1:
 virDomainConfVMNWFilterTeardown
   virNWFilterTeardownFilter
       lock updateMutex <------------
       _virNWFilterTeardownFilter
            try to lock interface <----------

thread #2:
 learnIPAddressThread
    lock interface <-------
    virNWFilterInstantiateFilterLate
        try to lock updateMutex <----------

The problem is fixed by unlocking interface before calling
virNWFilterInstantiateFilterLate to avoid updateMutex and interface ordering
deadlocks. Otherwise we are going to instantiate the filter while holding
interface lock, which will try to lock updateMutex, and if some other thread
instantiating a filter in parallel is holding updateMutex and is trying to
lock interface, both will deadlock.
Also it is safe to unlock interface before virNWFilterInstantiateFilterLate
because learnIPAddressThread stopped capturing packets and applied necessary
rules on the interface, while instantiating a new filter doesn't require a
locked interface.

Signed-off-by: Maxim Nestratov <[email protected]>
libvirtmirror pushed a commit that referenced this pull request Sep 7, 2016
There is a possibility that qemu driver frees by unreferencing its
closeCallbacks pointer as it has the only reference to the object,
while in fact not all users of CloseCallbacks called thier
virCloseCallbacksUnset.

Backtrace is the following:
Thread #1:
0  in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
1  in virCondWait (c=<optimized out>, m=<optimized out>)
    at util/virthread.c:154
2  in virThreadPoolFree (pool=0x7f0810110b50)
    at util/virthreadpool.c:266
3  in qemuStateCleanup () at qemu/qemu_driver.c:1116
4  in virStateCleanup () at libvirt.c:808
5  in main (argc=<optimized out>, argv=<optimized out>)
    at libvirtd.c:1660

Thread #2:
0  in virClassIsDerivedFrom (klass=0xdeadbeef, parent=0x7f0837c694d0) at util/virobject.c:169
1  in virObjectIsClass (anyobj=anyobj@entry=0x7f08101d4760, klass=<optimized out>) at util/virobject.c:365
2  in virObjectLock (anyobj=0x7f08101d4760) at util/virobject.c:317
3  in virCloseCallbacksUnset (closeCallbacks=0x7f08101d4760, vm=vm@entry=0x7f08101d47b0, cb=cb@entry=0x7f081d078fc0 <qemuProcessAutoDestroy>) at util/virclosecallbacks.c:163
4  in qemuProcessAutoDestroyRemove (driver=driver@entry=0x7f081018be50, vm=vm@entry=0x7f08101d47b0) at qemu/qemu_process.c:6368
5  in qemuProcessStop (driver=driver@entry=0x7f081018be50, vm=vm@entry=0x7f08101d47b0, reason=reason@entry=VIR_DOMAIN_SHUTOFF_SHUTDOWN, asyncJob=asyncJob@entry=QEMU_ASYNC_JOB_NONE, flags=flags@entry=0) at qemu/qemu_process.c:5854
6  in processMonitorEOFEvent (vm=0x7f08101d47b0, driver=0x7f081018be50) at qemu/qemu_driver.c:4585
7  qemuProcessEventHandler (data=<optimized out>, opaque=0x7f081018be50) at qemu/qemu_driver.c:4629
8  in virThreadPoolWorker (opaque=opaque@entry=0x7f0837c4f820) at util/virthreadpool.c:145
9  in virThreadHelper (data=<optimized out>) at util/virthread.c:206
10 in start_thread () from /lib64/libpthread.so.0

Let's reference CloseCallbacks object in virCloseCallbacksSet and
unreference in virCloseCallbacksUnset.

Signed-off-by: Maxim Nestratov <[email protected]>
libvirtmirror pushed a commit that referenced this pull request Sep 19, 2016
When trying to migrate a huge page enabled guest, I've noticed
the following crash. Apparently, if no specific hugepages are
requested:

  <memoryBacking>
    <hugepages/>
  </memoryBacking>

and there are no hugepages configured on the destination, we try
to dereference a NULL pointer.

Program received signal SIGSEGV, Segmentation fault.
0x00007fcc907fb20e in qemuGetHugepagePath (hugepage=0x0) at qemu/qemu_conf.c:1447
1447        if (virAsprintf(&ret, "%s/libvirt/qemu", hugepage->mnt_dir) < 0)
(gdb) bt
#0  0x00007fcc907fb20e in qemuGetHugepagePath (hugepage=0x0) at qemu/qemu_conf.c:1447
#1  0x00007fcc907fb2f5 in qemuGetDefaultHugepath (hugetlbfs=0x0, nhugetlbfs=0) at qemu/qemu_conf.c:1466
#2  0x00007fcc907b4afa in qemuBuildMemoryBackendStr (size=4194304, pagesize=0, guestNode=0, userNodeset=0x0, autoNodeset=0x0, def=0x7fcc70019070, qemuCaps=0x7fcc70004000, cfg=0x7fcc5c011800, backendType=0x7fcc95087228, backendProps=0x7fcc95087218,
    force=false) at qemu/qemu_command.c:3297
#3  0x00007fcc907b4f91 in qemuBuildMemoryCellBackendStr (def=0x7fcc70019070, qemuCaps=0x7fcc70004000, cfg=0x7fcc5c011800, cell=0, auto_nodeset=0x0, backendStr=0x7fcc70020360) at qemu/qemu_command.c:3413
#4  0x00007fcc907c0406 in qemuBuildNumaArgStr (cfg=0x7fcc5c011800, def=0x7fcc70019070, cmd=0x7fcc700040c0, qemuCaps=0x7fcc70004000, auto_nodeset=0x0) at qemu/qemu_command.c:7470
#5  0x00007fcc907c5fdf in qemuBuildCommandLine (driver=0x7fcc5c07b8a0, logManager=0x7fcc70003c00, def=0x7fcc70019070, monitor_chr=0x7fcc70004bb0, monitor_json=true, qemuCaps=0x7fcc70004000, migrateURI=0x7fcc700199c0 "defer", snapshot=0x0,
    vmop=VIR_NETDEV_VPORT_PROFILE_OP_MIGRATE_IN_START, standalone=false, enableFips=false, nodeset=0x0, nnicindexes=0x7fcc95087498, nicindexes=0x7fcc950874a0, domainLibDir=0x7fcc700047c0 "/var/lib/libvirt/qemu/domain-1-fedora") at qemu/qemu_command.c:9547

Signed-off-by: Michal Privoznik <[email protected]>
libvirtmirror pushed a commit that referenced this pull request Sep 27, 2016
The qemucapsprobe helper calls virQEMUCapsNewForBinaryInternal with
caps == NULL, causing the following crash:

    Program received signal SIGSEGV, Segmentation fault.
    #0  0x00007ffff788775f in virQEMUCapsInitHostCPUModel
        (qemuCaps=qemuCaps@entry=0x649680, host=host@entry=0x10) at
        src/qemu/qemu_capabilities.c:2969
    #1  0x00007ffff7889dbf in virQEMUCapsNewForBinaryInternal
        (caps=caps@entry=0x0, binary=<optimized out>,
        libDir=libDir@entry=0x4033f6 "/tmp", cacheDir=cacheDir@entry=0x0,
        runUid=runUid@entry=4294967295, runGid=runGid@entry=4294967295,
        qmpOnly=true) at src/qemu/qemu_capabilities.c:4039
    #2  0x0000000000401702 in main (argc=2, argv=0x7fffffffd968) at
        tests/qemucapsprobe.c:73

Caused by v2.2.0-182-g68c7011.

Signed-off-by: Jiri Denemark <[email protected]>
libvirtmirror pushed a commit that referenced this pull request Apr 13, 2017
Fix xlconfigtest runs build for --enable-test-oom on
        Xen XL-2-XML Parse  channel-pty

Program received signal SIGSEGV, Segmentation fault.

    #0  0x00007ffff3c2b373 in __strchr_sse2 () from /lib64/libc.so.6
==> #1  0x00007ffff7875701 in virConfSaveValue (buf=buf@entry=0x7fffffffd8a0, val=val@entry=0x674750) at util/virconf.c:290
    #2  0x00007ffff7875668 in virConfSaveValue (buf=buf@entry=0x7fffffffd8a0, val=<optimized out>) at util/virconf.c:306
    #3  0x00007ffff78757ef in virConfSaveEntry (buf=buf@entry=0x7fffffffd8a0, cur=cur@entry=0x674780) at util/virconf.c:338
    #4  0x00007ffff78783eb in virConfWriteMem (memory=0x665570 "", len=len@entry=0x7fffffffd910, conf=conf@entry=0x65b940)
        at util/virconf.c:1543
    #5  0x000000000040eccb in testCompareParseXML (replaceVars=<optimized out>, xml=<optimized out>,
        xlcfg=0x662c00 "/home/wtenhave/WORK/libvirt/OOMtesting/libvirt-devel/tests/xlconfigdata/test-channel-pty.cfg")
        at xlconfigtest.c:108
    #6  testCompareHelper (data=<optimized out>) at xlconfigtest.c:205
    #7  0x0000000000410b3a in virTestRun (title=title@entry=0x432cc0 "Xen XL-2-XML Parse  channel-pty",
        body=body@entry=0x40e9b0 <testCompareHelper>, data=data@entry=0x7fffffffd9f0) at testutils.c:247
    #8  0x000000000040f322 in mymain () at xlconfigtest.c:278
    #9  0x0000000000411410 in virTestMain (argc=1, argv=0x7fffffffdba8, func=0x40f660 <mymain>) at testutils.c:992
    #10 0x00007ffff3bc0401 in __libc_start_main () from /lib64/libc.so.6
    #11 0x000000000040e86a in _start ()

    (gdb) frame 1
    #1  0x00007ffff7875701 in virConfSaveValue (buf=buf@entry=0x7fffffffd8a0, val=val@entry=0x674750) at util/virconf.c:290
    290                 if (strchr(val->str, '\n') != NULL) {
    (gdb) print *val
    $1 = {type = VIR_CONF_STRING, next = 0x0, l = 0, str = 0x0, list = 0x0}

Signed-off-by: Wim ten Have <[email protected]>
libvirtmirror pushed a commit that referenced this pull request Apr 13, 2017
Fix xlconfigtest runs build for --enable-test-oom on
        Xen XL-2-XML Parse  new-disk

    #0  0x00007ffff3bd791f in raise () from /lib64/libc.so.6
    #1  0x00007ffff3bd951a in abort () from /lib64/libc.so.6
    #2  0x00007ffff3c1b200 in __libc_message () from /lib64/libc.so.6
    #3  0x00007ffff3c2488a in _int_free () from /lib64/libc.so.6
    #4  0x00007ffff3c282bc in free () from /lib64/libc.so.6
    #5  0x00007ffff7864fcb in virFree (ptrptr=ptrptr@entry=0x7fffffffd868) at util/viralloc.c:582
    #6  0x00007ffff78776e5 in virConfFreeValue (val=<optimized out>) at util/virconf.c:178
==> #7  0x0000000000425759 in xenFormatXLDomainDisks (def=0x7fffffffd8c0, def=0x7fffffffd8c0, conf=0x658220)
        at xenconfig/xen_xl.c:1159
    #8  xenFormatXL (def=def@entry=0x66ec20, conn=conn@entry=0x668cf0) at xenconfig/xen_xl.c:1558
    #9  0x000000000040ea1d in testCompareParseXML (replaceVars=<optimized out>,
        xml=0x65f5e0 "/home/wtenhave/WORK/libvirt/history/libvirt/tests/xlconfigdata/test-fullvirt-ovmf.xml",
        xlcfg=0x65f6b0 "/home/wtenhave/WORK/libvirt/history/libvirt/tests/xlconfigdata/test-fullvirt-ovmf.cfg")
        at xlconfigtest.c:105
    #10 testCompareHelper (data=<optimized out>) at xlconfigtest.c:205
    #11 0x000000000041079a in virTestRun (title=title@entry=0x431cf0 "Xen XL-2-XML Parse  fullvirt-ovmf",
        body=body@entry=0x40e720 <testCompareHelper>, data=data@entry=0x7fffffffda50) at testutils.c:247
    #12 0x000000000040ebc2 in mymain () at xlconfigtest.c:256
    #13 0x0000000000411070 in virTestMain (argc=1, argv=0x7fffffffdc08, func=0x40f2c0 <mymain>) at testutils.c:992
    #14 0x00007ffff3bc2401 in __libc_start_main () from /lib64/libc.so.6
    #15 0x000000000040e5da in _start ()

symmetry seems missing its sibbling coded functionality
demonstrated under functions;
        xenFormatXLUSBController()
        xenFormatXLUSB()
        xenFormatXLDomainChannels()
        xenFormatXMDisks

Signed-off-by: Wim ten Have <[email protected]>
libvirtmirror pushed a commit that referenced this pull request Apr 18, 2017
Fix xlconfig channel tests when OOM testing is enabled.

TEST: xlconfigtest
32) Xen XL-2-XML Format channel-unix                                  ... OK
    Test OOM for nalloc=55 ................................................*** Error in `/home/jfehlig/virt/upstream/libvirt/tests/.libs/xlconfigtest': double free or corruption (fasttop): 0x0000000000679550 ***
...
(gdb) bt
#0  0x00007ffff36875af in raise () from /lib64/libc.so.6
#1  0x00007ffff36889aa in abort () from /lib64/libc.so.6
#2  0x00007ffff36c5150 in __libc_message () from /lib64/libc.so.6
#3  0x00007ffff36cb4f6 in malloc_printerr () from /lib64/libc.so.6
#4  0x00007ffff36cbcee in _int_free () from /lib64/libc.so.6
#5  0x00007ffff782babf in virFree (ptrptr=0x7fffffffdca8) at util/viralloc.c:582
#6  0x000000000042f2f3 in xenParseXLChannel (conf=0x677350, def=0x6815b0) at xenconfig/xen_xl.c:788
#7  0x000000000042f44e in xenParseXL (conf=0x677350, caps=0x6832b0, xmlopt=0x67f6e0) at xenconfig/xen_xl.c:828
#8  0x00000000004105a3 in testCompareFormatXML (
    xlcfg=0x6811e0 "/home/jfehlig/virt/upstream/libvirt/tests/xlconfigdata/test-channel-unix.cfg",
    xml=0x681110 "/home/jfehlig/virt/upstream/libvirt/tests/xlconfigdata/test-channel-unix.xml", replaceVars=false)
    at xlconfigtest.c:152

When a channel is successfully parsed and its path and name fields
assigned from local variables, set the local variables to NULL to
prevent a double free on error.

Signed-off-by: Jim Fehlig <[email protected]>
libvirtmirror pushed a commit that referenced this pull request Apr 24, 2017
ka maybe have been freeed in virObjectUnref, application using
virKeepAliveTimer will segfault when unlock ka. We should keep
ka's refs positive before using it.

#0  0x00007fd8f79970e8 in virClassIsDerivedFrom (klass=0xdeadbeef, parent=0x7fd8e8001b80) at util/virobject.c:169
#1  0x00007fd8f799742e in virObjectIsClass (anyobj=anyobj entry=0x7fd8e800b9c0, klass=<optimized out>) at util/virobject.c:365
#2  0x00007fd8f79974e4 in virObjectUnlock (anyobj=0x7fd8e800b9c0) at util/virobject.c:338
#3  0x00007fd8f7ac477e in virKeepAliveTimer (timer=<optimized out>, opaque=0x7fd8e800b9c0) at rpc/virkeepalive.c:177
#4  0x00007fd8f7e5c9cf in libvirt_virEventInvokeTimeoutCallback () from /usr/lib64/python2.7/site-packages/libvirtmod.so
#5  0x00007fd8ff64db94 in PyEval_EvalFrameEx () from /lib64/libpython2.7.so.1.0
#6  0x00007fd8ff64f1ad in PyEval_EvalCodeEx () from /lib64/libpython2.7.so.1.0
#7  0x00007fd8ff64d85f in PyEval_EvalFrameEx () from /lib64/libpython2.7.so.1.0
#8  0x00007fd8ff64d950 in PyEval_EvalFrameEx () from /lib64/libpython2.7.so.1.0
#9  0x00007fd8ff64d950 in PyEval_EvalFrameEx () from /lib64/libpython2.7.so.1.0
#10 0x00007fd8ff64f1ad in PyEval_EvalCodeEx () from /lib64/libpython2.7.so.1.0
#11 0x00007fd8ff5dc098 in function_call () from /lib64/libpython2.7.so.1.0
#12 0x00007fd8ff5b7073 in PyObject_Call () from /lib64/libpython2.7.so.1.0
#13 0x00007fd8ff5c6085 in instancemethod_call () from /lib64/libpython2.7.so.1.0
#14 0x00007fd8ff5b7073 in PyObject_Call () from /lib64/libpython2.7.so.1.0
#15 0x00007fd8ff648ff7 in PyEval_CallObjectWithKeywords () from /lib64/libpython2.7.so.1.0
#16 0x00007fd8ff67d7e2 in t_bootstrap () from /lib64/libpython2.7.so.1.0
#17 0x00007fd8ff358df3 in start_thread () from /lib64/libpthread.so.0
#18 0x00007fd8fe97d3ed in clone () from /lib64/libc.so.6

Signed-off-by: Yi Wang <[email protected]>
Signed-off-by: Michal Privoznik <[email protected]>
libvirtmirror pushed a commit that referenced this pull request Apr 25, 2017
Based upon an idea and some research by Wang King <[email protected]>
and xinhua.Cao <[email protected]>.

Since we're assigning the 'client' to our callback event lookaside list,
it's imperative that we grab a reference to the object; otherwise, when
the object is unref'd during virNetServerProcessClients when it's determined
that the virNetServerClientIsClosed and the memory is free'd before perhaps
the object event state callbacks are run.  When a virObjectLock() is run,
before sending the message the following trace occurs;

    #0  0x00007fda223d66d8 in virClassIsDerivedFrom
        (klass=0xdeadbeef, parent=0x7fda24c81b40)
         at util/virobject.c:169
    #1  0x00007fda223d6a1e in virObjectIsClass
        (anyobj=anyobj@entry=0x7fd9e575b400, klass=<optimized out>)
         at util/virobject.c:365
    #2  0x00007fda223d6a44 in virObjectLock
        (anyobj=0x7fd9e575b400)
        at util/virobject.c:317
    #3  0x00007fda22507f71 in virNetServerClientSendMessage
        (client=client@entry=0x7fd9e575b400, msg=msg@entry=0x7fd9ec30de90)
        at rpc/virnetserverclient.c:1422
    #4  0x00007fda230d714d in remoteDispatchObjectEventSend
        (client=0x7fd9e575b400, program=0x7fda24c844e0, procnr=348,
         proc=0x7fda2310e5e0 <xdr_remote_domain_event_callback_tunable_msg>,
         data=0x7ffc3857fdb0)
        at remote.c:3803
    #5  0x00007fda230dd71b in remoteRelayDomainEventTunable
        (conn=<optimized out>, dom=0x7fda27cd7660, params=0x7fda27f3aae0,
         nparams=1,opaque=0x7fd9e6c99e00)
        at remote.c:1033
    #6  0x00007fda224484cb in virDomainEventDispatchDefaultFunc
        (conn=0x7fda27cd0120, event=0x7fda2736ea00, cb=0x7fda230dd610
         <remoteRelayDomainEventTunable>, cbopaque=0x7fd9e6c99e00)
        at conf/domain_event.c:1910
    #7  0x00007fda22446871 in virObjectEventStateDispatchCallbacks
        (callbacks=<optimized out>, callbacks=<optimized out>,
         event=0x7fda2736ea00,state=0x7fda24ca3960)
        at conf/object_event.c:722
    #8  virObjectEventStateQueueDispatch
        (callbacks=0x7fda24c65800, queue=0x7ffc3857fe90, state=0x7fda24ca3960)
        at conf/object_event.c:736
    #9  virObjectEventStateFlush (state=0x7fda24ca3960)
        at conf/object_event.c:814
    #10 virObjectEventTimer (timer=<optimized out>, opaque=0x7fda24ca3960)
        at conf/object_event.c:560
    #11 0x00007fda223ae8b9 in virEventPollDispatchTimeouts ()
        at util/vireventpoll.c:458
    #12 virEventPollRunOnce ()
        at util/vireventpoll.c:654
    #13 0x00007fda223ad1d2 in virEventRunDefaultImpl ()
        at util/virevent.c:314
    #14 0x00007fda225046cd in virNetDaemonRun (dmn=0x7fda24c775c0)
        at rpc/virnetdaemon.c:818
    #15 0x00007fda230d6351 in main (argc=<optimized out>, argv=<optimized out>)
        at libvirtd.c:1623

Signed-off-by: John Ferlan <[email protected]>
crobinso pushed a commit to crobinso/libvirt that referenced this pull request May 5, 2017
There is a possibility that qemu driver frees by unreferencing its
closeCallbacks pointer as it has the only reference to the object,
while in fact not all users of CloseCallbacks called thier
virCloseCallbacksUnset.

Backtrace is the following:
Thread libvirt#1:
0  in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
1  in virCondWait (c=<optimized out>, m=<optimized out>)
    at util/virthread.c:154
2  in virThreadPoolFree (pool=0x7f0810110b50)
    at util/virthreadpool.c:266
3  in qemuStateCleanup () at qemu/qemu_driver.c:1116
4  in virStateCleanup () at libvirt.c:808
5  in main (argc=<optimized out>, argv=<optimized out>)
    at libvirtd.c:1660

Thread libvirt#2:
0  in virClassIsDerivedFrom (klass=0xdeadbeef, parent=0x7f0837c694d0) at util/virobject.c:169
1  in virObjectIsClass (anyobj=anyobj@entry=0x7f08101d4760, klass=<optimized out>) at util/virobject.c:365
2  in virObjectLock (anyobj=0x7f08101d4760) at util/virobject.c:317
3  in virCloseCallbacksUnset (closeCallbacks=0x7f08101d4760, vm=vm@entry=0x7f08101d47b0, cb=cb@entry=0x7f081d078fc0 <qemuProcessAutoDestroy>) at util/virclosecallbacks.c:163
4  in qemuProcessAutoDestroyRemove (driver=driver@entry=0x7f081018be50, vm=vm@entry=0x7f08101d47b0) at qemu/qemu_process.c:6368
5  in qemuProcessStop (driver=driver@entry=0x7f081018be50, vm=vm@entry=0x7f08101d47b0, reason=reason@entry=VIR_DOMAIN_SHUTOFF_SHUTDOWN, asyncJob=asyncJob@entry=QEMU_ASYNC_JOB_NONE, flags=flags@entry=0) at qemu/qemu_process.c:5854
6  in processMonitorEOFEvent (vm=0x7f08101d47b0, driver=0x7f081018be50) at qemu/qemu_driver.c:4585
7  qemuProcessEventHandler (data=<optimized out>, opaque=0x7f081018be50) at qemu/qemu_driver.c:4629
8  in virThreadPoolWorker (opaque=opaque@entry=0x7f0837c4f820) at util/virthreadpool.c:145
9  in virThreadHelper (data=<optimized out>) at util/virthread.c:206
10 in start_thread () from /lib64/libpthread.so.0

Let's reference CloseCallbacks object in virCloseCallbacksSet and
unreference in virCloseCallbacksUnset.

Signed-off-by: Maxim Nestratov <[email protected]>
(cherry picked from commit f47b911)
crobinso pushed a commit to crobinso/libvirt that referenced this pull request May 5, 2017
When trying to migrate a huge page enabled guest, I've noticed
the following crash. Apparently, if no specific hugepages are
requested:

  <memoryBacking>
    <hugepages/>
  </memoryBacking>

and there are no hugepages configured on the destination, we try
to dereference a NULL pointer.

Program received signal SIGSEGV, Segmentation fault.
0x00007fcc907fb20e in qemuGetHugepagePath (hugepage=0x0) at qemu/qemu_conf.c:1447
1447        if (virAsprintf(&ret, "%s/libvirt/qemu", hugepage->mnt_dir) < 0)
(gdb) bt
#0  0x00007fcc907fb20e in qemuGetHugepagePath (hugepage=0x0) at qemu/qemu_conf.c:1447
libvirt#1  0x00007fcc907fb2f5 in qemuGetDefaultHugepath (hugetlbfs=0x0, nhugetlbfs=0) at qemu/qemu_conf.c:1466
libvirt#2  0x00007fcc907b4afa in qemuBuildMemoryBackendStr (size=4194304, pagesize=0, guestNode=0, userNodeset=0x0, autoNodeset=0x0, def=0x7fcc70019070, qemuCaps=0x7fcc70004000, cfg=0x7fcc5c011800, backendType=0x7fcc95087228, backendProps=0x7fcc95087218,
    force=false) at qemu/qemu_command.c:3297
libvirt#3  0x00007fcc907b4f91 in qemuBuildMemoryCellBackendStr (def=0x7fcc70019070, qemuCaps=0x7fcc70004000, cfg=0x7fcc5c011800, cell=0, auto_nodeset=0x0, backendStr=0x7fcc70020360) at qemu/qemu_command.c:3413
libvirt#4  0x00007fcc907c0406 in qemuBuildNumaArgStr (cfg=0x7fcc5c011800, def=0x7fcc70019070, cmd=0x7fcc700040c0, qemuCaps=0x7fcc70004000, auto_nodeset=0x0) at qemu/qemu_command.c:7470
libvirt#5  0x00007fcc907c5fdf in qemuBuildCommandLine (driver=0x7fcc5c07b8a0, logManager=0x7fcc70003c00, def=0x7fcc70019070, monitor_chr=0x7fcc70004bb0, monitor_json=true, qemuCaps=0x7fcc70004000, migrateURI=0x7fcc700199c0 "defer", snapshot=0x0,
    vmop=VIR_NETDEV_VPORT_PROFILE_OP_MIGRATE_IN_START, standalone=false, enableFips=false, nodeset=0x0, nnicindexes=0x7fcc95087498, nicindexes=0x7fcc950874a0, domainLibDir=0x7fcc700047c0 "/var/lib/libvirt/qemu/domain-1-fedora") at qemu/qemu_command.c:9547

Signed-off-by: Michal Privoznik <[email protected]>
(cherry picked from commit 647db05)
libvirtmirror pushed a commit that referenced this pull request May 10, 2017
There is a possibility that qemu driver frees by unreferencing its
closeCallbacks pointer as it has the only reference to the object,
while in fact not all users of CloseCallbacks called thier
virCloseCallbacksUnset.

Backtrace is the following:
Thread #1:
0  in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
1  in virCondWait (c=<optimized out>, m=<optimized out>)
    at util/virthread.c:154
2  in virThreadPoolFree (pool=0x7f0810110b50)
    at util/virthreadpool.c:266
3  in qemuStateCleanup () at qemu/qemu_driver.c:1116
4  in virStateCleanup () at libvirt.c:808
5  in main (argc=<optimized out>, argv=<optimized out>)
    at libvirtd.c:1660

Thread #2:
0  in virClassIsDerivedFrom (klass=0xdeadbeef, parent=0x7f0837c694d0) at util/virobject.c:169
1  in virObjectIsClass (anyobj=anyobj@entry=0x7f08101d4760, klass=<optimized out>) at util/virobject.c:365
2  in virObjectLock (anyobj=0x7f08101d4760) at util/virobject.c:317
3  in virCloseCallbacksUnset (closeCallbacks=0x7f08101d4760, vm=vm@entry=0x7f08101d47b0, cb=cb@entry=0x7f081d078fc0 <qemuProcessAutoDestroy>) at util/virclosecallbacks.c:163
4  in qemuProcessAutoDestroyRemove (driver=driver@entry=0x7f081018be50, vm=vm@entry=0x7f08101d47b0) at qemu/qemu_process.c:6368
5  in qemuProcessStop (driver=driver@entry=0x7f081018be50, vm=vm@entry=0x7f08101d47b0, reason=reason@entry=VIR_DOMAIN_SHUTOFF_SHUTDOWN, asyncJob=asyncJob@entry=QEMU_ASYNC_JOB_NONE, flags=flags@entry=0) at qemu/qemu_process.c:5854
6  in processMonitorEOFEvent (vm=0x7f08101d47b0, driver=0x7f081018be50) at qemu/qemu_driver.c:4585
7  qemuProcessEventHandler (data=<optimized out>, opaque=0x7f081018be50) at qemu/qemu_driver.c:4629
8  in virThreadPoolWorker (opaque=opaque@entry=0x7f0837c4f820) at util/virthreadpool.c:145
9  in virThreadHelper (data=<optimized out>) at util/virthread.c:206
10 in start_thread () from /lib64/libpthread.so.0

Let's reference CloseCallbacks object in virCloseCallbacksSet and
unreference in virCloseCallbacksUnset.

Signed-off-by: Maxim Nestratov <[email protected]>
(cherry picked from commit f47b911)
libvirtmirror pushed a commit that referenced this pull request May 10, 2017
When trying to migrate a huge page enabled guest, I've noticed
the following crash. Apparently, if no specific hugepages are
requested:

  <memoryBacking>
    <hugepages/>
  </memoryBacking>

and there are no hugepages configured on the destination, we try
to dereference a NULL pointer.

Program received signal SIGSEGV, Segmentation fault.
0x00007fcc907fb20e in qemuGetHugepagePath (hugepage=0x0) at qemu/qemu_conf.c:1447
1447        if (virAsprintf(&ret, "%s/libvirt/qemu", hugepage->mnt_dir) < 0)
(gdb) bt
#0  0x00007fcc907fb20e in qemuGetHugepagePath (hugepage=0x0) at qemu/qemu_conf.c:1447
#1  0x00007fcc907fb2f5 in qemuGetDefaultHugepath (hugetlbfs=0x0, nhugetlbfs=0) at qemu/qemu_conf.c:1466
#2  0x00007fcc907b4afa in qemuBuildMemoryBackendStr (size=4194304, pagesize=0, guestNode=0, userNodeset=0x0, autoNodeset=0x0, def=0x7fcc70019070, qemuCaps=0x7fcc70004000, cfg=0x7fcc5c011800, backendType=0x7fcc95087228, backendProps=0x7fcc95087218,
    force=false) at qemu/qemu_command.c:3297
#3  0x00007fcc907b4f91 in qemuBuildMemoryCellBackendStr (def=0x7fcc70019070, qemuCaps=0x7fcc70004000, cfg=0x7fcc5c011800, cell=0, auto_nodeset=0x0, backendStr=0x7fcc70020360) at qemu/qemu_command.c:3413
#4  0x00007fcc907c0406 in qemuBuildNumaArgStr (cfg=0x7fcc5c011800, def=0x7fcc70019070, cmd=0x7fcc700040c0, qemuCaps=0x7fcc70004000, auto_nodeset=0x0) at qemu/qemu_command.c:7470
#5  0x00007fcc907c5fdf in qemuBuildCommandLine (driver=0x7fcc5c07b8a0, logManager=0x7fcc70003c00, def=0x7fcc70019070, monitor_chr=0x7fcc70004bb0, monitor_json=true, qemuCaps=0x7fcc70004000, migrateURI=0x7fcc700199c0 "defer", snapshot=0x0,
    vmop=VIR_NETDEV_VPORT_PROFILE_OP_MIGRATE_IN_START, standalone=false, enableFips=false, nodeset=0x0, nnicindexes=0x7fcc95087498, nicindexes=0x7fcc950874a0, domainLibDir=0x7fcc700047c0 "/var/lib/libvirt/qemu/domain-1-fedora") at qemu/qemu_command.c:9547

Signed-off-by: Michal Privoznik <[email protected]>
(cherry picked from commit 647db05)
libvirtmirror pushed a commit that referenced this pull request May 10, 2017
Fix xlconfigtest runs build for --enable-test-oom on
        Xen XL-2-XML Parse  channel-pty

Program received signal SIGSEGV, Segmentation fault.

    #0  0x00007ffff3c2b373 in __strchr_sse2 () from /lib64/libc.so.6
==> #1  0x00007ffff7875701 in virConfSaveValue (buf=buf@entry=0x7fffffffd8a0, val=val@entry=0x674750) at util/virconf.c:290
    #2  0x00007ffff7875668 in virConfSaveValue (buf=buf@entry=0x7fffffffd8a0, val=<optimized out>) at util/virconf.c:306
    #3  0x00007ffff78757ef in virConfSaveEntry (buf=buf@entry=0x7fffffffd8a0, cur=cur@entry=0x674780) at util/virconf.c:338
    #4  0x00007ffff78783eb in virConfWriteMem (memory=0x665570 "", len=len@entry=0x7fffffffd910, conf=conf@entry=0x65b940)
        at util/virconf.c:1543
    #5  0x000000000040eccb in testCompareParseXML (replaceVars=<optimized out>, xml=<optimized out>,
        xlcfg=0x662c00 "/home/wtenhave/WORK/libvirt/OOMtesting/libvirt-devel/tests/xlconfigdata/test-channel-pty.cfg")
        at xlconfigtest.c:108
    #6  testCompareHelper (data=<optimized out>) at xlconfigtest.c:205
    #7  0x0000000000410b3a in virTestRun (title=title@entry=0x432cc0 "Xen XL-2-XML Parse  channel-pty",
        body=body@entry=0x40e9b0 <testCompareHelper>, data=data@entry=0x7fffffffd9f0) at testutils.c:247
    #8  0x000000000040f322 in mymain () at xlconfigtest.c:278
    #9  0x0000000000411410 in virTestMain (argc=1, argv=0x7fffffffdba8, func=0x40f660 <mymain>) at testutils.c:992
    #10 0x00007ffff3bc0401 in __libc_start_main () from /lib64/libc.so.6
    #11 0x000000000040e86a in _start ()

    (gdb) frame 1
    #1  0x00007ffff7875701 in virConfSaveValue (buf=buf@entry=0x7fffffffd8a0, val=val@entry=0x674750) at util/virconf.c:290
    290                 if (strchr(val->str, '\n') != NULL) {
    (gdb) print *val
    $1 = {type = VIR_CONF_STRING, next = 0x0, l = 0, str = 0x0, list = 0x0}

Signed-off-by: Wim ten Have <[email protected]>
(cherry picked from commit ae5d758)
libvirtmirror pushed a commit that referenced this pull request May 10, 2017
Fix xlconfigtest runs build for --enable-test-oom on
        Xen XL-2-XML Parse  new-disk

    #0  0x00007ffff3bd791f in raise () from /lib64/libc.so.6
    #1  0x00007ffff3bd951a in abort () from /lib64/libc.so.6
    #2  0x00007ffff3c1b200 in __libc_message () from /lib64/libc.so.6
    #3  0x00007ffff3c2488a in _int_free () from /lib64/libc.so.6
    #4  0x00007ffff3c282bc in free () from /lib64/libc.so.6
    #5  0x00007ffff7864fcb in virFree (ptrptr=ptrptr@entry=0x7fffffffd868) at util/viralloc.c:582
    #6  0x00007ffff78776e5 in virConfFreeValue (val=<optimized out>) at util/virconf.c:178
==> #7  0x0000000000425759 in xenFormatXLDomainDisks (def=0x7fffffffd8c0, def=0x7fffffffd8c0, conf=0x658220)
        at xenconfig/xen_xl.c:1159
    #8  xenFormatXL (def=def@entry=0x66ec20, conn=conn@entry=0x668cf0) at xenconfig/xen_xl.c:1558
    #9  0x000000000040ea1d in testCompareParseXML (replaceVars=<optimized out>,
        xml=0x65f5e0 "/home/wtenhave/WORK/libvirt/history/libvirt/tests/xlconfigdata/test-fullvirt-ovmf.xml",
        xlcfg=0x65f6b0 "/home/wtenhave/WORK/libvirt/history/libvirt/tests/xlconfigdata/test-fullvirt-ovmf.cfg")
        at xlconfigtest.c:105
    #10 testCompareHelper (data=<optimized out>) at xlconfigtest.c:205
    #11 0x000000000041079a in virTestRun (title=title@entry=0x431cf0 "Xen XL-2-XML Parse  fullvirt-ovmf",
        body=body@entry=0x40e720 <testCompareHelper>, data=data@entry=0x7fffffffda50) at testutils.c:247
    #12 0x000000000040ebc2 in mymain () at xlconfigtest.c:256
    #13 0x0000000000411070 in virTestMain (argc=1, argv=0x7fffffffdc08, func=0x40f2c0 <mymain>) at testutils.c:992
    #14 0x00007ffff3bc2401 in __libc_start_main () from /lib64/libc.so.6
    #15 0x000000000040e5da in _start ()

symmetry seems missing its sibbling coded functionality
demonstrated under functions;
        xenFormatXLUSBController()
        xenFormatXLUSB()
        xenFormatXLDomainChannels()
        xenFormatXMDisks

Signed-off-by: Wim ten Have <[email protected]>
(cherry picked from commit 2c1a31a)
libvirtmirror pushed a commit that referenced this pull request May 10, 2017
Fix xlconfig channel tests when OOM testing is enabled.

TEST: xlconfigtest
32) Xen XL-2-XML Format channel-unix                                  ... OK
    Test OOM for nalloc=55 ................................................*** Error in `/home/jfehlig/virt/upstream/libvirt/tests/.libs/xlconfigtest': double free or corruption (fasttop): 0x0000000000679550 ***
...
(gdb) bt
#0  0x00007ffff36875af in raise () from /lib64/libc.so.6
#1  0x00007ffff36889aa in abort () from /lib64/libc.so.6
#2  0x00007ffff36c5150 in __libc_message () from /lib64/libc.so.6
#3  0x00007ffff36cb4f6 in malloc_printerr () from /lib64/libc.so.6
#4  0x00007ffff36cbcee in _int_free () from /lib64/libc.so.6
#5  0x00007ffff782babf in virFree (ptrptr=0x7fffffffdca8) at util/viralloc.c:582
#6  0x000000000042f2f3 in xenParseXLChannel (conf=0x677350, def=0x6815b0) at xenconfig/xen_xl.c:788
#7  0x000000000042f44e in xenParseXL (conf=0x677350, caps=0x6832b0, xmlopt=0x67f6e0) at xenconfig/xen_xl.c:828
#8  0x00000000004105a3 in testCompareFormatXML (
    xlcfg=0x6811e0 "/home/jfehlig/virt/upstream/libvirt/tests/xlconfigdata/test-channel-unix.cfg",
    xml=0x681110 "/home/jfehlig/virt/upstream/libvirt/tests/xlconfigdata/test-channel-unix.xml", replaceVars=false)
    at xlconfigtest.c:152

When a channel is successfully parsed and its path and name fields
assigned from local variables, set the local variables to NULL to
prevent a double free on error.

Signed-off-by: Jim Fehlig <[email protected]>
(cherry picked from commit b2c12f5)
libvirtmirror pushed a commit that referenced this pull request May 10, 2017
ka maybe have been freeed in virObjectUnref, application using
virKeepAliveTimer will segfault when unlock ka. We should keep
ka's refs positive before using it.

#0  0x00007fd8f79970e8 in virClassIsDerivedFrom (klass=0xdeadbeef, parent=0x7fd8e8001b80) at util/virobject.c:169
#1  0x00007fd8f799742e in virObjectIsClass (anyobj=anyobj entry=0x7fd8e800b9c0, klass=<optimized out>) at util/virobject.c:365
#2  0x00007fd8f79974e4 in virObjectUnlock (anyobj=0x7fd8e800b9c0) at util/virobject.c:338
#3  0x00007fd8f7ac477e in virKeepAliveTimer (timer=<optimized out>, opaque=0x7fd8e800b9c0) at rpc/virkeepalive.c:177
#4  0x00007fd8f7e5c9cf in libvirt_virEventInvokeTimeoutCallback () from /usr/lib64/python2.7/site-packages/libvirtmod.so
#5  0x00007fd8ff64db94 in PyEval_EvalFrameEx () from /lib64/libpython2.7.so.1.0
#6  0x00007fd8ff64f1ad in PyEval_EvalCodeEx () from /lib64/libpython2.7.so.1.0
#7  0x00007fd8ff64d85f in PyEval_EvalFrameEx () from /lib64/libpython2.7.so.1.0
#8  0x00007fd8ff64d950 in PyEval_EvalFrameEx () from /lib64/libpython2.7.so.1.0
#9  0x00007fd8ff64d950 in PyEval_EvalFrameEx () from /lib64/libpython2.7.so.1.0
#10 0x00007fd8ff64f1ad in PyEval_EvalCodeEx () from /lib64/libpython2.7.so.1.0
#11 0x00007fd8ff5dc098 in function_call () from /lib64/libpython2.7.so.1.0
#12 0x00007fd8ff5b7073 in PyObject_Call () from /lib64/libpython2.7.so.1.0
#13 0x00007fd8ff5c6085 in instancemethod_call () from /lib64/libpython2.7.so.1.0
#14 0x00007fd8ff5b7073 in PyObject_Call () from /lib64/libpython2.7.so.1.0
#15 0x00007fd8ff648ff7 in PyEval_CallObjectWithKeywords () from /lib64/libpython2.7.so.1.0
#16 0x00007fd8ff67d7e2 in t_bootstrap () from /lib64/libpython2.7.so.1.0
#17 0x00007fd8ff358df3 in start_thread () from /lib64/libpthread.so.0
#18 0x00007fd8fe97d3ed in clone () from /lib64/libc.so.6

Signed-off-by: Yi Wang <[email protected]>
Signed-off-by: Michal Privoznik <[email protected]>
(cherry picked from commit ab5bb6f)
libvirtmirror pushed a commit that referenced this pull request Jun 25, 2017
If a remote call fails during event registration (more than likely from
a network failure or remote libvirtd restart timed just right), then when
calling the virObjectEventStateDeregisterID we don't want to call the
registered @freecb function because that breaks our contract that we
would only call it after succesfully returning.  If the @freecb routine
were called, it could result in a double free from properly coded
applications that free their opaque data on failure to register, as seen
in the following details:

    Program terminated with signal 6, Aborted.
    #0  0x00007fc45cba15d7 in raise
    #1  0x00007fc45cba2cc8 in abort
    #2  0x00007fc45cbe12f7 in __libc_message
    #3  0x00007fc45cbe86d3 in _int_free
    #4  0x00007fc45d8d292c in PyDict_Fini
    #5  0x00007fc45d94f46a in Py_Finalize
    #6  0x00007fc45d960735 in Py_Main
    #7  0x00007fc45cb8daf5 in __libc_start_main
    #8  0x0000000000400721 in _start

The double dereference of 'pyobj_cbData' is triggered in the following way:

    (1) libvirt_virConnectDomainEventRegisterAny is invoked.
    (2) the event is successfully added to the event callback list
        (virDomainEventStateRegisterClient in
        remoteConnectDomainEventRegisterAny returns 1 which means ok).
    (3) when function remoteConnectDomainEventRegisterAny is hit,
        network connection disconnected coincidently (or libvirtd is
        restarted) in the context of function 'call' then the connection
        is lost and the function 'call' failed, the branch
        virObjectEventStateDeregisterID is therefore taken.
    (4) 'pyobj_conn' is dereferenced the 1st time in
        libvirt_virConnectDomainEventFreeFunc.
    (5) 'pyobj_cbData' (refered to pyobj_conn) is dereferenced the
         2nd time in libvirt_virConnectDomainEventRegisterAny.
    (6) the double free error is triggered.

Resolve this by adding a @doFreeCb boolean in order to avoid calling the
freeCb in virObjectEventStateDeregisterID for any remote call failure in
a remoteConnect*EventRegister* API. For remoteConnect*EventDeregister* calls,
the passed value would be true indicating they should run the freecb if it
exists; whereas, it's false for the remote call failure path.

Patch based on the investigation and initial patch posted by
fangying <[email protected]>.
libvirtmirror pushed a commit that referenced this pull request Jan 4, 2018
Direct leak of 104 byte(s) in 1 object(s) allocated from:
    #0 0x7f904bfbe12b  (/lib64/liblsan.so.0+0xe12b)
    #1 0x7f904ba0ad67 in virAlloc ../../src/util/viralloc.c:144
    #2 0x7f904bbc11a4 in virNetMessageNew ../../src/rpc/virnetmessage.c:42
    #3 0x7f904bbb8e77 in virNetServerClientNewInternal ../../src/rpc/virnetserverclient.c:392
    #4 0x7f904bbb9921 in virNetServerClientNew ../../src/rpc/virnetserverclient.c:440
    #5 0x402ce5 in testIdentity ../../tests/virnetserverclienttest.c:55
    #6 0x403bed in virTestRun ../../tests/testutils.c:180
    #7 0x402c1e in mymain ../../tests/virnetserverclienttest.c:146
    #8 0x404c80 in virTestMain ../../tests/testutils.c:1119
    #9 0x4030d5 in main ../../tests/virnetserverclienttest.c:152
    #10 0x7f9047f7f889 in __libc_start_main (/lib64/libc.so.6+0x20889)

Indirect leak of 4 byte(s) in 1 object(s) allocated from:
    #0 0x7f904bfbe12b  (/lib64/liblsan.so.0+0xe12b)
    #1 0x7f904ba0adc7 in virAllocN ../../src/util/viralloc.c:191
    #2 0x7f904bbb8ec7 in virNetServerClientNewInternal ../../src/rpc/virnetserverclient.c:395
    #3 0x7f904bbb9921 in virNetServerClientNew ../../src/rpc/virnetserverclient.c:440
    #4 0x402ce5 in testIdentity ../../tests/virnetserverclienttest.c:55
    #5 0x403bed in virTestRun ../../tests/testutils.c:180
    #6 0x402c1e in mymain ../../tests/virnetserverclienttest.c:146
    #7 0x404c80 in virTestMain ../../tests/testutils.c:1119
    #8 0x4030d5 in main ../../tests/virnetserverclienttest.c:152
    #9 0x7f9047f7f889 in __libc_start_main (/lib64/libc.so.6+0x20889)

SUMMARY: LeakSanitizer: 108 byte(s) leaked in 2 allocation(s).

Signed-off-by: Marc Hartmayer <[email protected]>
Reviewed-by: John Ferlan <[email protected]>
Thinstation pushed a commit to Thinstation/thinstation that referenced this pull request Nov 19, 2018
	modified:   ts/bin/install_chroot
	modified:   ts/bin/newpython
	modified:   ts/build/boot-images/templates/syslinux/installer/menu/normal.cfg
	modified:   ts/build/conf/devstation/build.conf.example
	modified:   ts/build/conf/devstation/thinstation.conf.buildtime
	modified:   ts/build/conf/installer/build.conf.example
	modified:   ts/build/conf/installer/thinstation.conf.buildtime
	new file:   ts/build/machine/allfirmware/firmware.list
	new file:   ts/build/machine/allfirmware/module.list
	modified:   ts/build/packages/base/etc/rc0.d/80fastboot
	modified:   ts/build/packages/devstation/bin/devcmd
	modified:   ts/build/packages/devstation/dependencies
	new file:   ts/build/packages/devstation/etc/sudoers.d/devstation
	modified:   ts/build/packages/devstation/lib/menu/1build
	new file:   ts/build/packages/gtk-3.0/build/extra/etc/gtk-3.0/settings.ini
	new file:   ts/build/packages/icons-hicolor/build/extra/lib/icons/hicolor/scalable/apps/terminal.svg
	modified:   ts/build/packages/installer/README
	new file:   ts/build/packages/installer/README.html
	modified:   ts/build/packages/installer/bin/install.sh
	modified:   ts/build/packages/installer/bin/installer
	new file:   ts/build/packages/installer/build/finalize
	modified:   ts/build/packages/installer/dependencies
	deleted:    ts/build/packages/installer/lib/indexed-locale.tab
	deleted:    ts/build/packages/installer/lib/indexed-zone.tab
	new file:   ts/build/packages/installer/lib/locale.tab
	new file:   ts/build/packages/sudo/.dna
	new file:   ts/build/packages/sudo/build/install
	new file:   ts/build/packages/sudo/build/remove
	new file:   ts/build/packages/sudo/dependencies
	new file:   ts/build/packages/system-config-printer/build/extra/bin/install-printerdriver
	new file:   ts/build/packages/system-config-printer/build/extra/bin/scp-dbus-service
	new file:   ts/build/packages/system-config-printer/build/extra/bin/system-config-printer
	new file:   ts/build/packages/system-config-printer/build/extra/bin/system-config-printer-applet
	new file:   ts/build/packages/tzupdate/.dna
	new file:   ts/build/packages/tzupdate/build/install
	new file:   ts/build/packages/tzupdate/build/remove
	new file:   ts/build/packages/tzupdate/dependencies
	new file:   ts/build/packages/webkit2gtk/.dna
	new file:   ts/build/packages/webkit2gtk/build/install
	new file:   ts/build/packages/webkit2gtk/build/remove
	new file:   ts/build/packages/webkit2gtk/dependencies
	modified:   ts/build/packages/zenity/dependencies
	deleted:    ts/ports/binary-core/intel-microcode/intel-microcode#20170511-1.pkg.tar.xz
	renamed:    ts/ports/components/gtkdialog-vte/.footprint -> ts/ports/broken/gtkdialog-vte/.footprint
	renamed:    ts/ports/components/gtkdialog-vte/.md5sum -> ts/ports/broken/gtkdialog-vte/.md5sum
	new file:   ts/ports/broken/gtkdialog-vte/Pkgfile
	modified:   ts/ports/components/colord/.footprint
	modified:   ts/ports/components/colord/colord#1.3.2-1.pkg.tar.xz
	modified:   ts/ports/components/eekboard/.footprint
	modified:   ts/ports/components/eekboard/Pkgfile
	modified:   ts/ports/components/eekboard/eekboard#1.0.8-1.pkg.tar.xz
	modified:   ts/ports/components/geoclue/.footprint
	modified:   ts/ports/components/geoclue/geoclue#2.4.3-2.pkg.tar.xz
	modified:   ts/ports/components/gstreamer-compat/gstreamer-compat#0.10.36-3.pkg.tar.xz
	deleted:    ts/ports/components/gtkdialog-vte/Pkgfile
	deleted:    ts/ports/components/gtkdialog-vte/gtkdialog-vte#0.8.3-2.pkg.tar.gz
	modified:   ts/ports/components/ibus/.footprint
	modified:   ts/ports/components/ibus/.md5sum
	modified:   ts/ports/components/ibus/Pkgfile
	new file:   ts/ports/components/ibus/README
	deleted:    ts/ports/components/ibus/ibus#1.5.14-1.pkg.tar.xz
	new file:   ts/ports/components/ibus/ibus#1.5.17-3.pkg.tar.xz
	new file:   ts/ports/components/ibus/post-install
	modified:   ts/ports/components/inkcut/Pkgfile
	deleted:    ts/ports/components/inkcut/inkcut#1.0-1.pkg.tar.gz
	new file:   ts/ports/components/inkcut/inkcut#1.0-1.pkg.tar.xz
	modified:   ts/ports/components/libcanberra/libcanberra#0.30-1.pkg.tar.xz
	modified:   ts/ports/components/libgusb/libgusb#0.2.9-1.pkg.tar.xz
	modified:   ts/ports/components/libimobiledevice/libimobiledevice#1.2.0-1.pkg.tar.xz
	modified:   ts/ports/components/libmbim/libmbim#1.12.2-1.pkg.tar.xz
	modified:   ts/ports/components/libqmi/libqmi#1.12.6-1.pkg.tar.xz
	modified:   ts/ports/components/libuser/libuser#0.62-1.pkg.tar.xz
	modified:   ts/ports/components/libvirt-glib/libvirt-glib#1.0.0-1.pkg.tar.xz
	modified:   ts/ports/components/libvirt/libvirt#1.3.5-1.pkg.tar.xz
	modified:   ts/ports/components/libwacom/libwacom#0.21-1.pkg.tar.xz
	modified:   ts/ports/components/motif/motif#2.3.6-1.pkg.tar.xz
	modified:   ts/ports/components/open-vm-tools/open-vm-tools#10.1.5-1.pkg.tar.xz
	modified:   ts/ports/components/opencryptoki/opencryptoki#3.7.0-1.pkg.tar.xz
	modified:   ts/ports/components/pidgin-sipe/pidgin-sipe#1.21.1-1.pkg.tar.xz
	modified:   ts/ports/components/TigerVNC/tigervnc#1.8.0-1.pkg.tar.xz
	modified:   ts/ports/components/udisks/.footprint
	modified:   ts/ports/components/udisks/udisks#2.1.3-1.pkg.tar.xz
	modified:   ts/ports/components/usbmuxd/.footprint
	modified:   ts/ports/components/usbmuxd/usbmuxd#1.1.0-1.pkg.tar.xz
	modified:   ts/ports/components/virt-viewer/virt-viewer#5.0-1.pkg.tar.xz
	modified:   ts/ports/components/windowmaker/windowmaker#0.95.5-git.pkg.tar.xz
	modified:   ts/ports/contrib/boost/boost#1.63.0-1.pkg.tar.xz
	modified:   ts/ports/contrib/gcr/gcr#3.20.0-1.pkg.tar.xz
	modified:   ts/ports/contrib/geany-plugins/.footprint
	modified:   ts/ports/contrib/geany-plugins/Pkgfile
	modified:   ts/ports/contrib/geany-plugins/geany-plugins#git-1.pkg.tar.xz
	modified:   ts/ports/contrib/geany/.footprint
	modified:   ts/ports/contrib/geany/.md5sum
	modified:   ts/ports/contrib/geany/Pkgfile
	deleted:    ts/ports/contrib/geany/geany#1.29-1.pkg.tar.xz
	new file:   ts/ports/contrib/geany/geany#1.32-1.pkg.tar.xz
	modified:   ts/ports/contrib/glib-networking/glib-networking#2.48.2-1.pkg.tar.xz
	modified:   ts/ports/contrib/gtkspell/gtkspell#2.0.16-1.pkg.tar.xz
	modified:   ts/ports/contrib/inkscape/inkscape#0.92.1-3.pkg.tar.xz
	modified:   ts/ports/contrib/libfm/libfm#git-1.pkg.tar.xz
	modified:   ts/ports/contrib/libsoup/libsoup#2.54.1-1.pkg.tar.xz
	deleted:    ts/ports/contrib/openjpeg/.signature
	modified:   ts/ports/contrib/pidgin/pidgin#2.11.0-1.pkg.tar.xz
	modified:   ts/ports/contrib/rest/rest#0.8.0-1.pkg.tar.xz
	modified:   ts/ports/contrib/spice-gtk/spice-gtk#0.33-1.pkg.tar.xz
	modified:   ts/ports/contrib/spice/spice#0.13.3-1.pkg.tar.xz
	modified:   ts/ports/contrib/vala/vala#0.29.2-1.pkg.tar.xz
	deleted:    ts/ports/contrib/webkit-gtk2/.signature
	modified:   ts/ports/contrib/webkit-gtk2/webkit-gtk2#2.4.11-1.pkg.tar.xz
	modified:   ts/ports/contrib/webkit-gtk3/webkit-gtk3#2.4.11-1.pkg.tar.xz
	new file:   ts/ports/contrib/yelp/.footprint
	new file:   ts/ports/contrib/yelp/.md5sum
	new file:   ts/ports/contrib/yelp/Pkgfile
	new file:   ts/ports/contrib/yelp/yelp#3.22-1.pkg.tar.xz
	deleted:    ts/ports/core/exim/.signature
	modified:   ts/ports/core/libtool/.footprint
	modified:   ts/ports/core/libtool/.md5sum
	modified:   ts/ports/core/libtool/Pkgfile
	deleted:    ts/ports/core/libtool/libtool#2.4.2-1.pkg.tar.gz
	new file:   ts/ports/core/libtool/libtool#2.4.6-2.pkg.tar.xz
	modified:   ts/ports/core/perl/perl#5.20.0-1.pkg.tar.xz
	modified:   ts/ports/gnome/at-spi2-atk/at-spi2-atk#2.20.1-1.pkg.tar.xz
	modified:   ts/ports/gnome/at-spi2-core/at-spi2-core#2.20.2-1.pkg.tar.xz
	modified:   ts/ports/gnome/evince/evince#3.24.1-1.pkg.tar.xz
	modified:   ts/ports/gnome/file-roller/file-roller#3.20.2-1.pkg.tar.xz
	modified:   ts/ports/gnome/gconf/.footprint
	modified:   ts/ports/gnome/gconf/gconf#3.2.6-1.pkg.tar.xz
	modified:   ts/ports/gnome/gdk-pixbuf/gdk-pixbuf#2.34.0-1.pkg.tar.xz
	modified:   ts/ports/gnome/geocode-glib/geocode-glib#3.20.1-2.pkg.tar.xz
	modified:   ts/ports/gnome/glib/.footprint
	modified:   ts/ports/gnome/glib/.md5sum
	modified:   ts/ports/gnome/glib/Pkgfile
	deleted:    ts/ports/gnome/glib/glib#2.48.1-1.pkg.tar.xz
	new file:   ts/ports/gnome/glib/glib#2.54.3-1.pkg.tar.xz
	modified:   ts/ports/gnome/gmtk/gmtk#1.0.9b-1.pkg.tar.xz
	modified:   ts/ports/gnome/gnome-bluetooth/gnome-bluetooth#3.20.0-1.pkg.tar.xz
	modified:   ts/ports/gnome/gnome-control-center/gnome-control-center#3.20.1-1.pkg.tar.xz
	modified:   ts/ports/gnome/gnome-desktop/gnome-desktop#3.20.2-1.pkg.tar.xz
	modified:   ts/ports/gnome/gnome-disk-utility/gnome-disk-utility#3.20.2-1.pkg.tar.xz
	modified:   ts/ports/gnome/gnome-keyring/gnome-keyring#3.20.0-1.pkg.tar.xz
	modified:   ts/ports/gnome/gnome-menus/gnome-menus#3.13.3-1.pkg.tar.xz
	modified:   ts/ports/gnome/gnome-mplayer/gnome-mplayer#1.0.9b-1.pkg.tar.xz
	modified:   ts/ports/gnome/gnome-online-accounts/gnome-online-accounts#3.20.3-2.pkg.tar.xz
	modified:   ts/ports/gnome/gnome-search-tool/gnome-search-tool#3.6.0-1.pkg.tar.xz
	modified:   ts/ports/gnome/gnome-settings-daemon/gnome-settings-daemon#3.20.1-1.pkg.tar.xz
	modified:   ts/ports/gnome/gtk-engines/gtk-engines#2.21.0-1.pkg.tar.xz
	modified:   ts/ports/gnome/GLibSharp/GtkSharp#2.12.10-1.pkg.tar.xz
	modified:   ts/ports/gnome/gtk-theme-adwaita/gtk-theme-adwaita#3.20-1.pkg.tar.xz
	modified:   ts/ports/gnome/gtk-vnc/gtk-vnc#0.6.0-1.pkg.tar.xz
	modified:   ts/ports/gnome/gtk/gtk#2.24.30-1.pkg.tar.xz
	modified:   ts/ports/gnome/gtk3/.footprint
	modified:   ts/ports/gnome/gtk3/.md5sum
	modified:   ts/ports/gnome/gtk3/Pkgfile
	deleted:    ts/ports/gnome/gtk3/gtk3#3.20.8-1.pkg.tar.xz
	new file:   ts/ports/gnome/gtk3/gtk3#3.22.28-1.pkg.tar.xz
	modified:   ts/ports/gnome/gtksourceview/gtksourceview#3.18.1-1.pkg.tar.xz
	modified:   ts/ports/gnome/gvfs/.footprint
	modified:   ts/ports/gnome/gvfs/gvfs#1.28.3-1.pkg.tar.xz
	modified:   ts/ports/gnome/json-glib/json-glib#1.2.2-1.pkg.tar.xz
	modified:   ts/ports/gnome/libgnome-keyring/.footprint
	modified:   ts/ports/gnome/libgnome-keyring/libgnome-keyring#3.12.0-1.pkg.tar.xz
	modified:   ts/ports/gnome/libgnomekbd/libgnomekbd#3.6.0-1.pkg.tar.xz
	modified:   ts/ports/gnome/libgtop/.footprint
	modified:   ts/ports/gnome/libgtop/libgtop#2.34.0-1.pkg.tar.xz
	modified:   ts/ports/gnome/libgudev/libgudev#230-1.pkg.tar.xz
	modified:   ts/ports/gnome/libnotify/libnotify#0.7.6-1.pkg.tar.xz
	modified:   ts/ports/gnome/libpeas/libpeas#1.10.0-1.pkg.tar.xz
	modified:   ts/ports/gnome/librsvg/librsvg#2.40.16-2.pkg.tar.xz
	modified:   ts/ports/gnome/libsecret/libsecret#0.18.5-1.pkg.tar.xz
	modified:   ts/ports/gnome/metacity/metacity#3.20.2-1.pkg.tar.xz
	modified:   ts/ports/gnome/networkmanager-applet/networkmanager-applet#1.2.2-1.pkg.tar.xz
	modified:   ts/ports/gnome/networkmanager/.footprint
	modified:   ts/ports/gnome/NetworkManager/NetworkManager#1.2.2-1.pkg.tar.xz
	modified:   ts/ports/gnome/pango/pango#1.40.1-1.pkg.tar.xz
	modified:   ts/ports/gnome/pygobject-gtk3/pygobject-gtk3#3.21.0-1.pkg.tar.xz
	modified:   ts/ports/gnome/pygobject/pygobject#2.28.6-1.pkg.tar.xz
	modified:   ts/ports/gnome/totem-pl-parser/totem-pl-parser#3.10.7-1.pkg.tar.xz
	modified:   ts/ports/gnome/totem/totem.github.io#3.24.0-1.pkg.tar.xz
	modified:   ts/ports/lxde/python-xklavier/python-xklavier#0.4-1.pkg.tar.xz
	modified:   ts/ports/opt/bash-completion/bash-completion#2.3-2.pkg.tar.xz
	modified:   ts/ports/opt/chromium/.footprint
	modified:   ts/ports/opt/chromium/.md5sum
	deleted:    ts/ports/opt/chromium/0001-ClientNativePixmapFactoryDmabuf-uses-ioctl-instead-o.patch
	deleted:    ts/ports/opt/chromium/0001-Fix-kernel-version-condition-for-including-dma-buf.h.patch
	modified:   ts/ports/opt/chromium/Pkgfile
	deleted:    ts/ports/opt/chromium/chromium#59.0.3071.115-1.pkg.tar.xz
	new file:   ts/ports/opt/chromium/chromium#64.0.3282.186-1.pkg.tar.xz
	new file:   ts/ports/opt/chromium/chromium-64.0.3282.119-constexpr-1.patch
	new file:   ts/ports/opt/chromium/chromium-clang-r2.patch
	new file:   ts/ports/opt/chromium/chromium-cups-r0.patch
	new file:   ts/ports/opt/chromium/chromium-memcpy-r0.patch
	new file:   ts/ports/opt/chromium/chromium-omnibox-unescape-fragment.patch
	new file:   ts/ports/opt/chromium/chromium-skia-harmony.patch
	new file:   ts/ports/opt/chromium/chromium-use-fromUTF8-for-UnicodeString-construction.patch
	deleted:    ts/ports/opt/chromium/chromium.desktop
	new file:   ts/ports/opt/chromium/gcc5.patch
	new file:   ts/ports/opt/chromium/last-commit-position.patch
	deleted:    ts/ports/opt/chromium/nosandboxwarning.patch
	deleted:    ts/ports/opt/cyrus-sasl/.signature
	modified:   ts/ports/opt/dbus-glib/dbus-glib#0.102-2.pkg.tar.xz
	modified:   ts/ports/opt/expat/.footprint
	modified:   ts/ports/opt/expat/.md5sum
	modified:   ts/ports/opt/expat/Pkgfile
	deleted:    ts/ports/opt/expat/expat#2.0.1-2.pkg.tar.gz
	new file:   ts/ports/opt/expat/expat#2.2.5-1.pkg.tar.xz
	deleted:    ts/ports/opt/fetchmail/.signature
	modified:   ts/ports/opt/gnutls/gnutls#3.3.28-1.pkg.tar.xz
	modified:   ts/ports/opt/gobject-introspection/gobject-introspection#1.48.0-1.pkg.tar.xz
	modified:   ts/ports/opt/gstreamer/gstreamer#1.12.1-1.pkg.tar.xz
	modified:   ts/ports/opt/gutenprint/gutenprint#5.2.11-1.pkg.tar.xz
	modified:   ts/ports/opt/imagemagick/.footprint
	modified:   ts/ports/opt/imagemagick/.md5sum
	modified:   ts/ports/opt/imagemagick/Pkgfile
	deleted:    ts/ports/opt/ImageMagick/ImageMagick#6.9.8-10-1.pkg.tar.xz
	new file:   ts/ports/opt/ImageMagick/ImageMagick#6.9.9-35-1.pkg.tar.xz
	modified:   ts/ports/opt/iso-codes/.footprint
	modified:   ts/ports/opt/iso-codes/.md5sum
	modified:   ts/ports/opt/iso-codes/Pkgfile
	deleted:    ts/ports/opt/iso-codes/iso-codes#1.0-1.pkg.tar.gz
	new file:   ts/ports/opt/iso-codes/iso-codes#3.65-1.pkg.tar.xz
	modified:   ts/ports/opt/libffi/.footprint
	modified:   ts/ports/opt/libffi/.md5sum
	modified:   ts/ports/opt/libffi/Pkgfile
	deleted:    ts/ports/opt/libffi/libffi#3.0.10-1.pkg.tar.gz
	new file:   ts/ports/opt/libffi/libffi#3.2.1-3.pkg.tar.xz
	new file:   ts/ports/opt/libjpeg-turbo/.footprint
	new file:   ts/ports/opt/libjpeg-turbo/.md5sum
	new file:   ts/ports/opt/libjpeg-turbo/Pkgfile
	new file:   ts/ports/opt/libjpeg-turbo/libjpeg-turbo#1.5.3-1.pkg.tar.xz
	deleted:    ts/ports/opt/libjpeg/.footprint
	deleted:    ts/ports/opt/libjpeg/.md5sum
	deleted:    ts/ports/opt/libjpeg/Pkgfile
	deleted:    ts/ports/opt/libjpeg/libjpeg#8c-1.pkg.tar.gz
	modified:   ts/ports/opt/libnfsidmap/libnfsidmap#0.24-1.pkg.tar.xz
	modified:   ts/ports/opt/libunique/libunique#1.1.6-1.pkg.tar.xz
	modified:   ts/ports/opt/libwnck/libwnck#2.31.0-1.pkg.tar.xz
	modified:   ts/ports/opt/libxklavier/libxklavier#5.4-1.pkg.tar.xz
	modified:   ts/ports/opt/llvm-shared/.footprint
	modified:   ts/ports/opt/llvm-shared/.md5sum
	deleted:    ts/ports/opt/llvm-shared/0001-GCC-compatibility-Ignore-the-fno-plt-flag.patch
	deleted:    ts/ports/opt/llvm-shared/0002-Enable-SSP-and-PIE-by-default.patch
	modified:   ts/ports/opt/llvm-shared/Pkgfile
	new file:   ts/ports/opt/llvm-shared/README
	deleted:    ts/ports/opt/llvm-shared/disable-llvm-symbolizer-test.patch
	deleted:    ts/ports/opt/llvm-shared/lldb-gcc7.patch
	deleted:    ts/ports/opt/llvm-shared/lldb-libedit.patch
	modified:   ts/ports/opt/llvm-shared/llvm-config.h
	deleted:    ts/ports/opt/llvm-shared/llvm-shared#4.0.1-4.pkg.tar.xz
	new file:   ts/ports/opt/llvm-shared/llvm-shared#5.0.1-1.pkg.tar.xz
	modified:   ts/ports/opt/llvm/.footprint
	modified:   ts/ports/opt/llvm/.md5sum
	deleted:    ts/ports/opt/llvm/0001-GCC-compatibility-Ignore-the-fno-plt-flag.patch
	deleted:    ts/ports/opt/llvm/0002-Enable-SSP-and-PIE-by-default.patch
	modified:   ts/ports/opt/llvm/Pkgfile
	new file:   ts/ports/opt/llvm/README
	deleted:    ts/ports/opt/llvm/disable-llvm-symbolizer-test.patch
	deleted:    ts/ports/opt/llvm/lldb-gcc7.patch
	deleted:    ts/ports/opt/llvm/lldb-libedit.patch
	deleted:    ts/ports/opt/llvm/llvm#4.0.1-4.pkg.tar.xz
	new file:   ts/ports/opt/llvm/llvm#5.0.1-1.pkg.tar.xz
	modified:   ts/ports/opt/llvm/llvm-config.h
	deleted:    ts/ports/opt/mplayer/.signature
	modified:   ts/ports/opt/nspr/.md5sum
	modified:   ts/ports/opt/nspr/Pkgfile
	deleted:    ts/ports/opt/nspr/nspr#4.12-1.pkg.tar.xz
	new file:   ts/ports/opt/nspr/nspr#4.18-1.pkg.tar.xz
	new file:   ts/ports/opt/nspr/nspr.pc.in
	modified:   ts/ports/opt/nss/.footprint
	modified:   ts/ports/opt/nss/.md5sum
	modified:   ts/ports/opt/nss/Pkgfile
	deleted:    ts/ports/opt/nss/nss#3.25-1.pkg.tar.xz
	new file:   ts/ports/opt/nss/nss#3.35-1.pkg.tar.xz
	new file:   ts/ports/opt/nss/nss-softokn.pc.in
	new file:   ts/ports/opt/nss/nss-util.pc.in
	modified:   ts/ports/opt/openldap/openldap#2.4.44-2.pkg.tar.xz
	modified:   ts/ports/opt/polkit/.footprint
	modified:   ts/ports/opt/polkit/polkit#0.112-1.pkg.tar.xz
	modified:   ts/ports/opt/python/.footprint
	modified:   ts/ports/opt/python/.md5sum
	modified:   ts/ports/opt/python/Pkgfile
	deleted:    ts/ports/opt/python/python#2.7.13-1.pkg.tar.xz
	new file:   ts/ports/opt/python/python#2.7.14-1.pkg.tar.xz
	deleted:    ts/ports/opt/qt4/.signature
	deleted:    ts/ports/opt/qt5/.signature
	modified:   ts/ports/opt/ruby/ruby#2.4.1-1.pkg.tar.xz
	deleted:    ts/ports/opt/setuptools/.footprint
	deleted:    ts/ports/opt/setuptools/.md5sum
	deleted:    ts/ports/opt/setuptools/Pkgfile
	deleted:    ts/ports/opt/setuptools/setuptools#0.6c11-1.pkg.tar.gz
	modified:   ts/ports/opt/subversion/.footprint
	modified:   ts/ports/opt/subversion/.md5sum
	modified:   ts/ports/opt/subversion/Pkgfile
	deleted:    ts/ports/opt/subversion/ruby-frozen-nil.patch
	deleted:    ts/ports/opt/subversion/subversion#1.9.5-1.pkg.tar.xz
	new file:   ts/ports/opt/subversion/subversion#1.9.7-1.pkg.tar.xz
	deleted:    ts/ports/opt/subversion/subversion.rpath.fix.patch
	modified:   ts/ports/opt/upower/.footprint
	modified:   ts/ports/opt/upower/upower#0.99.4-1.pkg.tar.xz
	modified:   ts/ports/opt/vte/vte#0.46.1-1.pkg.tar.xz
	modified:   ts/ports/opt/yasm/.footprint
	modified:   ts/ports/opt/yasm/.md5sum
	modified:   ts/ports/opt/yasm/Pkgfile
	deleted:    ts/ports/opt/yasm/yasm#1.1.0-1.pkg.tar.gz
	new file:   ts/ports/opt/yasm/yasm#1.3.0-2.pkg.tar.xz
	new file:   ts/ports/python/certifi/.footprint
	new file:   ts/ports/python/certifi/.md5sum
	new file:   ts/ports/python/certifi/Pkgfile
	new file:   ts/ports/python/certifi/certifi#pip-1.pkg.tar.xz
	new file:   ts/ports/python/chardet/.footprint
	new file:   ts/ports/python/chardet/.md5sum
	new file:   ts/ports/python/chardet/Pkgfile
	new file:   ts/ports/python/chardet/chardet#pip-1.pkg.tar.xz
	modified:   ts/ports/python/cheetah/Pkgfile
	modified:   ts/ports/python/cheetah/cheetah#pip-1.pkg.tar.xz
	modified:   ts/ports/python/cython/.footprint
	modified:   ts/ports/python/cython/Pkgfile
	modified:   ts/ports/python/cython/cython#pip-1.pkg.tar.xz
	new file:   ts/ports/python/idna/.footprint
	new file:   ts/ports/python/idna/.md5sum
	new file:   ts/ports/python/idna/Pkgfile
	new file:   ts/ports/python/idna/idna#pip-1.pkg.tar.xz
	modified:   ts/ports/python/netaddr/Pkgfile
	modified:   ts/ports/python/netaddr/netaddr#pip-1.pkg.tar.xz
	modified:   ts/ports/python/notify2/Pkgfile
	modified:   ts/ports/python/notify2/notify2#pip-1.pkg.tar.xz
	modified:   ts/ports/python/pip/.footprint
	modified:   ts/ports/python/pip/Pkgfile
	modified:   ts/ports/python/pip/pip#pip-1.pkg.tar.xz
	modified:   ts/ports/python/pycups/Pkgfile
	modified:   ts/ports/python/pycups/pycups#pip-1.pkg.tar.xz
	modified:   ts/ports/python/pycurl/.footprint
	modified:   ts/ports/python/pycurl/Pkgfile
	modified:   ts/ports/python/pycurl/pycurl#pip-1.pkg.tar.xz
	modified:   ts/ports/python/pyserial/.footprint
	modified:   ts/ports/python/pyserial/Pkgfile
	modified:   ts/ports/python/pyserial/pyserial#pip-1.pkg.tar.xz
	modified:   ts/ports/python/pyxdg/.footprint
	modified:   ts/ports/python/pyxdg/Pkgfile
	modified:   ts/ports/python/pyxdg/pyxdg#pip-1.pkg.tar.xz
	modified:   ts/ports/python/pyyaml/Pkgfile
	modified:   ts/ports/python/pyyaml/pyyaml#pip-1.pkg.tar.xz
	new file:   ts/ports/python/requests/.footprint
	new file:   ts/ports/python/requests/.md5sum
	new file:   ts/ports/python/requests/Pkgfile
	new file:   ts/ports/python/requests/requests#pip-1.pkg.tar.xz
	modified:   ts/ports/python/scapy/.footprint
	modified:   ts/ports/python/scapy/Pkgfile
	modified:   ts/ports/python/scapy/scapy#pip-1.pkg.tar.xz
	new file:   ts/ports/python/setuptools/.footprint
	new file:   ts/ports/python/setuptools/.md5sum
	new file:   ts/ports/python/setuptools/Pkgfile
	new file:   ts/ports/python/setuptools/setuptools#pip-1.pkg.tar.xz
	modified:   ts/ports/python/simplejson/.footprint
	modified:   ts/ports/python/simplejson/Pkgfile
	modified:   ts/ports/python/simplejson/simplejson#pip-1.pkg.tar.xz
	modified:   ts/ports/python/sqlalchemy/.footprint
	modified:   ts/ports/python/sqlalchemy/Pkgfile
	modified:   ts/ports/python/sqlalchemy/sqlalchemy#pip-1.pkg.tar.xz
	modified:   ts/ports/python/traydevice/traydevice#1.6.2-1.pkg.tar.xz
	new file:   ts/ports/python/tzupdate/.footprint
	new file:   ts/ports/python/tzupdate/.md5sum
	new file:   ts/ports/python/tzupdate/Pkgfile
	new file:   ts/ports/python/tzupdate/tzupdate#pip-1.pkg.tar.xz
	modified:   ts/ports/python/urlgrabber/Pkgfile
	modified:   ts/ports/python/urlgrabber/urlgrabber#pip-1.pkg.tar.xz
	new file:   ts/ports/python/urllib3/.footprint
	new file:   ts/ports/python/urllib3/.md5sum
	new file:   ts/ports/python/urllib3/Pkgfile
	new file:   ts/ports/python/urllib3/urllib3#pip-1.pkg.tar.xz
	modified:   ts/ports/xfce/garcon/.footprint
	modified:   ts/ports/xfce/garcon/garcon#0.6.1-1.pkg.tar.xz
	modified:   ts/ports/xfce/gtk-xfce-engine/gtk-xfce-engine#3.2.0-1.pkg.tar.xz
	modified:   ts/ports/xfce/terminal/terminal#0.8.1-1.pkg.tar.xz
	modified:   ts/ports/xfce/xfce4-genmon-plugin/xfce4-genmon-plugin#4.0.0-1.pkg.tar.xz
	modified:   ts/ports/xfce/xfce4-netload-plugin/.footprint
	modified:   ts/ports/xfce/xfce4-netload-plugin/xfce4-netload-plugin#1.3.1-1.pkg.tar.xz
	modified:   ts/ports/xfce/xfce4-panel/xfce4-panel#4.12.1-1.pkg.tar.xz
	modified:   ts/ports/xfce/xfce4-power-manager/.footprint
	modified:   ts/ports/xfce/xfce4-power-manager/xfce4-power-manager#1.6.0-1.pkg.tar.xz
	modified:   ts/ports/xfce/xfce4-screenshooter/.footprint
	modified:   ts/ports/xfce/xfce4-screenshooter/xfce4-screenshooter#1.9.1-1.pkg.tar.xz
	modified:   ts/ports/xfce/xfce4-session/xfce4-session#4.12.1-1.pkg.tar.xz
	modified:   ts/ports/xfce/xfconf/.footprint
	modified:   ts/ports/xfce/xfconf/xfconf#4.12.1-1.pkg.tar.xz
	modified:   ts/ports/xfce/xfdesktop/xfdesktop#4.12.4-1.pkg.tar.xz
	modified:   ts/ports/xfce/xfmpc/xfmpc#0.2.3-1.pkg.tar.xz
	modified:   ts/ports/xfce/xfwm4-themes/xfwm4-themes#4.10.0-1.pkg.tar.xz
	modified:   ts/ports/xfce/xfwm4/xfwm4#4.12.4-1.pkg.tar.xz
	modified:   ts/ports/xorg-opt/accountsservice/.footprint
	modified:   ts/ports/xorg-opt/accountsservice/accountsservice#0.6.42-1.pkg.tar.xz
	modified:   ts/ports/xorg-opt/colord-gtk/colord-gtk#0.1.26-2.pkg.tar.xz
	modified:   ts/ports/xorg-opt/modemmanager/.footprint
	modified:   ts/ports/xorg-opt/modemmanager/modemmanager#1.4.8-1.pkg.tar.xz
	modified:   ts/ports/xorg-opt/p11-kit/.footprint
	modified:   ts/ports/xorg-opt/p11-kit/.md5sum
	modified:   ts/ports/xorg-opt/p11-kit/Pkgfile
	deleted:    ts/ports/xorg-opt/p11-kit/p11-kit#0.22.1-1.pkg.tar.gz
	new file:   ts/ports/xorg-opt/p11-kit/p11-kit#0.23.2-1.pkg.tar.xz
	deleted:    ts/ports/xorg-opt/pavucontrol/.signature
	modified:   ts/ports/xorg-opt/telepathy-glib/telepathy-glib#0.24.1-1.pkg.tar.xz
	modified:   ts/ports/xorg/libdrm/.footprint
	modified:   ts/ports/xorg/libdrm/.md5sum
	modified:   ts/ports/xorg/libdrm/Pkgfile
	deleted:    ts/ports/xorg/libdrm/libdrm#2.4.81-1.pkg.tar.xz
	new file:   ts/ports/xorg/libdrm/libdrm#2.4.90-1.pkg.tar.xz
	modified:   ts/ports/xorg/mesa3d/.footprint
	modified:   ts/ports/xorg/mesa3d/.md5sum
	deleted:    ts/ports/xorg/mesa3d/MesaLib-10.1.0-svga_texture-1.patch
	modified:   ts/ports/xorg/mesa3d/Pkgfile
	deleted:    ts/ports/xorg/mesa3d/mesa3d#17.1.5-1.pkg.tar.xz
	new file:   ts/ports/xorg/mesa3d/mesa3d#17.3.5-1.pkg.tar.xz
	modified:   ts/ports/xorg/xorg-libxrandr/xorg-libxrandr#1.5.1-1.pkg.tar.xz
	modified:   ts/ports/xorg/xorg-libxshmfence/Pkgfile
	deleted:    ts/ports/xorg/xorg-libxshmfence/xorg-libxshmfence#1.2-1.pkg.tar.xz
	new file:   ts/ports/xorg/xorg-libxshmfence/xorg-libxshmfence#1.3-1.pkg.tar.xz
	modified:   ts/ports/xorg/xorg-xf86-video-qxl/Pkgfile
	modified:   ts/ports/xorg/xorg-xf86-video-qxl/xorg-xf86-video-qxl#0.1.5-2.pkg.tar.xz
	modified:   ts/ports/xorg/xorg-xf86-video-vmware/xorg-xf86-video-vmware#13.2.1-1.pkg.tar.xz
	modified:   ts/unwind_cache/iphone.turbo
	new file:   ts/unwind_cache/sudo.turbo
	new file:   ts/unwind_cache/tzupdate.turbo
	new file:   ts/unwind_cache/webkit2gtk.turbo
	new file:   ts/wind_cache/sudo.turbo
	new file:   ts/wind_cache/tzupdate.turbo
	new file:   ts/wind_cache/webkit2gtk.turbo
jens-maus pushed a commit to hzdr/thinstation that referenced this pull request Jan 11, 2019
	new file:   ts/build/machine/qemu/module.list
	modified:   ts/build/packages/glib/dependencies
	new file:   ts/ports/components/libvirt/.footprint
	new file:   ts/ports/components/libvirt/.md5sum
	new file:   ts/ports/components/libvirt/Pkgfile
	new file:   ts/ports/components/libvirt/libvirt#1.3.5-1.pkg.tar.xz
	new file:   ts/ports/components/virt-viewer/.footprint
	new file:   ts/ports/components/virt-viewer/.md5sum
	new file:   ts/ports/components/virt-viewer/Pkgfile
	new file:   ts/ports/components/virt-viewer/virt-viewer#2.0-1.pkg.tar.xz
	modified:   ts/ports/contrib/spice-gtk/.footprint
	modified:   ts/ports/contrib/spice-gtk/Pkgfile
	modified:   ts/ports/contrib/spice-gtk/spice-gtk#0.26-1.pkg.tar.xz
	modified:   ts/ports/core/curl/.footprint
	modified:   ts/ports/core/curl/.md5sum
	modified:   ts/ports/core/curl/Pkgfile
	deleted:    ts/ports/core/curl/curl#7.44.0-1.pkg.tar.gz
	new file:   ts/ports/core/curl/curl#7.49.1-1.pkg.tar.xz
	modified:   ts/ports/kernel-modules/VERSION
	modified:   ts/ports/kernel-modules/bbswitch/.footprint
	modified:   ts/ports/kernel-modules/bbswitch/bbswitch#0.8-1.pkg.tar.xz
	modified:   ts/ports/kernel-modules/kernel-TS/.footprint
	modified:   ts/ports/kernel-modules/kernel-TS/.md5sum
	modified:   ts/ports/kernel-modules/kernel-TS/Pkgfile
	modified:   ts/ports/kernel-modules/kernel-TS/kernel-TS#1-1.pkg.tar.xz
	modified:   ts/ports/kernel-modules/kernel-TS_64/.footprint
	modified:   ts/ports/kernel-modules/kernel-TS_64/.md5sum
	modified:   ts/ports/kernel-modules/kernel-TS_64/Pkgfile
	modified:   ts/ports/kernel-modules/kernel-TS_64/kernel-TS_64#1-1.pkg.tar.xz
	modified:   ts/ports/kernel-modules/kernel-TS_SMP/.footprint
	modified:   ts/ports/kernel-modules/kernel-TS_SMP/.md5sum
	modified:   ts/ports/kernel-modules/kernel-TS_SMP/Pkgfile
	modified:   ts/ports/kernel-modules/kernel-TS_SMP/kernel-TS_SMP#1-1.pkg.tar.xz
	modified:   ts/ports/kernel-modules/rtl8723bs/.footprint
	modified:   ts/ports/kernel-modules/rtl8723bs/rtl8723bs#git-1.pkg.tar.xz
	modified:   ts/ports/xorg/xorg-xf86-video-qxl/.footprint
	modified:   ts/ports/xorg/xorg-xf86-video-qxl/.md5sum
	modified:   ts/ports/xorg/xorg-xf86-video-qxl/Pkgfile
	new file:   ts/ports/xorg/xorg-xf86-video-qxl/xorg-xf86-video-qxl#0.1.4-2.pkg.tar.xz
	deleted:    ts/ports/xorg/xorg-xf86-video-qxl/xorg-xf86-video-qxl#git-2.pkg.tar.xz
patchew-importer pushed a commit to patchew-project/libvirt that referenced this pull request Jul 9, 2019
When only geteuid() is mocked, the test crashes on Debian 10.

  Fatal: failed to reset uid: No such file or directory

  Program received signal SIGABRT, Aborted.
  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
  50      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
  (gdb) t a a bt

  Thread 1 (Thread 0x7ffff3b3e080 (LWP 12003)):
  #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
  libvirt#1  0x00007ffff7798535 in __GI_abort () at abort.c:79
  libvirt#2  0x00007ffff485ca20 in _gcry_logv (level=level@entry=40, fmt=fmt@entry=0x7ffff4929126 "failed to reset uid: %s\n", arg_ptr=arg_ptr@entry=0x7fffffffe4a0) at ../../src/misc.c:142
  libvirt#3  0x00007ffff485cd61 in _gcry_log_fatal (fmt=fmt@entry=0x7ffff4929126 "failed to reset uid: %s\n") at ../../src/misc.c:218
  libvirt#4  0x00007ffff48639d1 in lock_pool_pages (n=<optimized out>, p=<optimized out>) at ../../src/secmem.c:340
  libvirt#5  _gcry_secmem_init_internal (n=<optimized out>) at ../../src/secmem.c:563
  libvirt#6  0x00007ffff4863d78 in _gcry_secmem_init (n=4096) at ../../src/secmem.c:581
  libvirt#7  0x00007ffff485e4e6 in _gcry_vcontrol (cmd=<optimized out>, arg_ptr=arg_ptr@entry=0x7fffffffe5e0) at ../../src/global.c:506
  libvirt#8  0x00007ffff485a789 in gcry_control (cmd=cmd@entry=GCRYCTL_INIT_SECMEM) at ../../src/visibility.c:79
  libvirt#9  0x00007ffff71af10f in ssh_crypto_init () at ./src/libgcrypt.c:621
  libvirt#10 0x00007ffff7193796 in _ssh_init (constructor=constructor@entry=1) at ./src/init.c:79
  libvirt#11 0x00007ffff71834de in libssh_constructor () at ./src/init.c:116
  libvirt#12 0x00007ffff7fe437a in call_init (l=<optimized out>, argc=argc@entry=1, argv=argv@entry=0x7fffffffe778, env=env@entry=0x7fffffffe788) at dl-init.c:72
  libvirt#13 0x00007ffff7fe4476 in call_init (env=0x7fffffffe788, argv=0x7fffffffe778, argc=1, l=<optimized out>) at dl-init.c:30
  libvirt#14 _dl_init (main_map=0x7ffff7ffe190, argc=1, argv=0x7fffffffe778, env=0x7fffffffe788) at dl-init.c:119
  libvirt#15 0x00007ffff7fd60ca in _dl_start_user () from /lib64/ld-linux-x86-64.so.2
  libvirt#16 0x0000000000000001 in ?? ()
  libvirt#17 0x00007fffffffea26 in ?? ()
  libvirt#18 0x0000000000000000 in ?? ()

Signed-off-by: Andrea Bolognani <[email protected]>
Reviewed-by: Daniel P. Berrangé <[email protected]>
berrange referenced this pull request in berrange/libvirt Sep 2, 2019
The current virt-host-validate command has a bunch of checks
defined in the source code which are thus only extensible by
the upstream project, or downstream code modification.

The checks are implemented by a fairly simple set of rules,
mostly matching the contents of files, or output from commands,
against some expected state or regex.

This lends itself very well to having the checks defined as
metadata rules, which can be processed by a generic engine.

This patch thus converts the virt-host-validate command to be
data driven, with the desired checks defined by a set of XML
files.

Parsing XML from C is incredibly tedious, which has long put
me off doing this conversion to XML defined checks. The size
of the parsing code would be too high to justify the benefits
of the rewrite.

This new impl is thus written in Go to take advantage of its
XML encoding feature that lets you simply annotate struct
fields to define an XML parser.

The new impl also has a few new features in its CLI interface.
It is possible display a list of all facts that are set,
instead of just the subset which have reports associated
with them.

For example, by default

$ virt-host-validate
Checking cgroup memory controller present...PASS
Checking cgroup memory controller mounted...PASS
Checking cgroup cpu controller present...PASS
Checking cgroup cpu controller mounted...PASS
Checking cgroup cpuacct controller present...PASS
Checking cgroup cpuacct controller mounted...PASS
...snip...

But it can be run with

$ virt-host-validate -q -f
Set fact 'libvirt.driver.qemu' = 'true'
Set fact 'libvirt.driver.lxc' = 'true'
Set fact 'libvirt.driver.parallels' = 'true'
Set fact 'cpu.arch' = 'x86_64'
Set fact 'os.kernel' = 'Linux'
Set fact 'os.release' = '5.1.16-300.fc30.x86_64'
Set fact 'os.version' = '#1 SMP Wed Jul 3 15:06:51 UTC 2019'
Set fact 'os.cgroup.controller.cpuset' = 'true'
Set fact 'os.cgroup.controller.cpu' = 'true'
Set fact 'os.cgroup.controller.cpuacct' = 'true'
...snip...

This is quite useful for generating reports to include
on bug reports / support requests.

The main thing lost with this new impl is support for
translation, which covers two sources:

 - Reports associated with the facts defined in the
   XML. It is unclear how we would best deal with this.
   Merge translations from the .po file into the .xml
   files, and then ensure we pick the appropriate
   one to display

 - Error messages when things go wrong in the code
   itself. This would need to use some gettext like
   translation system for golang. I have not
   investigated the options here

Signed-off-by: Daniel P. Berrangé <[email protected]>
berrange referenced this pull request in berrange/libvirt Sep 27, 2019
The current virt-host-validate command has a bunch of checks defined in
the source code which are thus only extensible by the upstream project,
or downstream code modification.

The checks are implemented by a fairly simple set of rules, mostly
matching the contents of files, or output from commands, against some
expected state or regex.

This lends itself very well to having the checks defined in data, in
the form of rules which can be processed by a generic engine. This
patch introduces an implementation of virt-host-validate which does
exactly that, using rules defined by a set of YAML files.

Parsing XML/JSON/YAML/etc from C is incredibly tedious, which has long
discouraged this conversion. The size & fagility of the parsing code
in C would be too high to justify the benefits of a rewrite.

This new impl is thus written in Go to take advantage of its YAML
encoding feature that lets you simply annotate struct fields to define
an YAML parser. YAML was chosen instead of XML because the file format
is more user readable, than XML, and the Go parsing code is even simpler
than with XML.

JSON would have been another valid option instead of YAML. JSON is
said to be optimized for the simplest machine parsing at the cost of
human readability. YAML is said to be optimized for human readability at
the cost of more complex parsers. Interestingly YAML is a true superset
of JSON so although we used a YAML parser, our code can in fact load
JSON files anyway. Comparing the JSON & YAML files for some example
rules, the YAML did indeed appear more readable.

The new impl also has a few new features in its CLI interface. It is
possible display a list of all facts that are set, instead of just the
subset which have reports associated with them.

For example, by default

$ virt-host-validate
Checking cgroup memory controller present...PASS
Checking cgroup memory controller mounted...PASS
Checking cgroup cpu controller present...PASS
Checking cgroup cpu controller mounted...PASS
Checking cgroup cpuacct controller present...PASS
Checking cgroup cpuacct controller mounted...PASS
...snip...

But it can be run with

$ virt-host-validate -q -f
Set fact 'libvirt.driver.qemu' = 'true'
Set fact 'libvirt.driver.lxc' = 'true'
Set fact 'libvirt.driver.parallels' = 'true'
Set fact 'cpu.arch' = 'x86_64'
Set fact 'os.kernel' = 'Linux'
Set fact 'os.release' = '5.1.16-300.fc30.x86_64'
Set fact 'os.version' = '#1 SMP Wed Jul 3 15:06:51 UTC 2019'
Set fact 'os.cgroup.controller.cpuset' = 'true'
Set fact 'os.cgroup.controller.cpu' = 'true'
Set fact 'os.cgroup.controller.cpuacct' = 'true'
...snip...

This is quite useful for generating reports to include on bug reports /
support requests, as it provides much more detailed information than
is included in the summary messages.

The main thing lost with this new impl is support for translation, which
covers two sources:

 - Reports associated with the facts defined in the YAML. It is unclear
   how we would best deal with this. Merge translations from the .po
   file into the .yaml files, and then ensure we pick the appropriate
   one to display.

 - Error messages when things go wrong in the code itself. This would
   need to use some gettext like translation system for golang. I have
   not investigated the options here yet

This impl uses three 3rd party dependancies

 - github.com/spf13/pflag - replacement command line arg parsing. Go's
   standard CLI arg parsing uses single dash for long options and does
   not support short options as a distinct concept. This is a widely
   used drop-in replacement that does the traditional long/short opt
   processing.

 - golang.org/x/sys - this is actually distributed with Golang but
   is considered an optional part of the runtime, since its APIs
   are not platform portable. This is needed to check file access
   permissions and to extract uname data.

 - github.com/ghodss/yaml - this provides the YAML parsing API. The
   observant reviewer will notice the facts.go file contains 'json:'
   attribute annotations. This is because the YAML parser actually
   leverages the JSON parser internally.

Signed-off-by: Daniel P. Berrangé <[email protected]>
berrange referenced this pull request in berrange/libvirt Sep 27, 2019
The current virt-host-validate command has a bunch of checks defined in
the source code which are thus only extensible by the upstream project,
or downstream code modification.

The checks are implemented by a fairly simple set of rules, mostly
matching the contents of files, or output from commands, against some
expected state or regex.

This lends itself very well to having the checks defined in data, in
the form of rules which can be processed by a generic engine. This
patch introduces an implementation of virt-host-validate which does
exactly that, using rules defined by a set of YAML files.

Parsing XML/JSON/YAML/etc from C is incredibly tedious, which has long
discouraged this conversion. The size & fagility of the parsing code
in C would be too high to justify the benefits of a rewrite.

This new impl is thus written in Go to take advantage of its YAML
encoding feature that lets you simply annotate struct fields to define
an YAML parser. YAML was chosen instead of XML because the file format
is more user readable, than XML, and the Go parsing code is even simpler
than with XML.

JSON would have been another valid option instead of YAML. JSON is
said to be optimized for the simplest machine parsing at the cost of
human readability. YAML is said to be optimized for human readability at
the cost of more complex parsers. Interestingly YAML is a true superset
of JSON so although we used a YAML parser, our code can in fact load
JSON files anyway. Comparing the JSON & YAML files for some example
rules, the YAML did indeed appear more readable.

The new impl also has a few new features in its CLI interface. It is
possible display a list of all facts that are set, instead of just the
subset which have reports associated with them.

For example, by default

$ virt-host-validate
Checking cgroup memory controller present...PASS
Checking cgroup memory controller mounted...PASS
Checking cgroup cpu controller present...PASS
Checking cgroup cpu controller mounted...PASS
Checking cgroup cpuacct controller present...PASS
Checking cgroup cpuacct controller mounted...PASS
...snip...

But it can be run with

$ virt-host-validate -q -f
Set fact 'libvirt.driver.qemu' = 'true'
Set fact 'libvirt.driver.lxc' = 'true'
Set fact 'libvirt.driver.parallels' = 'true'
Set fact 'cpu.arch' = 'x86_64'
Set fact 'os.kernel' = 'Linux'
Set fact 'os.release' = '5.1.16-300.fc30.x86_64'
Set fact 'os.version' = '#1 SMP Wed Jul 3 15:06:51 UTC 2019'
Set fact 'os.cgroup.controller.cpuset' = 'true'
Set fact 'os.cgroup.controller.cpu' = 'true'
Set fact 'os.cgroup.controller.cpuacct' = 'true'
...snip...

This is quite useful for generating reports to include on bug reports /
support requests, as it provides much more detailed information than
is included in the summary messages.

The main thing lost with this new impl is support for translation, which
covers two sources:

 - Reports associated with the facts defined in the YAML. It is unclear
   how we would best deal with this. Merge translations from the .po
   file into the .yaml files, and then ensure we pick the appropriate
   one to display.

 - Error messages when things go wrong in the code itself. This would
   need to use some gettext like translation system for golang. I have
   not investigated the options here yet

This impl uses three 3rd party dependancies

 - github.com/spf13/pflag - replacement command line arg parsing. Go's
   standard CLI arg parsing uses single dash for long options and does
   not support short options as a distinct concept. This is a widely
   used drop-in replacement that does the traditional long/short opt
   processing.

 - golang.org/x/sys - this is actually distributed with Golang but
   is considered an optional part of the runtime, since its APIs
   are not platform portable. This is needed to check file access
   permissions and to extract uname data.

 - github.com/ghodss/yaml - this provides the YAML parsing API. The
   observant reviewer will notice the facts.go file contains 'json:'
   attribute annotations. This is because the YAML parser actually
   leverages the JSON parser internally.

Signed-off-by: Daniel P. Berrangé <[email protected]>
libvirtmirror pushed a commit that referenced this pull request Aug 4, 2020
If there's a list of mdevs to be assigned to a domain, but one of them
(NOT the first) is already assigned to a different domain we're going
to crash in the qemuProcessStop phase in
virMediatedDeviceListFindIndex, because some of the pointers in
mgr->activeMediatedHostdevs are dangling. This is due to
virMediatedDeviceListMarkDevices using cleanup instead of rollback when
we find out that a device is already taken.

Reproducer steps:
1. start vm1 with mdev1
2. start vm2 with mdev2, mdev1 (the order is important!)

Backtrace:
 #0  0x0000ffffb8c36250 in strcmp
 #1  0x0000ffffb9b80754 in virMediatedDeviceListFindIndex
 #2  0x0000ffffb9b80870 in virMediatedDeviceListFind
 #3  0x0000ffffb9c9e168 in virHostdevReAttachMediatedDevices
 #4  0x0000ffff9949f724 in qemuHostdevReAttachMediatedDevices
 #5  0x0000ffff9949f7f8 in qemuHostdevReAttachDomainDevices
 #6  0x0000ffff994bcd70 in qemuProcessStop
 #7  0x0000ffff994bf4e0 in qemuProcessStart

Signed-off-by: Binfeng Wu <[email protected]>
Reviewed-by: Erik Skultety <[email protected]>
libvirtmirror pushed a commit that referenced this pull request Aug 7, 2020
There is a race between  vir_event_thread_finalize and
virEventThreadWorker in releasing the last reference on
the GMainContext. If virEventThreadDataFree() runs after
vir_event_thread_finalize releases its reference, then
it will release the last reference on the GMainContext.
As a result g_autoptr cleanup on the GSource will access
free'd memory.

The race can be seen in non-deterministic crashes of the
virt-run-qemu program during its shutdown, but could
also likely affect the main libvirtd QEMU driver:

  Thread 2 (Thread 0x7f508ffff700 (LWP 222813)):
  #0  0x00007f509c8e26b0 in malloc_consolidate (av=av@entry=0x7f5088000020) at malloc.c:4488
  #1  0x00007f509c8e4b08 in _int_malloc (av=av@entry=0x7f5088000020, bytes=bytes@entry=2048) at malloc.c:3711
  #2  0x00007f509c8e6412 in __GI___libc_malloc (bytes=2048) at malloc.c:3073
  #3  0x00007f509d6e925e in g_realloc (mem=0x0, n_bytes=2048) at gmem.c:164
  #4  0x00007f509d705a57 in g_string_maybe_expand (string=string@entry=0x7f5088001f20, len=len@entry=1024) at gstring.c:102
  #5  0x00007f509d705ab6 in g_string_sized_new (dfl_size=dfl_size@entry=1024) at gstring.c:127
  #6  0x00007f509d708c5e in g_test_log_dump (len=<synthetic pointer>, msg=<synthetic pointer>) at gtestutils.c:3330
  #7  0x00007f509d708c5e in g_test_log
      (lbit=G_TEST_LOG_ERROR, string1=0x7f508800fcb0 "GLib:ERROR:ghash.c:377:g_hash_table_lookup_node: assertion failed: (hash_table->ref_count > 0)", string2=<optimized out>, n_args=0, largs=0x0) at gtestutils.c:975
  #8  0x00007f509d70af2a in g_assertion_message
      (domain=<optimized out>, file=0x7f509d7324a2 "ghash.c", line=<optimized out>, func=0x7f509d732750 <__func__.11348> "g_hash_table_lookup_node", message=<optimized out>)
      at gtestutils.c:2504
  #9  0x00007f509d70af8e in g_assertion_message_expr
      (domain=domain@entry=0x7f509d72d76e "GLib", file=file@entry=0x7f509d7324a2 "ghash.c", line=line@entry=377, func=func@entry=0x7f509d732750 <__func__.11348> "g_hash_table_lookup_node", expr=expr@entry=0x7f509d732488 "hash_table->ref_count > 0") at gtestutils.c:2555
  #10 0x00007f509d6d197e in g_hash_table_lookup_node (hash_table=0x55b70ace1760, key=<optimized out>, hash_return=<synthetic pointer>) at ghash.c:377
  #11 0x00007f509d6d197e in g_hash_table_lookup_node (hash_return=<synthetic pointer>, key=<optimized out>, hash_table=0x55b70ace1760) at ghash.c:361
  #12 0x00007f509d6d197e in g_hash_table_remove_internal (hash_table=0x55b70ace1760, key=<optimized out>, notify=1) at ghash.c:1371
  #13 0x00007f509d6e0664 in g_source_unref_internal (source=0x7f5088000b60, context=0x55b70ad87e00, have_lock=0) at gmain.c:2103
  #14 0x00007f509d6e1f64 in g_source_unref (source=<optimized out>) at gmain.c:2176
  #15 0x00007f50a08ff84c in glib_autoptr_cleanup_GSource (_ptr=<synthetic pointer>) at /usr/include/glib-2.0/glib/glib-autocleanups.h:58
  #16 0x00007f50a08ff84c in virEventThreadWorker (opaque=0x55b70ad87f80) at ../../src/util/vireventthread.c:114
  #17 0x00007f509d70bd4a in g_thread_proxy (data=0x55b70acf3850) at gthread.c:784
  #18 0x00007f509d04714a in start_thread (arg=<optimized out>) at pthread_create.c:479
  #19 0x00007f509c95cf23 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

  Thread 1 (Thread 0x7f50a1380c00 (LWP 222802)):
  #0  0x00007f509c8977ff in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
  #1  0x00007f509c881c35 in __GI_abort () at abort.c:79
  #2  0x00007f509d72a823 in g_mutex_clear (mutex=0x55b70ad87e00) at gthread-posix.c:1307
  #3  0x00007f509d72a823 in g_mutex_clear (mutex=mutex@entry=0x55b70ad87e00) at gthread-posix.c:1302
  #4  0x00007f509d6e1a84 in g_main_context_unref (context=0x55b70ad87e00) at gmain.c:582
  #5  0x00007f509d6e1a84 in g_main_context_unref (context=0x55b70ad87e00) at gmain.c:541
  #6  0x00007f50a08ffabb in vir_event_thread_finalize (object=0x55b70ad83180 [virEventThread]) at ../../src/util/vireventthread.c:50
  #7  0x00007f509d9c48a9 in g_object_unref (_object=<optimized out>) at gobject.c:3340
  #8  0x00007f509d9c48a9 in g_object_unref (_object=0x55b70ad83180) at gobject.c:3232

  #9  0x00007f509583d311 in qemuProcessQMPFree (proc=proc@entry=0x55b70ad87b90) at ../../src/qemu/qemu_process.c:8355
  #10 0x00007f5095790f58 in virQEMUCapsInitQMPSingle
      (qemuCaps=qemuCaps@entry=0x55b70ad88010, libDir=libDir@entry=0x55b70ad049e0 "/tmp/virt-qemu-run-VZC9N0/lib/qemu", runUid=runUid@entry=107, runGid=runGid@entry=107, onlyTCG=onlyTCG@entry=false) at ../../src/qemu/qemu_capabilities.c:5409
  #11 0x00007f509579108f in virQEMUCapsInitQMP (runGid=107, runUid=107, libDir=0x55b70ad049e0 "/tmp/virt-qemu-run-VZC9N0/lib/qemu", qemuCaps=0x55b70ad88010)
      at ../../src/qemu/qemu_capabilities.c:5420
  #12 0x00007f509579108f in virQEMUCapsNewForBinaryInternal
      (hostArch=VIR_ARCH_X86_64, binary=binary@entry=0x55b70ad7dc40 "/usr/libexec/qemu-kvm", libDir=0x55b70ad049e0 "/tmp/virt-qemu-run-VZC9N0/lib/qemu", runUid=107, runGid=107, hostCPUSignature=0x55b70ad01320 "GenuineIntel, Intel(R) Xeon(R) Silver 4210 CPU @ 2.20GHz, family: 6, model: 85, stepping: 7", microcodeVersion=83898113, kernelVersion=0x55b70ad00d60 "4.18.0-211.el8.x86_64 #1 SMP Thu Jun 4 08:08:16 UTC 2020") at ../../src/qemu/qemu_capabilities.c:5472
  #13 0x00007f5095791373 in virQEMUCapsNewData (binary=0x55b70ad7dc40 "/usr/libexec/qemu-kvm", privData=0x55b70ad5b8f0) at ../../src/qemu/qemu_capabilities.c:5505
  #14 0x00007f50a09a32b1 in virFileCacheNewData (name=0x55b70ad7dc40 "/usr/libexec/qemu-kvm", cache=<optimized out>) at ../../src/util/virfilecache.c:208
  #15 0x00007f50a09a32b1 in virFileCacheValidate (cache=cache@entry=0x55b70ad5c030, name=name@entry=0x55b70ad7dc40 "/usr/libexec/qemu-kvm", data=data@entry=0x7ffca39ffd90)
      at ../../src/util/virfilecache.c:277
  #16 0x00007f50a09a37ea in virFileCacheLookup (cache=cache@entry=0x55b70ad5c030, name=name@entry=0x55b70ad7dc40 "/usr/libexec/qemu-kvm") at ../../src/util/virfilecache.c:310
  #17 0x00007f5095791627 in virQEMUCapsCacheLookup (cache=0x55b70ad5c030, binary=0x55b70ad7dc40 "/usr/libexec/qemu-kvm") at ../../src/qemu/qemu_capabilities.c:5647
  #18 0x00007f50957c34c3 in qemuDomainPostParseDataAlloc (def=<optimized out>, parseFlags=<optimized out>, opaque=<optimized out>, parseOpaque=0x7ffca39ffe18)
      at ../../src/qemu/qemu_domain.c:5470
  #19 0x00007f50a0a34051 in virDomainDefPostParse
      (def=def@entry=0x55b70ad7d200, parseFlags=parseFlags@entry=258, xmlopt=xmlopt@entry=0x55b70ad5d010, parseOpaque=parseOpaque@entry=0x0)
      at ../../src/conf/domain_conf.c:5970
  #20 0x00007f50a0a464bb in virDomainDefParseNode
      (xml=xml@entry=0x55b70aced140, root=root@entry=0x55b70ad5f020, xmlopt=xmlopt@entry=0x55b70ad5d010, parseOpaque=parseOpaque@entry=0x0, flags=flags@entry=258)
      at ../../src/conf/domain_conf.c:22520
  #21 0x00007f50a0a4669b in virDomainDefParse
      (xmlStr=xmlStr@entry=0x55b70ad5f9e0 "<domain type='kvm'>\n  <name>83</name>\n  <uuid>9350639d-1c8a-4f51-a4a6-4eaf8eabe83e</uuid>\n  <metadata>\n    <libosinfo:libosinfo xmlns:libosinfo=\"http://libosinfo.org/xmlns/libvirt/domain/1.0\">\n      <"..., filename=filename@entry=0x0, xmlopt=0x55b70ad5d010, parseOpaque=parseOpaque@entry=0x0, flags=flags@entry=258) at ../../src/conf/domain_conf.c:22474
  #22 0x00007f50a0a467ae in virDomainDefParseString
      (xmlStr=xmlStr@entry=0x55b70ad5f9e0 "<domain type='kvm'>\n  <name>83</name>\n  <uuid>9350639d-1c8a-4f51-a4a6-4eaf8eabe83e</uuid>\n  <metadata>\n    <libosinfo:libosinfo xmlns:libosinfo=\"http://libosinfo.org/xmlns/libvirt/domain/1.0\">\n      <"..., xmlopt=<optimized out>, parseOpaque=parseOpaque@entry=0x0, flags=flags@entry=258)
      at ../../src/conf/domain_conf.c:22488
  #23 0x00007f50958ce112 in qemuDomainCreateXML
      (conn=0x55b70acf9090, xml=0x55b70ad5f9e0 "<domain type='kvm'>\n  <name>83</name>\n  <uuid>9350639d-1c8a-4f51-a4a6-4eaf8eabe83e</uuid>\n  <metadata>\n    <libosinfo:libosinfo xmlns:libosinfo=\"http://libosinfo.org/xmlns/libvirt/domain/1.0\">\n      <"..., flags=0) at ../../src/qemu/qemu_driver.c:1744
  #24 0x00007f50a0c268ac in virDomainCreateXML
      (conn=0x55b70acf9090, xmlDesc=0x55b70ad5f9e0 "<domain type='kvm'>\n  <name>83</name>\n  <uuid>9350639d-1c8a-4f51-a4a6-4eaf8eabe83e</uuid>\n  <metadata>\n    <libosinfo:libosinfo xmlns:libosinfo=\"http://libosinfo.org/xmlns/libvirt/domain/1.0\">\n      <"..., flags=0) at ../../src/libvirt-domain.c:176
  #25 0x000055b709547e7b in main (argc=<optimized out>, argv=<optimized out>) at ../../src/qemu/qemu_shim.c:289

The solution is to explicitly unref the GSource at a safe time instead
of letting g_autoptr unref it when leaving scope.

Reviewed-by: Michal Privoznik <[email protected]>
Signed-off-by: Daniel P. Berrangé <[email protected]>
libvirtmirror pushed a commit that referenced this pull request Sep 22, 2020
Don't process subchannel devices where `def->driver` is not set. This
fixes the following segfault:

Thread 21 "nodedev-init" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x3ffb08fc910 (LWP 64303)]
(gdb) bt
 #0  0x000003fffd1272b4 in __strcmp_vx () at /lib64/libc.so.6
 #1  0x000003ffc260c3a8 in udevProcessCSS (device=0x3ff9018d130, def=0x3ff90194a90)
 #2  0x000003ffc260cb78 in udevGetDeviceDetails (device=0x3ff9018d130, def=0x3ff90194a90)
 #3  0x000003ffc260d126 in udevAddOneDevice (device=0x3ff9018d130)
 #4  0x000003ffc260d414 in udevProcessDeviceListEntry (udev=0x3ffa810d800, list_entry=0x3ff90001990)
 #5  0x000003ffc260d638 in udevEnumerateDevices (udev=0x3ffa810d800)
 #6  0x000003ffc260e08e in nodeStateInitializeEnumerate (opaque=0x3ffa810d800)
 #7  0x000003fffdaa14b6 in virThreadHelper (data=0x3ffa810df00)
 #8  0x000003fffc309ed6 in start_thread ()
 #9  0x000003fffd185e66 in thread_start ()
(gdb) p *def
$2 = {
  name = 0x0,
  sysfs_path = 0x3ff90198e80 "/sys/devices/css0/0.0.ff40",
  parent = 0x0,
  parent_sysfs_path = 0x0,
  parent_wwnn = 0x0,
  parent_wwpn = 0x0,
  parent_fabric_wwn = 0x0,
  driver = 0x0,
  devnode = 0x0,
  devlinks = 0x3ff90194670,
  caps = 0x3ff90194380
}

Fixes: 05e6cda ("node_device: detect CSS devices")
Reviewed-by: Boris Fiuczynski <[email protected]>
Reviewed-by: Erik Skultety <[email protected]>
Signed-off-by: Marc Hartmayer <[email protected]>
libvirtmirror pushed a commit that referenced this pull request Dec 3, 2020
Commit f1b0890 introduced a potential crash due to incorrect operator
precedence when accessing an element from a pointer to an array.

Backtrace below:

  #0  virNodeDeviceGetMdevTypesCaps (sysfspath=0x7fff801661e0 "/sys/devices/pci0000:00/0000:00:02.0", mdev_types=0x7fff801c9b40, nmdev_types=0x7fff801c9b48) at ../src/conf/node_device_conf.c:2676
  #1  0x00007ffff7caf53d in virNodeDeviceGetPCIDynamicCaps (sysfsPath=0x7fff801661e0 "/sys/devices/pci0000:00/0000:00:02.0", pci_dev=0x7fff801c9ac8) at ../src/conf/node_device_conf.c:2705
  #2  0x00007ffff7cae38f in virNodeDeviceUpdateCaps (def=0x7fff80168a10) at ../src/conf/node_device_conf.c:2342
  #3  0x00007ffff7cb11c0 in virNodeDeviceObjMatch (obj=0x7fff84002e50, flags=0) at ../src/conf/virnodedeviceobj.c:850
  #4  0x00007ffff7cb153d in virNodeDeviceObjListExportCallback (payload=0x7fff84002e50, name=0x7fff801cbc20 "pci_0000_00_02_0", opaque=0x7fffe2ffc6a0) at ../src/conf/virnodedeviceobj.c:909
  #5  0x00007ffff7b69146 in virHashForEach (table=0x7fff9814b700 = {...}, iter=0x7ffff7cb149e <virNodeDeviceObjListExportCallback>, opaque=0x7fffe2ffc6a0) at ../src/util/virhash.c:394
  #6  0x00007ffff7cb1694 in virNodeDeviceObjListExport (conn=0x7fff98013170, devs=0x7fff98154430, devices=0x7fffe2ffc798, filter=0x7ffff7cf47a1 <virConnectListAllNodeDevicesCheckACL>, flags=0)
          at ../src/conf/virnodedeviceobj.c:943
  #7  0x00007fffe00694b2 in nodeConnectListAllNodeDevices (conn=0x7fff98013170, devices=0x7fffe2ffc798, flags=0) at ../src/node_device/node_device_driver.c:228
  #8  0x00007ffff7e703aa in virConnectListAllNodeDevices (conn=0x7fff98013170, devices=0x7fffe2ffc798, flags=0) at ../src/libvirt-nodedev.c:130
  #9  0x000055555557f796 in remoteDispatchConnectListAllNodeDevices (server=0x555555627080, client=0x5555556bf050, msg=0x5555556c0000, rerr=0x7fffe2ffc8a0, args=0x7fffd4008470, ret=0x7fffd40084e0)
          at src/remote/remote_daemon_dispatch_stubs.h:1613
  #10 0x000055555557f6f9 in remoteDispatchConnectListAllNodeDevicesHelper (server=0x555555627080, client=0x5555556bf050, msg=0x5555556c0000, rerr=0x7fffe2ffc8a0, args=0x7fffd4008470, ret=0x7fffd40084e0)
          at src/remote/remote_daemon_dispatch_stubs.h:1591
  #11 0x00007ffff7ce9542 in virNetServerProgramDispatchCall (prog=0x555555690c10, server=0x555555627080, client=0x5555556bf050, msg=0x5555556c0000) at ../src/rpc/virnetserverprogram.c:428
  #12 0x00007ffff7ce90bd in virNetServerProgramDispatch (prog=0x555555690c10, server=0x555555627080, client=0x5555556bf050, msg=0x5555556c0000) at ../src/rpc/virnetserverprogram.c:302
  #13 0x00007ffff7cf042b in virNetServerProcessMsg (srv=0x555555627080, client=0x5555556bf050, prog=0x555555690c10, msg=0x5555556c0000) at ../src/rpc/virnetserver.c:137
  #14 0x00007ffff7cf04eb in virNetServerHandleJob (jobOpaque=0x5555556b66b0, opaque=0x555555627080) at ../src/rpc/virnetserver.c:154
  #15 0x00007ffff7bd912f in virThreadPoolWorker (opaque=0x55555562bc70) at ../src/util/virthreadpool.c:163
  #16 0x00007ffff7bd8645 in virThreadHelper (data=0x55555562bc90) at ../src/util/virthread.c:233
  #17 0x00007ffff6d90432 in start_thread () at /lib64/libpthread.so.0
  #18 0x00007ffff75c5913 in clone () at /lib64/libc.so.6

Signed-off-by: Jonathon Jongsma <[email protected]>
Reviewed-by: Ján Tomko <[email protected]>
Signed-off-by: Ján Tomko <[email protected]>
libvirtmirror pushed a commit that referenced this pull request Feb 17, 2021
 Setting the system time backward would lead to a
 multiplication overflow in function virKeepAliveStart.
 The function virKeepAliveTimerInternal got the same bug too.

 Backtrace below:
 #0  0x0000ffffae898470 in raise () from /usr/lib64/libc.so.6
 #1  0x0000ffffae89981c in abort () from /usr/lib64/libc.so.6
 #2  0x0000ffffaf9a36a8 in __mulvsi3 () from /usr/lib64/libvirt.so.0
 #3  0x0000ffffaf8fd9e8 in virKeepAliveStart (ka=0xaaaaf954ce10, interval=interval entry=0,
     count=count entry=0) at ../../src/rpc/virkeepalive.c:283
 #4  0x0000ffffaf908560 in virNetServerClientStartKeepAlive (client=0xaaaaf954cbe0)
     at ../../src/rpc/virnetserverclient.c:1628
 #5  0x0000aaaac57eb6dc in remoteDispatchConnectSupportsFeature (server=0xaaaaf95309d0,
     msg=0xaaaaf9549d90, ret=0xffff8c007fc0, args=0xffff8c002e70, rerr=0xffff9ea054a0,
     client=0xaaaaf954cbe0) at ../../src/remote/remote_daemon_dispatch.c:5063
 #6  remoteDispatchConnectSupportsFeatureHelper (server=0xaaaaf95309d0, client=0xaaaaf954cbe0,
     msg=0xaaaaf9549d90, rerr=0xffff9ea054a0, args=0xffff8c002e70, ret=0xffff8c007fc0)
     at ./remote/remote_daemon_dispatch_stubs.h:3503
 #7  0x0000ffffaf9053a4 in virNetServerProgramDispatchCall(msg=0xaaaaf9549d90, client=0xaaaaf954cbe0,
     server=0x0, prog=0xaaaaf953a170) at ../../src/rpc/virnetserverprogram.c:451
 #8  virNetServerProgramDispatch (prog=0xaaaaf953a170, server=0x0, server entry=0xaaaaf95309d0,
     client=0xaaaaf954cbe0, msg=0xaaaaf9549d90) at ../../src/rpc/virnetserverprogram.c:306
 #9  0x0000ffffaf90a6bc in virNetServerProcessMsg (msg=<optimized out>, prog=<optimized out>,
     client=<optimized out>, srv=0xaaaaf95309d0) at ../../src/rpc/virnetserver.c:137
 #10 virNetServerHandleJob (jobOpaque=0xaaaaf950df80, opaque=0xaaaaf95309d0)
     at ../../src/rpc/virnetserver.c:154
 #11 0x0000ffffaf812e14 in virThreadPoolWorker (opaque=<optimized out>)
     at ../../src/util/virthreadpool.c:163
 #12 0x0000ffffaf81237c in virThreadHelper (data=<optimized out>) at ../../src/util/virthread.c:246
 #13 0x0000ffffaea327ac in ?? () from /usr/lib64/libpthread.so.0
 #14 0x0000ffffae93747c in ?? () from /usr/lib64/libc.so.6
 (gdb) frame 3
 #3  0x0000ffffaf8fd9e8 in virKeepAliveStart (ka=0xaaaaf954ce10, interval=interval entry=0,
     count=count entry=0) at ../../src/rpc/virkeepalive.c:283
 283            timeout = ka->interval - delay;
 (gdb) list
 278    now = time(NULL);
 279    delay = now - ka->lastPacketReceived; <='delay' got a negative value
 280    if (delay > ka->interval)
 281        timeout = 0;
 282    else
 283        timeout = ka->interval - delay;
 284    ka->intervalStart = now - (ka->interval - timeout);
 285    ka->timer = virEventAddTimeout(timeout * 1000, virKeepAliveTimer, <= multiplication overflow
 286                                   ka, virObjectFreeCallback);
 287    if (ka->timer < 0)
 (gdb) p now
 $2 = 18288001
 (gdb) p ka->lastPacketReceived
 $3 = 1609430405

Signed-off-by: BiaoXiang Ye <[email protected]>
Reviewed-by: Ján Tomko <[email protected]>
Signed-off-by: Ján Tomko <[email protected]>
libvirtmirror pushed a commit that referenced this pull request Mar 1, 2021
…romBacking

Commit bc3a78f errorneously removed the return value check from
virStorageSourceNewFromBacking. In cases when we e.g. can't parse the
backing store string this leads to a crash:

 #0  virStorageSourceGetActualType (def=0x0) at ../../../libvirt/src/conf/storage_source_conf.c:1014
 #1  0x00007ffff7cee4f9 in virStorageSourceIsLocalStorage (src=<optimized out>) at ../../../libvirt/src/conf/storage_source_conf.c:1026
 #2  0x00007ffff455c97c in storageBackendProbeTarget (encryption=0x7fff9c122ce8, target=0x7fff9c122c68) at ../../../libvirt/src/storage/storage_util.c:3443
 #3  virStorageBackendRefreshVolTargetUpdate (vol=0x7fff9c122c30) at ../../../libvirt/src/storage/storage_util.c:3519
 #4  0x00007ffff455cdc0 in virStorageBackendRefreshLocal (pool=0x7fff9c010ea0) at ../../../libvirt/src/storage/storage_util.c:3593
 #5  0x00007ffff454f0a1 in storagePoolRefreshImpl
    (backend=backend@entry=0x7ffff4711180 <virStorageBackendDirectory>, obj=obj@entry=0x7fff9c010ea0, stateFile=stateFile@entry=0x7fff9c111a90 "/var/run/libvirt/storage/tmp.xml") at ../../../libvirt/src/storage/storage_driver.c:103
 #6  0x00007ffff4550ea5 in storagePoolUpdateStateCallback (obj=0x7fff9c010ea0, opaque=<optimized out>) at ../../../libvirt/src/storage/storage_driver.c:165
 #7  0x00007ffff7cefef4 in virStoragePoolObjListForEachCb (payload=<optimized out>, name=<optimized out>, opaque=0x7fffc8a489c0)
    at ../../../libvirt/src/conf/virstorageobj.c:435
 #8  0x00007ffff7c03195 in virHashForEachSafe
    (table=<optimized out>, iter=iter@entry=0x7ffff7cefec0 <virStoragePoolObjListForEachCb>, opaque=opaque@entry=0x7fffc8a489c0)
    at ../../../libvirt/src/util/virhash.c:414
 #9  0x00007ffff7cf0520 in virStoragePoolObjListForEach
    (pools=<optimized out>, iter=iter@entry=0x7ffff4550e10 <storagePoolUpdateStateCallback>, opaque=opaque@entry=0x0)
    at ../../../libvirt/src/conf/virstorageobj.c:468
 #10 0x00007ffff454f43a in storagePoolUpdateAllState () at ../../../libvirt/src/storage/storage_driver.c:184
 #11 storageStateInitialize (privileged=<optimized out>, root=<optimized out>, callback=<optimized out>, opaque=<optimized out>)
    at ../../../libvirt/src/storage/storage_driver.c:315
 #12 0x00007ffff7e10c04 in virStateInitialize
    (opaque=0x555555621820, callback=0x55555557b1d0 <daemonInhibitCallback>, root=0x0, mandatory=<optimized out>, privileged=true)
    at ../../../libvirt/src/libvirt.c:656
 #13 virStateInitialize
    (privileged=<optimized out>, mandatory=mandatory@entry=false, root=root@entry=0x0, callback=callback@entry=0x55555557b1d0 <daemonInhibitCallback>, opaque=opaque@entry=0x555555621820) at ../../../libvirt/src/libvirt.c:638
 #14 0x000055555557b230 in daemonRunStateInit (opaque=0x555555621820) at ../../../libvirt/src/remote/remote_daemon.c:605
 #15 0x00007ffff7c46bb5 in virThreadHelper (data=<optimized out>) at ../../../libvirt/src/util/virthread.c:233
 #16 0x00007ffff6e453f9 in start_thread () at /lib64/libpthread.so.0
 #17 0x00007ffff766fb53 in clone () at /lib64/libc.so

An invalid image can be easily created by:

$ qemu-img create -f qcow2 -F qcow2 -b 'json:{' -u img.qcow2 10M

Signed-off-by: Peter Krempa <[email protected]>
Reviewed-by: Michal Privoznik <[email protected]>
libvirtmirror pushed a commit that referenced this pull request Mar 1, 2021
…active

If the VM isn't active calculating the job stats doesn't make sense.
Additionally this prevents a crash of libvirtd if qemu terminates while
libvirt wasn't running:

Thread 28 "init-backup-tes" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffb9310640 (LWP 3201116)]
qemuDomainJobInfoUpdateTime (jobInfo=0x0) at ../../../libvirt/src/qemu/qemu_domainjob.c:275
275	    if (!jobInfo->started)
(gdb) bt
 #0  qemuDomainJobInfoUpdateTime (jobInfo=0x0) at ../../../libvirt/src/qemu/qemu_domainjob.c:275
 #1  0x00007fffcba1a12d in qemuBackupJobTerminate (vm=0x7fff9c1bc840, jobstatus=QEMU_DOMAIN_JOB_STATUS_CANCELED) at ../../../libvirt/src/qemu/qemu_backup.c:563
 #2  0x00007fffcbaefcae in qemuProcessStop
    (driver=0x7fff9c144ff0, vm=0x7fff9c1bc840, reason=VIR_DOMAIN_SHUTOFF_DAEMON, asyncJob=QEMU_ASYNC_JOB_NONE, flags=<optimized out>)
    at ../../../libvirt/src/qemu/qemu_process.c:7812
 #3  0x00007fffcbaf2a10 in qemuProcessReconnect (opaque=<optimized out>) at ../../../libvirt/src/qemu/qemu_process.c:8578
 #4  0x00007ffff7c46bb5 in virThreadHelper (data=<optimized out>) at ../../../libvirt/src/util/virthread.c:233
 #5  0x00007ffff6e453f9 in start_thread () at /lib64/libpthread.so.0
 #6  0x00007ffff766fb53 in clone () at /lib64/libc.so.6

Signed-off-by: Peter Krempa <[email protected]>
Reviewed-by: Michal Privoznik <[email protected]>
libvirtmirror pushed a commit that referenced this pull request Mar 18, 2021
If libvirtd is terminated before the node driver finishes
initialization, it can crash with a backtrace similar to the following:

    Stack trace of thread 1922933:
    #0  0x00007f8515178774 g_hash_table_find (libglib-2.0.so.0)
    #1  0x00007f851593ea98 virHashSearch (libvirt.so.0)
    #2  0x00007f8515a1dd83 virNodeDeviceObjListSearch (libvirt.so.0)
    #3  0x00007f84cceb40a1 udevAddOneDevice (libvirt_driver_nodedev.so)
    #4  0x00007f84cceb5fae nodeStateInitializeEnumerate (libvirt_driver_nodedev.so)
    #5  0x00007f85159840cb virThreadHelper (libvirt.so.0)
    #6  0x00007f8511c7d14a start_thread (libpthread.so.0)
    #7  0x00007f851442bdb3 __clone (libc.so.6)

    Stack trace of thread 1922863:
    #0  0x00007f851442651d syscall (libc.so.6)
    #1  0x00007f85159842d4 virThreadSelfID (libvirt.so.0)
    #2  0x00007f851594e240 virLogFormatString (libvirt.so.0)
    #3  0x00007f851596635d vir_object_finalize (libvirt.so.0)
    #4  0x00007f8514efe8e9 g_object_unref (libgobject-2.0.so.0)
    #5  0x00007f85159667f8 virObjectUnref (libvirt.so.0)
    #6  0x00007f851517755f g_hash_table_remove_all_nodes.part.0 (libglib-2.0.so.0)
    #7  0x00007f8515177e62 g_hash_table_unref (libglib-2.0.so.0)
    #8  0x00007f851596637e vir_object_finalize (libvirt.so.0)
    #9  0x00007f8514efe8e9 g_object_unref (libgobject-2.0.so.0)
    #10 0x00007f85159667f8 virObjectUnref (libvirt.so.0)
    #11 0x00007f84cceb2b42 nodeStateCleanup (libvirt_driver_nodedev.so)
    #12 0x00007f8515b37950 virStateCleanup (libvirt.so.0)
    #13 0x00005648085348e8 main (libvirtd)
    #14 0x00007f8514352493 __libc_start_main (libc.so.6)
    #15 0x00005648085350fe _start (libvirtd)

This is because the initial population of the device list is done in a
separate initialization thread. If we attempt to exit libvirtd before
this init thread has completed, we'll try to free the device list while
accessing it from the other thread. In order to guarantee that this
init thread is not accessing the device list when we're cleaning up the
nodedev driver, make it joinable and wait for it to finish before
proceding with the cleanup. This is similar to how we handle the udev
event handler thread.

The separate initialization thread was added in commit
9f0ae0b.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1836865

Signed-off-by: Jonathon Jongsma <[email protected]>
Reviewed-by: Michal Privoznik <[email protected]>
libvirtmirror pushed a commit that referenced this pull request Dec 2, 2021
libxl can deliver events and invoke callbacks on any application thread
calling into libxl. This can cause deadlock in the libvirt libxl driver

Thread 19 (Thread 0x7f31411ec700 (LWP 14068) "libvirtd"):
#0  0x00007f318520cc7d in __lll_lock_wait () from /lib64/libpthread.so.0
#1  0x00007f3185205ed5 in pthread_mutex_lock () from /lib64/libpthread.so.0
#2  0x00007f3189488015 in virMutexLock (m=<optimized out>) at ../../src/util/virthread.c:79
#3  0x00007f3189463f3b in virObjectLock (anyobj=<optimized out>) at ../../src/util/virobject.c:433
#4  0x00007f31894f2f41 in virDomainObjListSearchID (payload=0x7f317400a6d0, name=<optimized out>, data=0x7f31411eaeac) at ../../src/conf/virdomainobjlist.c:105
#5  0x00007f3189437ac5 in virHashSearch (ctable=0x7f3124025a30, iter=iter@entry=0x7f31894f2f30 <virDomainObjListSearchID>, data=data@entry=0x7f31411eaeac, name=name@entry=0x0) at ../../src/util/virhash.c:745
#6  0x00007f31894f3919 in virDomainObjListFindByID (doms=0x7f3124025430, id=<optimized out>) at ../../src/conf/virdomainobjlist.c:121
#7  0x00007f3152f292e5 in libxlDomainEventHandler (data=0x7f3124023d80, event=0x7f310c010ae0) at ../../src/libxl/libxl_domain.c:660
#8  0x00007f3152c6ff5d in egc_run_callbacks (egc=egc@entry=0x7f31411eaf50) at libxl_event.c:1427
#9  0x00007f3152c718bd in libxl__egc_cleanup (egc=0x7f31411eaf50) at libxl_event.c:1458
#10 libxl__ao_inprogress (ao=ao@entry=0x7f310c00b8a0, file=file@entry=0x7f3152cce987 "libxl_domain.c", line=line@entry=730, func=func@entry=0x7f3152ccf750 <__func__.22238> "libxl_domain_unpause") at libxl_event.c:2047
#11 0x00007f3152c8c5b8 in libxl_domain_unpause (ctx=0x7f3124015a40, domid=<optimized out>, ao_how=ao_how@entry=0x0) at libxl_domain.c:730
#12 0x00007f3152f2a584 in libxl_domain_unpause_0x041200 (domid=<optimized out>, ctx=<optimized out>) at /usr/include/libxl.h:1756
#13 libxlDomainStart (driver=driver@entry=0x7f3124023d80, vm=vm@entry=0x7f317400a6d0, start_paused=start_paused@entry=false, restore_fd=restore_fd@entry=-1, restore_ver=<optimized out>, restore_ver@entry=2) at ../../src/libxl/libxl_domain.c:1482
#14 0x00007f3152f2a6e3 in libxlDomainStartNew (driver=driver@entry=0x7f3124023d80, vm=vm@entry=0x7f317400a6d0, start_paused=start_paused@entry=false) at ../../src/libxl/libxl_domain.c:1545
#15 0x00007f3152f2a789 in libxlDomainShutdownHandleRestart (driver=0x7f3124023d80, vm=0x7f317400a6d0) at ../../src/libxl/libxl_domain.c:464
#16 0x00007f3152f2a9e4 in libxlDomainShutdownThread (opaque=<optimized out>) at ../../src/libxl/libxl_domain.c:559
#17 0x00007f3189487ee2 in virThreadHelper (data=<optimized out>) at ../../src/util/virthread.c:196
#18 0x00007f3185203539 in start_thread () from /lib64/libpthread.so.0
#19 0x00007f3184f3becf in clone () from /lib64/libc.so.6

Frame 16 runs a thread created to handle domain shutdown processing for
domid 28712. In this case the event contained the reboot reason, so the
old domain is destroyed and a new one is created by libxlDomainStart new.
After starting the domain, it is unpaused by calling libxl_domain_unpause
in frame 12. While the thread is running within libxl, libxl takes the
opportunity to deliver a pending domain shutdown event for unrelated domid
28710. While searching for the associated virDomainObj by ID, a deadlock is
encountered when attempting to lock the virDomainObj for domid 28712, which
is already locked since this thread is processing its shutdown event.

The deadlock can be avoided by moving the search for a virDomainObj
associated with the event domid to the shutdown thread. The same is done
for the death thread.

Signed-off-by: Jim Fehlig <[email protected]>
Reviewed-by: Daniel P. Berrangé <[email protected]>
Reviewed-by: Ján Tomko <[email protected]>
libvirtmirror pushed a commit that referenced this pull request Mar 2, 2022
Commit 5adfb34 causes a segmentation fault.

Stack trace of thread 664419:
 #0  0x000003ff62ec553c in qemuDomainUndefineFlags (dom=0x3ff6c002810, flags=<optimized out>) at ../src/qemu/qemu_driver.c:6618
 #1  0x000003ff876a7e5c in virDomainUndefineFlags (domain=domain@entry=0x3ff6c002810, flags=<optimized out>) at ../src/libvirt-domain.c:6519
 #2  0x000002aa2b64a808 in remoteDispatchDomainUndefineFlags (server=0x2aa2c3d7880, msg=0x2aa2c3d2770, args=<optimized out>, rerr=0x3ff8287b950, client=<optimized out>)
        at src/remote/remote_daemon_dispatch_stubs.h:13080
 #3  remoteDispatchDomainUndefineFlagsHelper (server=0x2aa2c3d7880, client=<optimized out>, msg=0x2aa2c3d2770, rerr=0x3ff8287b950, args=<optimized out>, ret=0x0)
        at src/remote/remote_daemon_dispatch_stubs.h:13059
 #4  0x000003ff8758bbf4 in virNetServerProgramDispatchCall (msg=0x2aa2c3d2770, client=0x2aa2c3e3050, server=0x2aa2c3d7880, prog=0x2aa2c3d8010)
        at ../src/rpc/virnetserverprogram.c:428
 #5  virNetServerProgramDispatch (prog=0x2aa2c3d8010, server=server@entry=0x2aa2c3d7880, client=0x2aa2c3e3050, msg=0x2aa2c3d2770) at ../src/rpc/virnetserverprogram.c:302
 #6  0x000003ff8758c260 in virNetServerProcessMsg (msg=<optimized out>, prog=<optimized out>, client=<optimized out>, srv=0x2aa2c3d7880) at ../src/rpc/virnetserver.c:140
 #7  virNetServerHandleJob (jobOpaque=0x2aa2c3e2d30, opaque=0x2aa2c3d7880) at ../src/rpc/virnetserver.c:160
 #8  0x000003ff874c49aa in virThreadPoolWorker (opaque=<optimized out>) at ../src/util/virthreadpool.c:164
 #9  0x000003ff874c3f62 in virThreadHelper (data=<optimized out>) at ../src/util/virthread.c:256
 #10 0x000003ff86c1cf8c in start_thread () from /lib64/libc.so.6
 #11 0x000003ff86c9650e in thread_start () from /lib64/libc.so.6

Signed-off-by: Boris Fiuczynski <[email protected]>
Reviewed-by: Jim Fehlig <[email protected]>
Reviewed-by: Michal Privoznik <[email protected]>
libvirtmirror pushed a commit that referenced this pull request Mar 15, 2023
So far, the memory-hotplug-dimm-addr.xml test case pins its vCPUs
onto CPUs 0-1 which correspond to NUMA node #0 (per
tests/vircaps2xmldata/linux-basic/system/node/node0). Place vCPUs
onto nodes #1 and #2 too so that DIMM <memory/> device can
continue using thread-context after future patches. This
configuration, as-is currently, would make QEMU error out anyway.

Signed-off-by: Michal Privoznik <[email protected]>
Reviewed-by: Kristina Hanicova <[email protected]>
Reviewed-by: Andrea Bolognani <[email protected]>
libvirtmirror pushed a commit that referenced this pull request Apr 12, 2023
During qemu driver shutdown, objects are freed in qemuStateCleanup that
could still be used by active worker threads, resulting in crashes. E.g.
a worker thread could be processing a monitor EOF event after the
security manager is already disposed

Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007fd9a9a1e1fe in virSecurityManagerMoveImageMetadata (mgr=0x7fd948012160, pid=-1, src=src@entry=0x7fd98c072c90, dst=dst@entry=0x0)
    at ../../src/security/security_manager.c:468
#1  0x00007fd9646ff0f0 in qemuSecurityMoveImageMetadata (driver=driver@entry=0x7fd948043830, vm=vm@entry=0x7fd98c066db0, src=src@entry=0x7fd98c072c90,
    dst=dst@entry=0x0) at ../../src/qemu/qemu_security.c:182
#2  0x00007fd96462c7b0 in qemuBlockRemoveImageMetadata (driver=driver@entry=0x7fd948043830, vm=vm@entry=0x7fd98c066db0, diskTarget=0x7fd98c072530 "vda",
    src=<optimized out>) at ../../src/qemu/qemu_block.c:2628
#3  0x00007fd9646929d6 in qemuProcessStop (driver=driver@entry=0x7fd948043830, vm=vm@entry=0x7fd98c066db0, reason=reason@entry=VIR_DOMAIN_SHUTOFF_SHUTDOWN,
    asyncJob=asyncJob@entry=QEMU_ASYNC_JOB_NONE, flags=<optimized out>) at ../../src/qemu/qemu_process.c:7585
#4  0x00007fd9646fc842 in processMonitorEOFEvent (vm=0x7fd98c066db0, driver=0x7fd948043830) at ../../src/qemu/qemu_driver.c:4794
#5  qemuProcessEventHandler (data=0x561a93febb60, opaque=0x7fd948043830) at ../../src/qemu/qemu_driver.c:4900
#6  0x00007fd9a9971a31 in virThreadPoolWorker (opaque=opaque@entry=0x561a93fb58e0) at ../../src/util/virthreadpool.c:163
(gdb) p mgr->drv
$2 = (virSecurityDriverPtr) 0x0

Prior to commit 7cf76d4, the worker thread pool was freed before
disposing any driver objects. Let's return to that pattern, but leave
the other changes made by 7cf76d4.

Signed-off-by: Tamara Schmitz <[email protected]>
Signed-off-by: Jim Fehlig <[email protected]>
Reviewed-by: Martin Kletzander <[email protected]>
libvirtmirror pushed a commit that referenced this pull request Jun 8, 2023
In ideal world, my plan was perfect. We allow union of all host
nodes in cpuset.mems and once QEMU has allocated its memory, we
'fix up' restriction of its emulator thread by writing the
original value we wanted to set all along. But in fact, we can't
do it because that triggers memory movement. For instance,
consider the following <numatune/>:

  <numatune>
    <memory mode="strict" nodeset="0"/>
    <memnode cellid="1" mode="strict" nodeset="1"/>
  </numatune>

  <numa>
    <cell id="0" cpus="0-1" memory="1024000" unit="KiB" />
    <cell id="1" cpus="2-3" memory="1048576" unit="KiB"/>
  </numa>

This is meant to create 1:1 mapping between guest and host NUMA
nodes. So we start QEMU with cpuset.mems set to "0-1" (so that it
can allocate memory even for guest node #1 and have the memory
come fro host node #1) and then, set cpuset.mems to "0" (because
that's where we wanted emulator thread to live).

But this in turn triggers movement of all memory (even the
allocated one) to host NUMA node #0. Therefore, we have to just
keep cpuset.mems untouched and rely on .host-nodes passed on the
QEMU cmd line.

The placement still suffers because of cpuset.mems set for vcpus
or iothreads, but that's fixed in next commit.

Fixes: 3ec6d58
Signed-off-by: Michal Privoznik <[email protected]>
Reviewed-by: Martin Kletzander <[email protected]>
patchew-importer pushed a commit to patchew-project/libvirt that referenced this pull request May 2, 2024
Users are seeing periodic segfaults from libvirt client apps,
especially thread heavy ones like virt-manager. A typical
stack trace would end up in the virNetClientIOEventFD method,
with illegal access to stale stack data. eg

==238721==ERROR: AddressSanitizer: stack-use-after-return on address 0x75cd18709788 at pc 0x75cd3111f907 bp 0x75cd181ff550 sp 0x75cd181ff548
WRITE of size 4 at 0x75cd18709788 thread T11
    #0 0x75cd3111f906 in virNetClientIOEventFD /usr/src/debug/libvirt/libvirt-10.2.0/build/../src/rpc/virnetclient.c:1634:15
    libvirt#1 0x75cd3210d198  (/usr/lib/libglib-2.0.so.0+0x5a198) (BuildId: 0a2311dfbbc6c215dc36f4b6bdd2b4b6fbae55a2)
    libvirt#2 0x75cd3216c3be  (/usr/lib/libglib-2.0.so.0+0xb93be) (BuildId: 0a2311dfbbc6c215dc36f4b6bdd2b4b6fbae55a2)
    libvirt#3 0x75cd3210ddc6 in g_main_loop_run (/usr/lib/libglib-2.0.so.0+0x5adc6) (BuildId: 0a2311dfbbc6c215dc36f4b6bdd2b4b6fbae55a2)
    libvirt#4 0x75cd3111a47c in virNetClientIOEventLoop /usr/src/debug/libvirt/libvirt-10.2.0/build/../src/rpc/virnetclient.c:1722:9
    libvirt#5 0x75cd3111a47c in virNetClientIO /usr/src/debug/libvirt/libvirt-10.2.0/build/../src/rpc/virnetclient.c:2002:10
    libvirt#6 0x75cd3111a47c in virNetClientSendInternal /usr/src/debug/libvirt/libvirt-10.2.0/build/../src/rpc/virnetclient.c:2170:11
    libvirt#7 0x75cd311198a8 in virNetClientSendWithReply /usr/src/debug/libvirt/libvirt-10.2.0/build/../src/rpc/virnetclient.c:2198:11
    libvirt#8 0x75cd31111653 in virNetClientProgramCall /usr/src/debug/libvirt/libvirt-10.2.0/build/../src/rpc/virnetclientprogram.c:318:9
    libvirt#9 0x75cd31241c8f in callFull /usr/src/debug/libvirt/libvirt-10.2.0/build/../src/remote/remote_driver.c:6054:10
    libvirt#10 0x75cd31241c8f in call /usr/src/debug/libvirt/libvirt-10.2.0/build/../src/remote/remote_driver.c:6076:12
    libvirt#11 0x75cd31241c8f in remoteNetworkGetXMLDesc /usr/src/debug/libvirt/libvirt-10.2.0/build/src/remote/remote_client_bodies.h:5959:9
    libvirt#12 0x75cd31410ff7 in virNetworkGetXMLDesc /usr/src/debug/libvirt/libvirt-10.2.0/build/../src/libvirt-network.c:952:15

The root cause is a bad assumption in the virNetClientIOEventLoop
method. This method is run by whichever thread currently owns the
buck, and is responsible for handling I/O. Inside a for(;;) loop,
this method creates a temporary GSource, adds it to the event loop
and runs g_main_loop_run(). When I/O is ready, the GSource callback
(virNetClientIOEventFD) will fire and call g_main_loop_quit(), and
return G_SOURCE_REMOVE which results in the temporary GSource being
destroyed. A g_autoptr() will then remove the last reference.

What was overlooked, is that a second thread can come along and
while it can't enter virNetClientIOEventLoop, it will register an
idle source that uses virNetClientIOWakeup to interrupt the
original thread's 'g_main_loop_run' call. When this happens the
virNetClientIOEventFD callback never runs, and so the temporary
GSource is not destroyed. The g_autoptr() will remove a reference,
but by virtue of still being attached to the event context, there
is an extra reference held causing GSource to be leaked. The
next time 'g_main_loop_run' is called, the original GSource will
trigger its callback, and access data that was allocated on the
stack by the previous thread, and likely SEGV.

To solve this, the thread calling 'g_main_loop_run' must call
g_source_destroy, immediately upon return, to guarantee that
the temporary GSource is removed.

CVE-2024-4418
Reported-by: Martin Shirokov <[email protected]>
Signed-off-by: Daniel P. Berrangé <[email protected]>
Reviewed-by: Ján Tomko <[email protected]>
Message-Id: <[email protected]>
libvirtmirror pushed a commit that referenced this pull request May 2, 2024
Users are seeing periodic segfaults from libvirt client apps,
especially thread heavy ones like virt-manager. A typical
stack trace would end up in the virNetClientIOEventFD method,
with illegal access to stale stack data. eg

==238721==ERROR: AddressSanitizer: stack-use-after-return on address 0x75cd18709788 at pc 0x75cd3111f907 bp 0x75cd181ff550 sp 0x75cd181ff548
WRITE of size 4 at 0x75cd18709788 thread T11
    #0 0x75cd3111f906 in virNetClientIOEventFD /usr/src/debug/libvirt/libvirt-10.2.0/build/../src/rpc/virnetclient.c:1634:15
    #1 0x75cd3210d198  (/usr/lib/libglib-2.0.so.0+0x5a198) (BuildId: 0a2311dfbbc6c215dc36f4b6bdd2b4b6fbae55a2)
    #2 0x75cd3216c3be  (/usr/lib/libglib-2.0.so.0+0xb93be) (BuildId: 0a2311dfbbc6c215dc36f4b6bdd2b4b6fbae55a2)
    #3 0x75cd3210ddc6 in g_main_loop_run (/usr/lib/libglib-2.0.so.0+0x5adc6) (BuildId: 0a2311dfbbc6c215dc36f4b6bdd2b4b6fbae55a2)
    #4 0x75cd3111a47c in virNetClientIOEventLoop /usr/src/debug/libvirt/libvirt-10.2.0/build/../src/rpc/virnetclient.c:1722:9
    #5 0x75cd3111a47c in virNetClientIO /usr/src/debug/libvirt/libvirt-10.2.0/build/../src/rpc/virnetclient.c:2002:10
    #6 0x75cd3111a47c in virNetClientSendInternal /usr/src/debug/libvirt/libvirt-10.2.0/build/../src/rpc/virnetclient.c:2170:11
    #7 0x75cd311198a8 in virNetClientSendWithReply /usr/src/debug/libvirt/libvirt-10.2.0/build/../src/rpc/virnetclient.c:2198:11
    #8 0x75cd31111653 in virNetClientProgramCall /usr/src/debug/libvirt/libvirt-10.2.0/build/../src/rpc/virnetclientprogram.c:318:9
    #9 0x75cd31241c8f in callFull /usr/src/debug/libvirt/libvirt-10.2.0/build/../src/remote/remote_driver.c:6054:10
    #10 0x75cd31241c8f in call /usr/src/debug/libvirt/libvirt-10.2.0/build/../src/remote/remote_driver.c:6076:12
    #11 0x75cd31241c8f in remoteNetworkGetXMLDesc /usr/src/debug/libvirt/libvirt-10.2.0/build/src/remote/remote_client_bodies.h:5959:9
    #12 0x75cd31410ff7 in virNetworkGetXMLDesc /usr/src/debug/libvirt/libvirt-10.2.0/build/../src/libvirt-network.c:952:15

The root cause is a bad assumption in the virNetClientIOEventLoop
method. This method is run by whichever thread currently owns the
buck, and is responsible for handling I/O. Inside a for(;;) loop,
this method creates a temporary GSource, adds it to the event loop
and runs g_main_loop_run(). When I/O is ready, the GSource callback
(virNetClientIOEventFD) will fire and call g_main_loop_quit(), and
return G_SOURCE_REMOVE which results in the temporary GSource being
destroyed. A g_autoptr() will then remove the last reference.

What was overlooked, is that a second thread can come along and
while it can't enter virNetClientIOEventLoop, it will register an
idle source that uses virNetClientIOWakeup to interrupt the
original thread's 'g_main_loop_run' call. When this happens the
virNetClientIOEventFD callback never runs, and so the temporary
GSource is not destroyed. The g_autoptr() will remove a reference,
but by virtue of still being attached to the event context, there
is an extra reference held causing GSource to be leaked. The
next time 'g_main_loop_run' is called, the original GSource will
trigger its callback, and access data that was allocated on the
stack by the previous thread, and likely SEGV.

To solve this, the thread calling 'g_main_loop_run' must call
g_source_destroy, immediately upon return, to guarantee that
the temporary GSource is removed.

CVE-2024-4418
Reviewed-by: Ján Tomko <[email protected]>
Reported-by: Martin Shirokov <[email protected]>
Tested-by: Martin Shirokov <[email protected]>
Signed-off-by: Daniel P. Berrangé <[email protected]>
patchew-importer pushed a commit to patchew-project/libvirt that referenced this pull request Jun 14, 2024
…kObjSetFwRemoval()

The virNetworkObjSetFwRemoval() function is called at least two
times when there's a network running and network driver
initializes:

1) when loading state XMLs:
  #0  virNetworkObjSetFwRemoval (obj=0x7fffd4028250, fwRemoval=0x7fffd4020ad0) at ../src/conf/virnetworkobj.c:258
  libvirt#1  0x00007ffff7a69c68 in virNetworkLoadState (...) at ../src/conf/virnetworkobj.c:952
  libvirt#2  0x00007ffff7a6a35d in virNetworkObjLoadAllState (...) at ../src/conf/virnetworkobj.c:1072
  libvirt#3  0x00007ffff7f9625f in networkStateInitialize (...) at ../src/network/bridge_driver.c:624

2) when firewall rules are being reloaded:
  #0  virNetworkObjSetFwRemoval (obj=0x7fffd4028250, fwRemoval=0x7fffd402e5b0) at ../src/conf/virnetworkobj.c:258
  libvirt#1  0x00007ffff7f997b4 in networkReloadFirewallRulesHelper (obj=0x7fffd4028250, opaque=0x0) at ../src/network/bridge_driver.c:1703
  libvirt#2  0x00007ffff7a6b09b in virNetworkObjListForEachHelper (payload=0x7fffd4028250, ...) at ../src/conf/virnetworkobj.c:1414
  libvirt#3  0x00007ffff79287b6 in virHashForEachSafe (...) at ../src/util/virhash.c:387
  libvirt#4  0x00007ffff7a6b119 in virNetworkObjListForEach (...) at ../src/conf/virnetworkobj.c:1441
  libvirt#5  0x00007ffff7f99978 in networkReloadFirewallRules (...) at ../src/network/bridge_driver.c:1742
  libvirt#6  0x00007ffff7f962f2 in networkStateInitialize (...) at ../src/network/bridge_driver.c:645

Since virNetworkObjSetFwRemoval() does not free the object stored
in the first call, the second call just overwrites the stored
pointer leading to a memory leak:

  5,530 (48 direct, 5,482 indirect) bytes in 1 blocks are definitely lost in loss record 1,863 of 1,880
     at 0x4848C43: calloc (vg_replace_malloc.c:1595)
     by 0x4F1E979: g_malloc0 (in /usr/lib64/libglib-2.0.so.0.7800.6)
     by 0x4976E32: virFirewallNew (virfirewall.c:118)
     by 0x4979BA9: virFirewallParseXML (virfirewall.c:1071)
     by 0x4ABEB1E: virNetworkLoadState (virnetworkobj.c:938)
     by 0x4ABF35C: virNetworkObjLoadAllState (virnetworkobj.c:1072)
     by 0x4E9A25E: networkStateInitialize (bridge_driver.c:624)
     by 0x4CB1FA6: virStateInitialize (libvirt.c:665)
     by 0x15A6C6: daemonRunStateInit (remote_daemon.c:611)
     by 0x49E69F0: virThreadHelper (virthread.c:256)
     by 0x532B428: start_thread (in /lib64/libc.so.6)
     by 0x5397373: clone (in /lib64/libc.so.6)

Signed-off-by: Michal Privoznik <[email protected]>
Reviewed-by: Daniel P. Berrangé <[email protected]>
Message-Id: <1ff5099b2c15d328a178c4c7dec996c33f6e7a53.1718370189.git.mprivozn@redhat.com>
libvirtmirror pushed a commit that referenced this pull request Jun 19, 2024
…kObjSetFwRemoval()

The virNetworkObjSetFwRemoval() function is called at least two
times when there's a network running and network driver
initializes:

1) when loading state XMLs:
  #0  virNetworkObjSetFwRemoval (obj=0x7fffd4028250, fwRemoval=0x7fffd4020ad0) at ../src/conf/virnetworkobj.c:258
  #1  0x00007ffff7a69c68 in virNetworkLoadState (...) at ../src/conf/virnetworkobj.c:952
  #2  0x00007ffff7a6a35d in virNetworkObjLoadAllState (...) at ../src/conf/virnetworkobj.c:1072
  #3  0x00007ffff7f9625f in networkStateInitialize (...) at ../src/network/bridge_driver.c:624

2) when firewall rules are being reloaded:
  #0  virNetworkObjSetFwRemoval (obj=0x7fffd4028250, fwRemoval=0x7fffd402e5b0) at ../src/conf/virnetworkobj.c:258
  #1  0x00007ffff7f997b4 in networkReloadFirewallRulesHelper (obj=0x7fffd4028250, opaque=0x0) at ../src/network/bridge_driver.c:1703
  #2  0x00007ffff7a6b09b in virNetworkObjListForEachHelper (payload=0x7fffd4028250, ...) at ../src/conf/virnetworkobj.c:1414
  #3  0x00007ffff79287b6 in virHashForEachSafe (...) at ../src/util/virhash.c:387
  #4  0x00007ffff7a6b119 in virNetworkObjListForEach (...) at ../src/conf/virnetworkobj.c:1441
  #5  0x00007ffff7f99978 in networkReloadFirewallRules (...) at ../src/network/bridge_driver.c:1742
  #6  0x00007ffff7f962f2 in networkStateInitialize (...) at ../src/network/bridge_driver.c:645

Since virNetworkObjSetFwRemoval() does not free the object stored
in the first call, the second call just overwrites the stored
pointer leading to a memory leak:

  5,530 (48 direct, 5,482 indirect) bytes in 1 blocks are definitely lost in loss record 1,863 of 1,880
     at 0x4848C43: calloc (vg_replace_malloc.c:1595)
     by 0x4F1E979: g_malloc0 (in /usr/lib64/libglib-2.0.so.0.7800.6)
     by 0x4976E32: virFirewallNew (virfirewall.c:118)
     by 0x4979BA9: virFirewallParseXML (virfirewall.c:1071)
     by 0x4ABEB1E: virNetworkLoadState (virnetworkobj.c:938)
     by 0x4ABF35C: virNetworkObjLoadAllState (virnetworkobj.c:1072)
     by 0x4E9A25E: networkStateInitialize (bridge_driver.c:624)
     by 0x4CB1FA6: virStateInitialize (libvirt.c:665)
     by 0x15A6C6: daemonRunStateInit (remote_daemon.c:611)
     by 0x49E69F0: virThreadHelper (virthread.c:256)
     by 0x532B428: start_thread (in /lib64/libc.so.6)
     by 0x5397373: clone (in /lib64/libc.so.6)

Signed-off-by: Michal Privoznik <[email protected]>
Reviewed-by: Daniel P. Berrangé <[email protected]>
libvirtmirror pushed a commit that referenced this pull request May 14, 2025
Variable 'master' needs to be free because it will be reassigned in
virNetDevOpenvswitchInterfaceGetMaster().

The leaked stack:
Direct leak of 11 byte(s) in 1 object(s) allocated from:
    #0 0x7f7dad8ba6df in __interceptor_malloc (/lib64/libasan.so.8+0xba6df)
    #1 0x7f7dad715728 in g_malloc (/lib64/libglib-2.0.so.0+0x60728)
    #2 0x7f7dad72d8b2 in g_strdup (/lib64/libglib-2.0.so.0+0x788b2)
    #3 0x7f7dacb63088 in g_strdup_inline /usr/include/glib-2.0/glib/gstrfuncs.h:321
    #4 0x7f7dacb63088 in virNetDevGetName ../src/util/virnetdev.c:823
    #5 0x7f7dacb63886 in virNetDevGetMaster ../src/util/virnetdev.c:909
    #6 0x7f7dacb90288 in virNetDevTapReattachBridge ../src/util/virnetdevtap.c:527
    #7 0x7f7dacd5cd67 in virDomainNetNotifyActualDevice ../src/conf/domain_conf.c:30505
    #8 0x7f7da3a10bc3 in qemuProcessNotifyNets ../src/qemu/qemu_process.c:3290
    #9 0x7f7da3a375c6 in qemuProcessReconnect ../src/qemu/qemu_process.c:9211
    #10 0x7f7dacc0cc53 in virThreadHelper ../src/util/virthread.c:256
    #11 0x7f7dac2875d4 in start_thread (/lib64/libc.so.6+0x875d4)
    #12 0x7f7dac3091bb in __GI___clone3 (/lib64/libc.so.6+0x1091bb)

Fixes: de938b9
Signed-off-by: QiangWei Zhang <[email protected]>
Reviewed-by: Peter Krempa <[email protected]>
patchew-importer pushed a commit to patchew-project/libvirt that referenced this pull request Jun 5, 2025
…returning

Successful return from 'virConnectDomainEventDeregisterAny' does not
guarantee that there aren't still in-progress events being handled by
the callbacks. Since 'cmdEvent' passes in a slice from an array as the
private data of the callbacks, we must ensure that the array stays in
scope (it's auto-freed) for the whole time there are possible callbacks
being executed.

While in practice this doesn't happen as the callbacks are usually quick
enough to finish while unregistering stuff, placing a 'sleep(1)' into
e.g. 'virshEventLifecyclePrint' and starting a domain results in crash
of virsh with the following backtrace:

 Program terminated with signal SIGSEGV, Segmentation fault.
 #0  0x00005557b5cfd343 in virshEventPrintf (data=data@entry=0x5557db9619b0, fmt=fmt@entry=0x5557b5d5e527 "%s") at ../../../libvirt/tools/virsh-domain-event.c:252

 Thread 2 (Thread 0x7f59a54b7d00 (LWP 2097121)):
 #0  0x00007f59a6cadbf9 in __futex_abstimed_wait_common () at /lib64/libc.so.6
 libvirt#1  0x00007f59a6cb2cf3 in __pthread_clockjoin_ex () at /lib64/libc.so.6
 libvirt#2  0x00005557b5cd57f6 in virshDeinit (ctl=0x7ffc7b615140) at ../../../libvirt/tools/virsh.c:408
 libvirt#3  0x00005557b5cd5391 in main (argc=<optimized out>, argv=<optimized out>) at ../../../libvirt/tools/virsh.c:932

 Thread 1 (Thread 0x7f59a51a66c0 (LWP 2097122)):
 #0  0x00005557b5cfd343 in virshEventPrintf (data=data@entry=0x5557db9619b0, fmt=fmt@entry=0x5557b5d5e527 "%s") at ../../../libvirt/tools/virsh-domain-event.c:252
 libvirt#1  0x00005557b5cffa10 in virshEventPrint (data=0x5557db9619b0, buf=0x7f59a51a55c0) at ../../../libvirt/tools/virsh-domain-event.c:290
 libvirt#2  virshEventLifecyclePrint (conn=<optimized out>, dom=<optimized out>, event=<optimized out>, detail=<optimized out>, opaque=0x5557db9619b0) at ../../../libvirt/
 [snipped]

From the backtrace you can see that the 'main()' thread is already
shutting down virsh, which means that 'cmdEvent' terminated and the
private data was freed. The event loop thread is still execing the
callback which accesses the data.

To fix this add a condition and wait on all of the callbacks to be
unregistered first (their private data freeing function will be called).

This bug was observed when I've copied the event code for a new virsh
command which had a bit more involved callbacks.

Fixes: 99fa96c
Signed-off-by: Peter Krempa <[email protected]>
Reviewed-by: Ján Tomko <[email protected]>
Message-Id: <9589d6d2a674173fcd53dec0aa0f6ab5decd55fc.1749110902.git.pkrempa@redhat.com>
libvirtmirror pushed a commit that referenced this pull request Jun 5, 2025
…ereference it

accel->cpuModels field might be NULL if QEMU does not return CPU models.
The following backtrace is observed in such cases:
0  virQEMUCapsProbeQMPCPUDefinitions (qemuCaps=qemuCaps@entry=0x7f1890003ae0, accel=accel@entry=0x7f1890003c10, mon=mon@entry=0x7f1890005270)
   at ../src/qemu/qemu_capabilities.c:3091
1  0x00007f18b42fa7b1 in virQEMUCapsInitQMPMonitor (qemuCaps=qemuCaps@entry=0x7f1890003ae0, mon=0x7f1890005270) at ../src/qemu/qemu_capabilities.c:5746
2  0x00007f18b42fafaf in virQEMUCapsInitQMPSingle (qemuCaps=qemuCaps@entry=0x7f1890003ae0, libDir=libDir@entry=0x7f186c1e70f0 "/var/lib/libvirt/qemu",
   runUid=runUid@entry=955, runGid=runGid@entry=955, onlyTCG=onlyTCG@entry=false) at ../src/qemu/qemu_capabilities.c:5832
3  0x00007f18b42fb1a5 in virQEMUCapsInitQMP (qemuCaps=0x7f1890003ae0, libDir=0x7f186c1e70f0 "/var/lib/libvirt/qemu", runUid=955, runGid=955)
   at ../src/qemu/qemu_capabilities.c:5848
4  virQEMUCapsNewForBinaryInternal (hostArch=VIR_ARCH_X86_64, binary=binary@entry=0x7f1868002fc0 "/usr/bin/qemu-system-alpha",
   libDir=0x7f186c1e70f0 "/var/lib/libvirt/qemu", runUid=955, runGid=955,
   hostCPUSignature=0x7f186c1e9f20 "AuthenticAMD, AMD Ryzen 9 7950X 16-Core Processor, family: 25, model: 97, stepping: 2", microcodeVersion=174068233,
   kernelVersion=0x7f186c194200 "6.14.9-arch1-1 #1 SMP PREEMPT_DYNAMIC Thu, 29 May 2025 21:42:15 +0000", cpuData=0x7f186c1ea490)
   at ../src/qemu/qemu_capabilities.c:5907
5  0x00007f18b42fb4c9 in virQEMUCapsNewData (binary=0x7f1868002fc0 "/usr/bin/qemu-system-alpha", privData=0x7f186c194280)
   at ../src/qemu/qemu_capabilities.c:5942
6  0x00007f18bd42d302 in virFileCacheNewData (cache=0x7f186c193730, name=0x7f1868002fc0 "/usr/bin/qemu-system-alpha") at ../src/util/virfilecache.c:206
7  virFileCacheValidate (cache=cache@entry=0x7f186c193730, name=name@entry=0x7f1868002fc0 "/usr/bin/qemu-system-alpha", data=data@entry=0x7f18b67c37c0)
   at ../src/util/virfilecache.c:269
8  0x00007f18bd42d5b8 in virFileCacheLookup (cache=cache@entry=0x7f186c193730, name=name@entry=0x7f1868002fc0 "/usr/bin/qemu-system-alpha")
   at ../src/util/virfilecache.c:301
9  0x00007f18b42fb679 in virQEMUCapsCacheLookup (cache=cache@entry=0x7f186c193730, binary=binary@entry=0x7f1868002fc0 "/usr/bin/qemu-system-alpha")
   at ../src/qemu/qemu_capabilities.c:6036
10 0x00007f18b42fb785 in virQEMUCapsInitGuest (caps=<optimized out>, cache=<optimized out>, hostarch=VIR_ARCH_X86_64, guestarch=VIR_ARCH_ALPHA)
   at ../src/qemu/qemu_capabilities.c:1037
11 virQEMUCapsInit (cache=0x7f186c193730) at ../src/qemu/qemu_capabilities.c:1229
12 0x00007f18b431d311 in virQEMUDriverCreateCapabilities (driver=driver@entry=0x7f186c01f410) at ../src/qemu/qemu_conf.c:1553
13 0x00007f18b431d663 in virQEMUDriverGetCapabilities (driver=0x7f186c01f410, refresh=<optimized out>) at ../src/qemu/qemu_conf.c:1623
14 0x00007f18b435e3e4 in qemuConnectGetVersion (conn=<optimized out>, version=0x7f18b67c39b0) at ../src/qemu/qemu_driver.c:1492
15 0x00007f18bd69c5e8 in virConnectGetVersion (conn=0x55bc5f4cda20, hvVer=hvVer@entry=0x7f18b67c39b0) at ../src/libvirt-host.c:201
16 0x000055bc34ef3627 in remoteDispatchConnectGetVersion (server=0x55bc5f4b93f0, msg=0x55bc5f4cdf60, client=0x55bc5f4c66d0, rerr=0x7f18b67c3a80,
   ret=0x55bc5f4b8670) at src/remote/remote_daemon_dispatch_stubs.h:1265
17 remoteDispatchConnectGetVersionHelper (server=0x55bc5f4b93f0, client=0x55bc5f4c66d0, msg=0x55bc5f4cdf60, rerr=0x7f18b67c3a80, args=0x0, ret=0x55bc5f4b8670)
   at src/remote/remote_daemon_dispatch_stubs.h:1247
18 0x00007f18bd5506da in virNetServerProgramDispatchCall (prog=0x55bc5f4cae90, server=0x55bc5f4b93f0, client=0x55bc5f4c66d0, msg=0x55bc5f4cdf60)
   at ../src/rpc/virnetserverprogram.c:423
19 virNetServerProgramDispatch (prog=0x55bc5f4cae90, server=server@entry=0x55bc5f4b93f0, client=0x55bc5f4c66d0, msg=0x55bc5f4cdf60)
   at ../src/rpc/virnetserverprogram.c:299
20 0x00007f18bd556c32 in virNetServerProcessMsg (srv=srv@entry=0x55bc5f4b93f0, client=<optimized out>, prog=<optimized out>, msg=<optimized out>)
   at ../src/rpc/virnetserver.c:135
21 0x00007f18bd556f77 in virNetServerHandleJob (jobOpaque=0x55bc5f4d2bb0, opaque=0x55bc5f4b93f0) at ../src/rpc/virnetserver.c:155
22 0x00007f18bd47dd19 in virThreadPoolWorker (opaque=<optimized out>) at ../src/util/virthreadpool.c:164
23 0x00007f18bd47d253 in virThreadHelper (data=0x55bc5f4b7810) at ../src/util/virthread.c:256
24 0x00007f18bce117eb in start_thread (arg=<optimized out>) at pthread_create.c:448
25 0x00007f18bce9518c in __GI___clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78

Signed-off-by: anonymix007 <[email protected]>
libvirtmirror pushed a commit that referenced this pull request Jun 12, 2025
…returning

Successful return from 'virConnectDomainEventDeregisterAny' does not
guarantee that there aren't still in-progress events being handled by
the callbacks. Since 'cmdEvent' passes in a slice from an array as the
private data of the callbacks, we must ensure that the array stays in
scope (it's auto-freed) for the whole time there are possible callbacks
being executed.

While in practice this doesn't happen as the callbacks are usually quick
enough to finish while unregistering stuff, placing a 'sleep(1)' into
e.g. 'virshEventLifecyclePrint' and starting a domain results in crash
of virsh with the following backtrace:

 Program terminated with signal SIGSEGV, Segmentation fault.
 #0  0x00005557b5cfd343 in virshEventPrintf (data=data@entry=0x5557db9619b0, fmt=fmt@entry=0x5557b5d5e527 "%s") at ../../../libvirt/tools/virsh-domain-event.c:252

 Thread 2 (Thread 0x7f59a54b7d00 (LWP 2097121)):
 #0  0x00007f59a6cadbf9 in __futex_abstimed_wait_common () at /lib64/libc.so.6
 #1  0x00007f59a6cb2cf3 in __pthread_clockjoin_ex () at /lib64/libc.so.6
 #2  0x00005557b5cd57f6 in virshDeinit (ctl=0x7ffc7b615140) at ../../../libvirt/tools/virsh.c:408
 #3  0x00005557b5cd5391 in main (argc=<optimized out>, argv=<optimized out>) at ../../../libvirt/tools/virsh.c:932

 Thread 1 (Thread 0x7f59a51a66c0 (LWP 2097122)):
 #0  0x00005557b5cfd343 in virshEventPrintf (data=data@entry=0x5557db9619b0, fmt=fmt@entry=0x5557b5d5e527 "%s") at ../../../libvirt/tools/virsh-domain-event.c:252
 #1  0x00005557b5cffa10 in virshEventPrint (data=0x5557db9619b0, buf=0x7f59a51a55c0) at ../../../libvirt/tools/virsh-domain-event.c:290
 #2  virshEventLifecyclePrint (conn=<optimized out>, dom=<optimized out>, event=<optimized out>, detail=<optimized out>, opaque=0x5557db9619b0) at ../../../libvirt/
 [snipped]

From the backtrace you can see that the 'main()' thread is already
shutting down virsh, which means that 'cmdEvent' terminated and the
private data was freed. The event loop thread is still execing the
callback which accesses the data.

To fix this add a condition and wait on all of the callbacks to be
unregistered first (their private data freeing function will be called).

This bug was observed when I've copied the event code for a new virsh
command which had a bit more involved callbacks.

Fixes: 99fa96c
Signed-off-by: Peter Krempa <[email protected]>
Reviewed-by: Ján Tomko <[email protected]>
libvirtmirror pushed a commit that referenced this pull request Aug 4, 2026
crash when the 'ctl' parameter to vshPrintStderr() is NULL. Below is an
example backtrace of the crash when attempting to detach a non-existent
disk with 'virsh detach-disk test vdz'

 #0  vshPrintStderr (ctl=0x0, level=4, format=<optimized out>, ap=<optimized out>) at ../tools/vsh.c:2148
 #1  0x00005555555e6b2c in vshError (ctl=ctl@entry=0x0, format=<optimized out>) at ../tools/vsh.c:2170
 #2  0x00005555555afec7 in virshFindDisk
    (doc=doc@entry=0x555555696ee0 "<domain type='kvm' id='1'>\n  <name>test</name>\n  <uuid>9b27a21e-dfa2-4c1e-9d11-2de275aefb03</uuid>\n  <metadata>\n    <libosinfo:libosinfo xmlns:libosinfo=\"http://libosinfo.org/xmlns/libvirt/domain/1."..., path=0x555555651240 "vdz", type=type@entry=0) at ../tools/virsh-domain.c:13055
 #3  0x00005555555b0151 in cmdDetachDisk (ctl=0x7fffffffdac0, cmd=0x5555556914c0) at ../tools/virsh-domain.c:13231
 #4  0x00005555555e6ddb in vshCommandRun (ctl=ctl@entry=0x7fffffffdac0, cmd=0x5555556914c0) at ../tools/vsh.c:1383
 #5  0x000055555559347a in main (argc=<optimized out>, argv=0x7fffffffdeb8) at ../tools/virsh.c:908

Ensure 'ctl' is valid before dereferencing it.

Fixes: 9899c91
Signed-off-by: Jim Fehlig <[email protected]>
Reviewed-by: Daniel P. Berrangé <[email protected]>
patchew-importer pushed a commit to patchew-project/libvirt that referenced this pull request Aug 18, 2026
When parsing disk source in ESX driver (esxParseVMXFileName())
the datastore is traversed through trying to find matching
prefix. But not every datastore has to be mounted. In that case,
esxVI_LookupDatastoreHostMount() returns success and the returned
struct has mountInfo->path set to NULL. This can be deducted from
the following backtrace (which shows that strlen() hidden in
STRSKIP() macro was given NULL pointer).

Thread 1 "virsh" received signal SIGSEGV, Segmentation fault.
__strlen_avx2 () at ../sysdeps/x86_64/multiarch/strlen-avx2.S:76
76		VPCMPEQ	(%rdi), %ymm0, %ymm1
(gdb) bt full
#0  __strlen_avx2 () at ../sysdeps/x86_64/multiarch/strlen-avx2.S:76
No locals.
libvirt#1  0x00007ffff7c292d7 in esxParseVMXFileName (fileName=0x5555557341d0 "/vmfs/volumes/5f64209f-c0af0aa8-70c4-e4434ba73190/msafra-RHEL9-shared-1/msafra-RHEL9-shared-1_1.vmdk", opaque=0x7fffffffcf80,
    out=0x7fffffffc738, allow_missing=false) at ../src/esx/esx_driver.c:172
        data = 0x7fffffffcf80
        propertyNameList = 0x555555738b50
        datastoreList = 0x55555573cf40
        datastore = <optimized out>
        hostMount = 0x555555733640
        datastoreName = 0x55555573e590 "mnecas-nfs-test"
        tmp = <optimized out>
        saveptr = 0x5555556a5b50 ""
        strippedFileName = 0x0
        copyOfFileName = 0x0
        directoryAndFileName = <optimized out>
        ret = -1
        __FUNCTION__ = "esxParseVMXFileName"
libvirt#2  0x00007ffff7bd47f4 in virVMXParseDisk (ctx=ctx@entry=0x7fffffffcfb0, xmlopt=xmlopt@entry=0x555555738d80, conf=conf@entry=0x5555556a5b50, device=device@entry=0, busType=<optimized out>, busType@entry=3,
    controllerOrBus=controllerOrBus@entry=1, unit=<optimized out>, def=0x7fffffffc960, vmdef=0x5555557375a0) at ../src/vmx/vmx.c:2553
        tmp = 0x0
        result = -1
        prefix = 0x5555557384d0 "scsi1:0"
        present_name = "scsi1:0.present", '\000' <repeats 16 times>
        present = true
        startConnected_name = "scsi1:0.startConnected\000\000\000\000\000\000\000\000\000"
        startConnected = true
        deviceType_name = "scsi1:0.deviceType", '\000' <repeats 13 times>
        deviceType = 0x555555737f60 "scsi-hardDisk"
        clientDevice_name = "scsi1:0.clientDevice", '\000' <repeats 11 times>
        clientDevice = false
        fileType_name = "scsi1:0.fileType", '\000' <repeats 15 times>
        fileType = 0x0
        fileName_name = "scsi1:0.fileName", '\000' <repeats 15 times>
        fileName = 0x5555557341d0 "/vmfs/volumes/5f64209f-c0af0aa8-70c4-e4434ba73190/msafra-RHEL9-shared-1/msafra-RHEL9-shared-1_1.vmdk"
        writeThrough_name = "scsi1:0.writeThrough", '\000' <repeats 11 times>
        writeThrough = false
        mode_name = "scsi1:0.mode", '\000' <repeats 19 times>
        mode = 0x0
        cleanup = <optimized out>
        __FUNCTION__ = "virVMXParseDisk"
libvirt#3  0x00007ffff7bd5f01 in virVMXParseConfig (ctx=0x7fffffffcfb0, xmlopt=0x555555738d80, caps=<optimized out>, vmx=<optimized out>) at ../src/vmx/vmx.c:1749
libvirt#4  0x00007ffff7c35319 in esxDomainGetXMLDesc (domain=<optimized out>, flags=0) at ../src/esx/esx_driver.c:2595
libvirt#5  0x00007ffff7cc4fd3 in virDomainGetXMLDesc (domain=domain@entry=0x5555557367f0, flags=flags@entry=0) at ../src/libvirt-domain.c:2898
libvirt#6  0x0000555555586cca in cmdDumpXML (ctl=0x7fffffffd1d0, cmd=0x5555556a5450) at ../tools/virsh-domain.c:10787
libvirt#7  0x00005555555bc7cb in vshCommandRun (ctl=0x7fffffffd1d0, cmd=0x5555556a5450) at ../tools/vsh.c:1383
libvirt#8  0x0000555555562fbc in main (argc=<optimized out>, argv=0x7fffffffd5c8) at ../tools/virsh.c:900

The backtrace was trimmed.

To fix this, just check whether mount path is not NULL before
passing it to STRSKIP().

Resolves: https://redhat.atlassian.net/browse/RHEL-213506
Signed-off-by: Michal Privoznik <[email protected]>
Reviewed-by: Martin Kletzander <[email protected]>
Message-Id: <60a0d6308aecd469aadfd174ea28984bd64f580a.1787042929.git.mprivozn@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants