Bug 444487 - hginfo test detects an extra lock inside data symbol "_rtld_local"
Summary: hginfo test detects an extra lock inside data symbol "_rtld_local"
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: helgrind (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-10-27 14:13 UTC by Mark Wielaard
Modified: 2023-04-20 10:48 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Wielaard 2021-10-27 14:13:36 UTC
This is with valgrind 3.18.1 and glibc 2.34:

gdbserver_tests/hginfo/stderrB.diff:

  Lock ga 0x........ {
   Address 0x........ is 2440 bytes inside data symbol "_rtld_local"
     kind   mbRec
  }
Comment 1 Mark Wielaard 2023-04-19 12:16:46 UTC
This comes from pthread_create:

(gdb) monitor accesshistory 0x4035a58
==30485== ---Thread-Announcement------------------------------------------
==30485== 
==30485== Thread #1 is the program's root thread
==30485== 
==30485== ---Thread-Announcement------------------------------------------
==30485== 
==30485== Thread #1 is the program's root thread
==30485== 
read of size 4 at 0x4035A58 by thread #1 tid 1
==30485== Locks held: none
==30485==    at 0x48FFC72: lll_mutex_unlock_optimized (pthread_mutex_unlock.c:43)
==30485==    by 0x48FFC72: __pthread_mutex_unlock_usercnt (pthread_mutex_unlock.c:68)
==30485==    by 0x484BD2C: mutex_unlock_WRK (hg_intercepts.c:1182)
==30485==    by 0x484FF3E: pthread_mutex_unlock (hg_intercepts.c:1200)
==30485==    by 0x4011CDD: _dl_allocate_tls_init (dl-tls.c:620)
==30485==    by 0x48FBCFE: allocate_stack (allocatestack.c:423)
==30485==    by 0x48FBCFE: pthread_create@@GLIBC_2.34 (pthread_create.c:650)
==30485==    by 0x484E5D4: pthread_create_WRK (hg_intercepts.c:445)
==30485==    by 0x484FAF5: pthread_create@* (hg_intercepts.c:478)
==30485==    by 0x40125D: main (hg01_all_ok.c:41)

So I propose to run the test with --ignore-thread-creation=yes

diff --git a/gdbserver_tests/hginfo.vgtest b/gdbserver_tests/hginfo.vgtest
index 5d00e1e21..0ea8ab4b3 100644
--- a/gdbserver_tests/hginfo.vgtest
+++ b/gdbserver_tests/hginfo.vgtest
@@ -1,7 +1,7 @@
 # test helgrind monitor command
 # test 'v.info location' monitor command
 prog: ../helgrind/tests/hg01_all_ok
-vgopts: --tool=helgrind --vgdb=yes --vgdb-error=0 --vgdb-prefix=./vgdb-prefix-hginfo -q 
+vgopts: --tool=helgrind  --ignore-thread-creation=yes --vgdb=yes --vgdb-error=0 --vgdb-prefix=./vgdb-prefix-hginfo -q 
 prereq: test -e gdb.eval
 stdout_filter: filter_make_empty
 stderr_filter: filter_stderr

$ perl tests/vg_regtest gdbserver_tests/hginfo.vgtest 
hginfo:          valgrind   --tool=helgrind  --ignore-thread-creation=yes --vgdb=yes --vgdb-error=0 --vgdb-prefix=./vgdb-prefix-hginfo -q  ./../helgrind/tests/hg01_all_ok  (progB: ./gdb --quiet -l 60 --nx ../helgrind/tests/hg01_all_ok)

== 1 test, 0 stderr failures, 0 stdout failures, 0 stderrB failures, 0 stdoutB failures, 0 post failures ==
Comment 2 Mark Wielaard 2023-04-20 10:48:25 UTC
commit 6effd73e9071efde14cf55c6b04c1217cc4c8515
Author: Mark Wielaard <mark@klomp.org>
Date:   Wed Apr 19 15:53:53 2023 +0200

    gdbserver_tests/hginfo.vgtest: Use --ignore-thread-creation=yes
    
    The testcase might notice an extra lock created by pthread_create.
    
    https://bugs.kde.org/show_bug.cgi?id=444487