This is just to demonstrate that libvirt currently exhibits undefined
behavior due to pthread mutex misuse. With this patch applied, several
libvirt tests fail due to the triggered `abort()` calls:
* cputest
* qemuagenttest
* qemucapabilitiestest
* qemumigparamstest
* qemuhotplugtest
* qemumonitorjsontest
* qemusecuritytest
* qemuxmlconftest
Signed-off-by: Tim Wiederhake <twiederh(a)redhat.com>
---
src/util/virthread.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/util/virthread.c b/src/util/virthread.c
index 14116a2221..dc51144d48 100644
--- a/src/util/virthread.c
+++ b/src/util/virthread.c
@@ -88,6 +88,7 @@ void virMutexDestroy(virMutex *m)
{
if (pthread_mutex_destroy(&m->lock)) {
VIR_WARN("Failed to destroy mutex=%p", m);
+ abort();
}
}
@@ -95,6 +96,7 @@ void virMutexLock(virMutex *m)
{
if (pthread_mutex_lock(&m->lock)) {
VIR_WARN("Failed to lock mutex=%p", m);
+ abort();
}
}
@@ -102,6 +104,7 @@ void virMutexUnlock(virMutex *m)
{
if (pthread_mutex_unlock(&m->lock)) {
VIR_WARN("Failed to unlock mutex=%p", m);
+ abort();
}
}
--
2.43.0