From: Paul Floyd Date: Fri, 5 May 2023 20:05:36 +0000 (+0200) Subject: Add Helgrind and DRD tests and suppressions for getaddrinfo on Linux X-Git-Tag: VALGRIND_3_22_0~171 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=40b914f0d09c1e021e7398a17ab5cc7a854f39c8;p=thirdparty%2Fvalgrind.git Add Helgrind and DRD tests and suppressions for getaddrinfo on Linux Bump version to 3.22.0.GIT The testcase was posted on the freebsd-hackers mailing list. I had time to get suppressions for FreeBSD into 3.21 but ran out of time for the test and Linux suppressions. I did take a look at how thread sanitizer handles this. Basically it intercepts the call, turns off checking, calls the resl function then turns checking back on. I don't see many other similar examples. Might be worth looking at dlopen and atexit. --- diff --git a/.gitignore b/.gitignore index 27183b99b9..6155f8f355 100644 --- a/.gitignore +++ b/.gitignore @@ -662,6 +662,7 @@ /helgrind/tests/cond_timedwait_test /helgrind/tests/free_is_write /helgrind/tests/garbage.filtered.out +/helgrind/tests/getaddrinfo /helgrind/tests/hg01_all_ok /helgrind/tests/hg02_deadlock /helgrind/tests/hg03_inherit diff --git a/NEWS b/NEWS index 342a733650..e269d128b9 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,37 @@ +Release 3.22.0 (?? Oct 2023) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +This release supports X86/Linux, AMD64/Linux, ARM32/Linux, ARM64/Linux, +PPC32/Linux, PPC64BE/Linux, PPC64LE/Linux, S390X/Linux, MIPS32/Linux, +MIPS64/Linux, ARM/Android, ARM64/Android, MIPS32/Android, X86/Android, +X86/Solaris, AMD64/Solaris, AMD64/MacOSX 10.12, X86/FreeBSD and +AMD64/FreeBSD. There is also preliminary support for X86/macOS 10.13, +AMD64/macOS 10.13 and nanoMIPS/Linux. + +* ==================== CORE CHANGES =================== + + +* ================== PLATFORM CHANGES ================= + + +* ==================== TOOL CHANGES =================== + + +* ==================== FIXED BUGS ==================== + +The following bugs have been fixed or resolved. Note that "n-i-bz" +stands for "not in bugzilla" -- that is, a bug that was reported to us +but never got a bugzilla entry. We encourage you to file bugs in +bugzilla (https://bugs.kde.org/enter_bug.cgi?product=valgrind) rather +than mailing the developers (or mailing lists) directly -- bugs that +are not entered into bugzilla tend to get forgotten about or ignored. + + + +To see details of a given bug, visit + https://bugs.kde.org/show_bug.cgi?id=XXXXXX +where XXXXXX is the bug number as listed above. + Release 3.21.0 (28 Apr 2023) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/configure.ac b/configure.ac index 79b17f3940..15fbf5ea20 100755 --- a/configure.ac +++ b/configure.ac @@ -15,10 +15,10 @@ # Also set the (expected/last) release date here. # Do not forget to rerun ./autogen.sh m4_define([v_major_ver], [3]) -m4_define([v_minor_ver], [21]) +m4_define([v_minor_ver], [22]) m4_define([v_micro_ver], [0]) -m4_define([v_suffix_ver], []) -m4_define([v_rel_date], ["28 Apr 2023"]) +m4_define([v_suffix_ver], [GIT]) +m4_define([v_rel_date], ["?? Oct 2023"]) m4_define([v_version], m4_if(v_suffix_ver, [], [v_major_ver.v_minor_ver.v_micro_ver], diff --git a/drd/tests/Makefile.am b/drd/tests/Makefile.am index 7ea83cbf7e..5482cf7be4 100755 --- a/drd/tests/Makefile.am +++ b/drd/tests/Makefile.am @@ -152,6 +152,8 @@ EXTRA_DIST = \ hold_lock_1.vgtest \ hold_lock_2.stderr.exp \ hold_lock_2.vgtest \ + getaddrinfo.stderr.exp \ + getaddrinfo.vgtest \ linuxthreads_det.stderr.exp \ linuxthreads_det.stderr.exp-linuxthreads \ linuxthreads_det.stdout.exp \ diff --git a/drd/tests/getaddrinfo.stderr.exp b/drd/tests/getaddrinfo.stderr.exp new file mode 100644 index 0000000000..e69de29bb2 diff --git a/drd/tests/getaddrinfo.vgtest b/drd/tests/getaddrinfo.vgtest new file mode 100644 index 0000000000..6faa2b6bde --- /dev/null +++ b/drd/tests/getaddrinfo.vgtest @@ -0,0 +1,3 @@ +prereq: ./supported_libpthread +vgopts: -q +prog: ../../helgrind/tests/getaddrinfo diff --git a/glibc-2.X-drd.supp.in b/glibc-2.X-drd.supp.in index 4c6bdb6a1a..9f8fda9f4f 100644 --- a/glibc-2.X-drd.supp.in +++ b/glibc-2.X-drd.supp.in @@ -351,3 +351,13 @@ ... fun:_ZN5boost6detail23set_current_thread_dataEPNS0_16thread_data_baseE } + +# +# Suppression patterrns for posix functions +{ + drd-libc-getaddrinfo + drd:ConflictingAccess + ... + fun:getaddrinfo +} + diff --git a/glibc-2.X-helgrind.supp.in b/glibc-2.X-helgrind.supp.in index 0f76ad0e9a..d46a7a1166 100644 --- a/glibc-2.X-helgrind.supp.in +++ b/glibc-2.X-helgrind.supp.in @@ -302,3 +302,12 @@ Helgrind:Race fun:gomp_ordered_last } + +#################################################### +# posix functions that are thread safe +{ + helgrind---getaddrinfo + Helgrind:Race + ... + fun:getaddrinfo +} diff --git a/helgrind/tests/Makefile.am b/helgrind/tests/Makefile.am index 5338ea4d6d..13e2d4db66 100755 --- a/helgrind/tests/Makefile.am +++ b/helgrind/tests/Makefile.am @@ -33,6 +33,7 @@ EXTRA_DIST = \ bar_trivial.vgtest bar_trivial.stdout.exp bar_trivial.stderr.exp \ free_is_write.vgtest free_is_write.stdout.exp \ free_is_write.stderr.exp \ + getaddrinfo.vgtest getaddrinfo.stderr.exp \ hg01_all_ok.vgtest hg01_all_ok.stdout.exp hg01_all_ok.stderr.exp \ hg02_deadlock.vgtest hg02_deadlock.stdout.exp hg02_deadlock.stderr.exp \ hg03_inherit.vgtest hg03_inherit.stdout.exp hg03_inherit.stderr.exp \ @@ -153,6 +154,7 @@ check_PROGRAMS = \ cond_timedwait_invalid \ cond_timedwait_test \ free_is_write \ + getaddrinfo \ hg01_all_ok \ hg02_deadlock \ hg03_inherit \ diff --git a/helgrind/tests/getaddrinfo.c b/helgrind/tests/getaddrinfo.c new file mode 100644 index 0000000000..bdb8434588 --- /dev/null +++ b/helgrind/tests/getaddrinfo.c @@ -0,0 +1,38 @@ +#include +#include +#include +#include + +struct data { + const char *hostname; + struct addrinfo *res; +}; + +struct data threaddat[5] = { + { "www.freebsd.org", 0 }, + { "www.google.com", 0 }, + { "www.freshports.org", 0 }, + { "www.github.com", 0 }, + { "www.kernel.org", 0 } +}; + +pthread_t threads[5]; + +void *resolve(void *d) { + struct data *data = d; + getaddrinfo(data->hostname, 0, 0, &data->res); + return 0; +} + +int main(void) { + int i; + for (i = 0; i < 5; ++i) { + pthread_create(&threads[i], 0, resolve, &threaddat[i]); + } + for (i = 0; i < 5; ++i) { + pthread_join(threads[i], 0); + freeaddrinfo(threaddat[i].res); + } + return 0; +} + diff --git a/helgrind/tests/getaddrinfo.stderr.exp b/helgrind/tests/getaddrinfo.stderr.exp new file mode 100644 index 0000000000..e69de29bb2 diff --git a/helgrind/tests/getaddrinfo.vgtest b/helgrind/tests/getaddrinfo.vgtest new file mode 100644 index 0000000000..b58c618887 --- /dev/null +++ b/helgrind/tests/getaddrinfo.vgtest @@ -0,0 +1,2 @@ +prog: getaddrinfo +vgopts: -q