-/* Test case for BZ #16634 and BZ#24900.
+/* Common code for tst-dlopen-tlsmodid, tst-dlopen-tlsmodid-pie,
+ tst-dlopen-tlsmodid-container.
Verify that incorrectly dlopen()ing an executable without
__RTLD_OPENEXEC does not cause assertion in ld.so, and that it
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
+/* Before including this file, the macro TST_DLOPEN_TLSMODID_PATH must
+ be defined, to specify the path used for the open operation. */
+
#include <dlfcn.h>
#include <pthread.h>
#include <stdio.h>
return p;
}
-/* Call dlopen on PATH and check that fails with an error message
- indicating an attempt to open an ET_EXEC or PIE object. */
+/* Call dlopen and check that fails with an error message indicating
+ an attempt to open an ET_EXEC or PIE object. */
static void
-check_dlopen_failure (const char *path)
+check_dlopen_failure (void)
{
- void *handle = dlopen (path, RTLD_LAZY);
+ void *handle = dlopen (TST_DLOPEN_TLSMODID_PATH, RTLD_LAZY);
if (handle != NULL)
- FAIL_EXIT1 ("dlopen succeeded unexpectedly: %s", path);
+ FAIL_EXIT1 ("dlopen succeeded unexpectedly: %s", TST_DLOPEN_TLSMODID_PATH);
const char *message = dlerror ();
TEST_VERIFY_EXIT (message != NULL);
{
pthread_t thr;
- check_dlopen_failure (argv[0]);
+ check_dlopen_failure ();
/* We create threads to force TLS allocation, which triggers
the original bug i.e. running out of surplus slotinfo entries
xpthread_join (thr);
}
- /* The elf subdirectory (or $ORIGIN in the container case) is on the
- library search path. */
- check_dlopen_failure ("tst-dlopen-aout");
+ check_dlopen_failure ();
return 0;
}