diff --git a/ChangeLog b/ChangeLog index e9f203fd37..0f2936c2f3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2017-12-12 Carlos O'Donell + + [BZ #14681] + * elf/tst-leaks1.c (do_test): Call one dlopen with $ORIGIN expansion + before mtrace. + 2017-12-15 H.J. Lu [BZ #19574] diff --git a/elf/tst-leaks1.c b/elf/tst-leaks1.c index d67e8269c4..75bc92d25f 100644 --- a/elf/tst-leaks1.c +++ b/elf/tst-leaks1.c @@ -6,13 +6,28 @@ static int do_test (void) { + void *h; + int ret = 0; + /* Carry out *one* failing call to dlopen before starting mtrace to + force any one-time inintialization that may happen to the + executable link map e.g. expansion and caching of $ORIGIN. */ + h = dlopen ("$ORIGIN/tst-leaks1.o", RTLD_LAZY); + if (h != NULL) + { + puts ("dlopen unexpectedly succeeded"); + ret = 1; + dlclose (h); + } + + /* Start tracing and run each test 5 times to see if there are any + leaks in the failing dlopen. */ mtrace (); - int ret = 0; for (int i = 0; i < 10; i++) { - void *h = dlopen (i < 5 ? "./tst-leaks1.c" - : "$ORIGIN/tst-leaks1.o", RTLD_LAZY); + h = dlopen (i < 5 + ? "./tst-leaks1.c" + : "$ORIGIN/tst-leaks1.o", RTLD_LAZY); if (h != NULL) { puts ("dlopen unexpectedly succeeded");