[CinCV TNG] lock problems with suse/leap, which can cause segvs in 5.1

Petter Reinholdtsen pere at hungry.com
Sun Nov 6 22:50:24 CET 2016


A discussion about this locking problem came up yesterday in Debian, see 
<URL: https://lists.debian.org/debian-devel/2016/11/msg00210.html >.

It is worth noting that the general concensus there is that code trying
to unlock a non-locked mutex is wrong and should be fixed.  On Linux
machines with CPUes without TSX would ignore such errors, while Linux
running on recent Intel CPUs for x86 and the s390(x) architecture would
crash.  The crash would also happen on Debian systems using the Hurd and
kFreeBSD kernels.

Personally I am conviced the proper and long term fix for this is to
make sure pthread mutexes are used without undefined behaviour.  Sooner
or later the incorrect use of mutexes will affect us all. :)

Perhaps the mutexes should be changed to recursive?  See
<URL: http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_mutex_unlock.html >
for the POSIX description of pthread_mutex_*() functions, to get an idea
about what the standard specifies.

Notice how 'valgrind --tool=helgrind' can be used to discover these
mutex errors also on machines without TSX support.

-- 
Happy hacking
Petter Reinholdtsen


More information about the Cinelerra mailing list