aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2022-06-03 08:24:40 +0200
committerSven Gothel <[email protected]>2022-06-03 08:24:40 +0200
commitba66f97ef690a1aa0c8aea3946443e3b6646a6cb (patch)
tree99a2ebe7e457b79293596bfc5211e236ba69c859 /scripts
parentb36ab76aa95b2cb22b82f8bbcee2c86f6763625f (diff)
Add valgrind supp files
Diffstat (limited to 'scripts')
-rw-r--r--scripts/valgrind-jvm.supp89
-rw-r--r--scripts/valgrind.supp181
-rwxr-xr-xscripts/valgrindmerge65
3 files changed, 335 insertions, 0 deletions
diff --git a/scripts/valgrind-jvm.supp b/scripts/valgrind-jvm.supp
new file mode 100644
index 0000000..2ce1015
--- /dev/null
+++ b/scripts/valgrind-jvm.supp
@@ -0,0 +1,89 @@
+#
+# JVM
+#
+
+
+{
+ jau_jvm_memcheck_01
+ Memcheck:Addr4
+ ...
+ obj:/usr/lib/jvm/java-17-openjdk-amd64/lib/server/libjvm.so
+ ...
+}
+{
+ jau_jvm_memcheck_02
+ Memcheck:Addr4
+ ...
+ obj:/usr/lib/jvm/java-17-openjdk-amd64/lib/server/libjvm.so
+}
+{
+ jau_jvm_memcheck_03
+ Memcheck:Addr4
+ ...
+ obj:/usr/lib/jvm/java-17-openjdk-amd64/lib/libjli.so
+}
+{
+ jau_jvm_memcheck_04
+ Memcheck:Addr4
+ ...
+ obj:*
+}
+{
+ jau_jvm_memcheck_10
+ Memcheck:Addr8
+ fun:strncmp
+ fun:is_dst
+ ...
+ fun:dl_open_worker
+ fun:_dl_catch_exception
+}
+{
+ jau_jvm_memcheck_20
+ Memcheck:Leak
+ fun:malloc
+ ...
+ obj:/usr/lib/jvm/java-17-openjdk-amd64/lib/server/libjvm.so
+ ...
+ fun:_ZN7JavaVM_27AttachCurrentThreadAsDaemonEPPvS0_
+ ...
+}
+
+{
+ jau_jvm_memcheck_30
+ Memcheck:Param
+ ioctl(SIOCGIFCONF)
+ fun:ioctl
+ obj:/usr/lib/jvm/java-17-openjdk-amd64/lib/libnet.so
+ fun:Java_java_net_NetworkInterface_boundInetAddress0
+ ...
+ obj:/usr/lib/jvm/java-17-openjdk-amd64/lib/server/libjvm.so
+ ...
+}
+
+{
+ jau_jvm_memcheck_31
+ Memcheck:Param
+ ioctl(SIOCGIFCONF).ifc_buf
+ fun:ioctl
+ obj:/usr/lib/jvm/java-17-openjdk-amd64/lib/libnet.so
+ fun:Java_java_net_NetworkInterface_boundInetAddress0
+ ...
+ obj:/usr/lib/jvm/java-17-openjdk-amd64/lib/server/libjvm.so
+ ...
+}
+
+{
+ jau_jvm_memcheck_40
+ Memcheck:Cond
+ ...
+ obj:/usr/lib/jvm/java-17-openjdk-amd64/lib/libnet.so
+ fun:Java_java_net_NetworkInterface_boundInetAddress0
+ ...
+ obj:/usr/lib/jvm/java-17-openjdk-amd64/lib/server/libjvm.so
+ fun:JVM_InvokeMethod
+ ...
+}
+
+
+
+
diff --git a/scripts/valgrind.supp b/scripts/valgrind.supp
new file mode 100644
index 0000000..15e234f
--- /dev/null
+++ b/scripts/valgrind.supp
@@ -0,0 +1,181 @@
+#
+# All file and line numbers from debug build using commit 60e6f5f67c5bc2a8fb26e8f2ef76c169c5b78813
+#
+# See <https://www.valgrind.org/docs/manual/mc-manual.html#mc-manual.suppfiles>
+# See <https://wiki.wxwidgets.org/Valgrind_Suppression_File_Howto>
+#
+
+# direct_bt::LFRingbuffer::* utilizes SC-DRF atomic acquire (read) and release (write)
+# not detected by helgrind. See unit test test_mm_sc_drf (passed).
+#
+# ==1175024== ---Thread-Announcement------------------------------------------
+# ==1175024== Thread #2 was created
+# ==1175024== by 0x49434C1: direct_bt::DBTManager::DBTManager(direct_bt::BTMode) (DBTManager.cpp:333)
+# ==1175024== Thread #2: Bug in libpthread: write lock granted on mutex/rwlock which is currently wr-held by a different thread
+# ==1175024== by 0x13283A: _ZN9jau10ringbufferISt10shared_ptrINS_9MgmtEventEELDnEE7putImplERKS3_bbi (LFRingbuffer.hpp:240)
+# (see below: cpp_unique_lock_cond_wait_002)
+{
+ jau_ringbuffer_lock_and_wait_001
+ Helgrind:Misc
+ fun:mutex_lock_WRK
+ ...
+ fun:*jau*ringbuffer*putImpl*
+ ...
+ obj:*libcipherpack_bt.so*
+}
+
+# direct_bt::LFRingbuffer::* utilizes SC-DRF atomic acquire (read) and release (write)
+# not detected by helgrind. See uni test test_mm_sc_drf (passed).
+#
+# ==1175024== Thread #1 is the program's root thread
+# ==1175024== Thread #2 unlocked lock at 0x13F628 currently held by thread #1
+# ==1175024== by 0x132913: _ZN9jau10ringbufferISt10shared_ptrINS_9MgmtEventEELDnEE7putImplERKS3_bbi (LFRingbuffer.hpp:240)
+# {
+# 240 std::unique_lock<std::mutex> lockRead(syncRead); // SC-DRF w/ getImpl via same lock
+# size++;
+# writePos = localWritePos; // SC-DRF release atomic writePos
+# cvRead.notify_all(); // notify waiting getter
+# }
+
+# ==1175024== Lock at 0x13F628 was first observed
+# ==1175024== by 0x131EDC: _ZN9jau10ringbufferISt10shared_ptrINS_9MgmtEventEELDnEE7getImplEbbi (LFRingbuffer.hpp:181)
+# if( blocking ) {
+# 181 std::unique_lock<std::mutex> lockRead(syncRead); // SC-DRF w/ putImpl via same lock
+# while( localReadPos == writePos ) {
+# ..
+# cvRead.wait(lockRead); or cvRead.wait_until(lockRead, ..);
+# }
+# }
+{
+ jau_ringbuffer_lock_and_wait_002
+ Helgrind:UnlockForeign
+ fun:mutex_unlock_WRK
+ ...
+ fun:*jau*ringbuffer*putImpl*
+ ...
+ obj:*libcipherpack_bt.so*
+}
+
+#
+# direct_bt::LFRingbuffer::* utilizes SC-DRF atomic acquire (read) and release (write)
+# not detected by helgrind. See uni test test_mm_sc_drf (passed).
+#
+# ==1175024== Possible data race during read of size 8 at 0x4F490E8 by thread #1
+# ==1175024== Locks held: 3, at addresses 0x13F480 0x13F650 0x13F7B0
+# ==1175024== at 0x131D90: std::__shared_ptr<direct_bt::MgmtEvent, (__gnu_cxx::_Lock_policy)2>::__shared_ptr(std::__shared_ptr<direct_bt::MgmtEvent, (__gnu_cxx::_Lock_policy)2> const&) (shared_ptr_base.h:1181)
+# ==1175024== by 0x131DDA: std::shared_ptr<direct_bt::MgmtEvent>::shared_ptr(std::shared_ptr<direct_bt::MgmtEvent> const&) (shared_ptr.h:149)
+# ==1175024== by 0x1320B0: _ZN9jau10ringbufferISt10shared_ptrINS_9MgmtEventEELDnEE7getImplEbbi (LFRingbuffer.hpp:198)
+#
+# ==1175024== This conflicts with a previous write of size 8 by thread #2
+# ==1175024== Locks held: 1, at address 0x13F6A0
+# ==1175024== at 0x130E6D: std::__shared_ptr<direct_bt::MgmtEvent, (__gnu_cxx::_Lock_policy)2>::operator=(std::__shared_ptr<direct_bt::MgmtEvent, (__gnu_cxx::_Lock_policy)2> const&) (shared_ptr_base.h:1182)
+# ==1175024== by 0x130EB4: std::shared_ptr<direct_bt::MgmtEvent>::operator=(std::shared_ptr<direct_bt::MgmtEvent> const&) (shared_ptr.h:358)
+# ==1175024== by 0x13281D: _ZN9jau10ringbufferISt10shared_ptrINS_9MgmtEventEELDnEE7putImplERKS3_bbi (LFRingbuffer.hpp:237)
+{
+ jau_ringbuffer_sc_drf_atomic_001
+ Helgrind:Race
+ ...
+ fun:*jau*ringbuffer*getImpl*
+ ...
+ obj:*libcipherpack_bt.so*
+}
+
+#
+# DRD
+#
+
+{
+ jau_ringbuffer_lock_and_wait_001
+ drd:CondErr
+ ...
+ fun:*jau*ringbuffer*putImpl*
+ ...
+}
+{
+ jau_ringbuffer_lock_and_wait_002
+ drd:MutexErr
+ ...
+ fun:*jau*ringbuffer*putImpl*
+ ...
+}
+{
+ jau_ringbuffer_lock_and_wait_002
+ drd:CondErr
+ ...
+ fun:_ZN9jau10ringbufferISt10shared_ptrIKNS_9AttPDUMsgEELDnEED1Ev
+ ...
+}
+
+{
+ jau_ringbuffer_lock_and_wait_021
+ drd:MutexErr
+ ...
+ fun:_ZNSt15_Sp_counted_ptrIPN9direct_bt11GATTHandlerELN9__gnu_cxx12_Lock_policyE2EE10_M_disposeEv
+ ...
+}
+
+{
+ jau_ringbuffer_lock_and_wait_031
+ drd:CondErr
+ ...
+ fun:_ZN9jau10ringbufferISt10shared_ptrINS_8HCIEventEELDnEED1Ev
+ ...
+}
+{
+ jau_ringbuffer_lock_and_wait_031
+ drd:CondErr
+ ...
+ fun:_ZN9jau10ringbufferISt10shared_ptrINS_9MgmtEventEELDnEED1Ev
+ ...
+}
+{
+ jau_ringbuffer_lock_and_wait_032
+ drd:MutexErr
+ ...
+ fun:_ZNSt15_Sp_counted_ptrIPN9direct_bt10HCIHandlerELN9__gnu_cxx12_Lock_policyE2EE10_M_disposeEv
+ ...
+}
+
+{
+ jau_ringbuffer_sc_drf_atomic_001
+ drd:MutexErr
+ ...
+ fun:*jau*ringbuffer*getImpl*
+ ...
+}
+{
+ jau_ringbuffer_sc_drf_atomic_001
+ drd:ConflictingAccess
+ ...
+ fun:*jau*ringbuffer*getImpl*
+ ...
+}
+
+{
+ jau_cow_vector_sc_drf_atomic_041
+ drd:ConflictingAccess
+ ...
+ fun:*jau*cow_vector*
+ ...
+}
+{
+ jau_cow_vector_sc_drf_atomic_043
+ drd:ConflictingAccess
+ ...
+ fun:*jau*FunctionDef*shared_ptr*
+ ...
+}
+
+{
+ jau_check2_01
+ Memcheck:Cond
+ ...
+ fun:*Catch*RunContext*
+ ...
+}
+
+#
+# Memcheck:Leak
+#
+
+
diff --git a/scripts/valgrindmerge b/scripts/valgrindmerge
new file mode 100755
index 0000000..f9b11e2
--- /dev/null
+++ b/scripts/valgrindmerge
@@ -0,0 +1,65 @@
+#!/usr/bin/perl
+
+# Copyright 2016 Timothe Litt litt at acm _ddot_ org
+#
+# May be freely used and copied providing this notice is retained
+# No warranty, use at your own risk
+#
+
+# valgrind foo 3>&1 1>&2 2>&3 | grindmerge -f input >newrules
+
+# Source: <https://wiki.wxwidgets.org/Parse_valgrind_suppressions.sh>
+# See: <https://wiki.wxwidgets.org/Valgrind_Suppression_File_Howto>
+
+use warnings;
+use strict;
+
+use Digest::MD5 qw/md5_hex/;
+
+my %known;
+my $dups = 0;
+
+sub parse {
+ my $in = shift;
+
+ while( <$in> ) {
+ next unless( /^\{/ );
+
+ my $block = $_;
+ while( <$in> ) {
+ if( /^\}/ ) {
+ $block .= "}\n";
+ last;
+ }
+ $block .= $_;
+ }
+ last unless( defined $block );
+ if( $block !~ /\}\n/ ) {
+ print STDERR ("Unterminated suppression at line $.\n" );
+ last;
+ }
+ my $key = $block;
+ $key =~ s/(\A{[^\n]*\n)\s*[^\n]*\n/$1/;
+ my $sum = md5_hex( $key );
+ $dups++ if( exists $known{$sum} );
+ $known{$sum} = $block;
+ }
+}
+
+if( @ARGV >= 2 && $ARGV[0] eq '-f' ) {
+ if( open( my $db, '<', $ARGV[1] ) ) {
+ parse( $db );
+ close( $db );
+ } else {
+ print STDERR ("Open failed for $ARGV[1]: $!\n");
+ exit 1;
+ }
+ print STDERR ("Read " . keys( %known ) . " suppressions from $ARGV[1]\n" );
+}
+
+parse( \*STDIN );
+
+print $known{$_} foreach ( sort keys %known );
+
+print STDERR ("Squashed $dups duplicate suppressions\n")
+