public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [COMMITTED] tests: Add dlopen override to dwfl-proc-attach for old glibc/valgrind.
@ 2020-10-31 12:50 Mark Wielaard
  0 siblings, 0 replies; only message in thread
From: Mark Wielaard @ 2020-10-31 12:50 UTC (permalink / raw)
  To: elfutils-devel; +Cc: Mark Wielaard

Some combination of old glibc and valgrind create unsuppressable memory
leak warnings when the process is run under valgrind, is multi-threaded
and uses dlopen. libdw will try to dlopen libdebuginfod be default.
So simply override dlopen and always return NULL to make sure
libdebuginfod is never loaded.  The dwfl-proc-attach test doesn't rely
on libdebuginfod anyway.

This was seen on the armbian buildbot which uses valgrind 3.14.0 and
glibc 2.28.

Signed-off-by: Mark Wielaard <mark@klomp.org>
---
 tests/ChangeLog          |  4 ++++
 tests/dwfl-proc-attach.c | 12 ++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/tests/ChangeLog b/tests/ChangeLog
index 17c6ba2d..af8ece63 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,7 @@
+2020-10-31  Mark Wielaard  <mark@klomp.org>
+
+	* dwfl-proc-attach.c (dlopen): New external function override.
+
 2020-10-31  Mark Wielaard  <mark@klomp.org>
 
 	* test-wrapper.sh: Use =, not == for string compare.
diff --git a/tests/dwfl-proc-attach.c b/tests/dwfl-proc-attach.c
index b72cc814..d02e9fc0 100644
--- a/tests/dwfl-proc-attach.c
+++ b/tests/dwfl-proc-attach.c
@@ -107,4 +107,16 @@ main (int argc __attribute__ ((unused)),
   return (threads == 3) ? 0 : -1;
 }
 
+/* HACK. This is a simple workaround for a combination of old glibc
+   and valgrind. libdw will try to dlopen libdebuginfod this causes
+   some unsuppressable memory leak warnings when the process is
+   multi-threaded under valgrind because of some bad backtraces.
+   So simply override dlopen and always return NULL so libdebuginfod
+   (and libcurl) are never loaded.  This test doesn't rely on
+   libdebuginfod anyway.  */
+void *dlopen (void)
+{
+  return NULL;
+}
+
 #endif /* __linux__ */
-- 
2.18.4


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-10-31 12:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-31 12:50 [COMMITTED] tests: Add dlopen override to dwfl-proc-attach for old glibc/valgrind Mark Wielaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).