]> git.ipfire.org Git - thirdparty/valgrind.git/commit
FreeBSD helgrind: temporary (?) fix for Bug 494337
authorPaul Floyd <pjfloyd@wanadoo.fr>
Sat, 12 Oct 2024 07:10:21 +0000 (09:10 +0200)
committerPaul Floyd <pjfloyd@wanadoo.fr>
Sat, 12 Oct 2024 07:10:21 +0000 (09:10 +0200)
commit1b670ae69185908bd3ed70c047545d1614dbaf06
treee2c16d00397993a711d250660a3f0ac35e68f930
parenta2ad7f2ecc840a8384bba67eae48b88ddb9e8428
FreeBSD helgrind: temporary (?) fix for Bug 494337

FreeBSD 15 has added a pthread lock to exit() to ensure that atexit handling
is thread safe. Unfortunately that lock gets leaked which messes up just about
all of the Helgrind tests.

Supression won't work as the callstack is the same for both genuine leaks
and this deliberate leak.

This change simply turns off the check for FreeBSD >= 15.

I see two possible proper fixes. One would be to allow one lock on exit.
The problem with that is that we will need to tell apart a clean exit
(1 lock allowed) and any kind of abort that doesn't call exit (no locks
allowed). That's going to be tricky as the Helgrind check is done before
we get back to core and know whether it is an abort or a clean exit.

The other thing would be to hack the lock counting. If we can detect that
it's a pthread_mutex_lock called from exit() then we could ignore that for
counting purposes. That would mean a possibly significant overhead for
each call to pthread_mutex_lock on FreeBSD.
helgrind/hg_main.c
helgrind/tests/Makefile.am