paulfloyd / freebsd_valgrind

Git repo used to Upstream the FreeBSD Port of Valgrind
GNU General Public License v2.0
15 stars 4 forks source link

Under valgrind, pthread_mutex_lock() may return EINTR in violation of POSIX specification #191

Closed nbriggs closed 2 years ago

nbriggs commented 2 years ago

This shows up as a failure in drd/tests/pth_mutex_signal test (maybe only on a single-threaded system?) with:

flap% ./vg-in-place drd/tests/pth_mutex_signal
==99849== Memcheck, a memory error detector
==99849== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==99849== Using Valgrind-3.20.0.GIT and LibVEX; rerun with -h for copyright info
==99849== Command: drd/tests/pth_mutex_signal
==99849== 
mutex initialized
thread attributes initialized
thread created
sleeping
signalling
sleeping
nullHandler running
pid 99849 (memcheck-x86-freebs): sigreturn eflags = 0x200001
Assertion failed: (ret == 0), function contender_start, file pth_mutex_signal.c, line 23.

and checking the value of ret it is 4 (=EINTR). The POSIX standard (https://pubs.opengroup.org/onlinepubs/9699919799/) says of pthread_mutex_lock() "These functions shall not return an error code of [EINTR]."

paulfloyd commented 2 years ago

Tracking this on bugs.kde.org as it is not FreeBSD-specific.

https://bugs.kde.org/show_bug.cgi?id=445743

paulfloyd commented 2 years ago

See valgrind bugzilla for updates.