[PATCH 2/2] DO NOT MERGE: virMutex: Fail loudly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux