Module Name: src
Committed By: riastradh
Date: Fri Jun 2 19:08:01 UTC 2023
Modified Files:
src/tests/libexec/ld.elf_so: t_tls_extern.c
Log Message:
ld.elf_so: tls_extern dynamic_defabuse_eager must xfail differently.
If a symbol has already been resolved as dynamic TLS, any library
that tries to use it as static TLS cannot be dlopened.
XXX pullup-10
To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/tests/libexec/ld.elf_so/t_tls_extern.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/tests/libexec/ld.elf_so/t_tls_extern.c
diff -u src/tests/libexec/ld.elf_so/t_tls_extern.c:1.8 src/tests/libexec/ld.elf_so/t_tls_extern.c:1.9
--- src/tests/libexec/ld.elf_so/t_tls_extern.c:1.8 Thu Jun 1 23:47:24 2023
+++ src/tests/libexec/ld.elf_so/t_tls_extern.c Fri Jun 2 19:08:01 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: t_tls_extern.c,v 1.8 2023/06/01 23:47:24 riastradh Exp $ */
+/* $NetBSD: t_tls_extern.c,v 1.9 2023/06/02 19:08:01 riastradh Exp $ */
/*-
* Copyright (c) 2023 The NetBSD Foundation, Inc.
@@ -113,13 +113,20 @@ ATF_TC_BODY(dynamic_abusedefnoload, tc)
ATF_TC(dynamic_defabuse_eager);
ATF_TC_HEAD(dynamic_defabuse_eager, tc)
{
- atf_tc_set_md_var(tc, "descr", "extern __thread for TLS works,"
+ atf_tc_set_md_var(tc, "descr", "dlopen refuses extern __thread for TLS,"
" loading dynamic def then static use eagerly");
}
ATF_TC_BODY(dynamic_defabuse_eager, tc)
{
- tls_extern("libh_def_dynamic.so", "libh_abuse_dynamic.so",
- DEF_USE_EAGER, /*xfail*/true);
+ void *def;
+ int *(*fdef)(void);
+
+ ATF_REQUIRE_DL(def = dlopen("libh_def_dynamic.so", 0));
+ ATF_REQUIRE_DL(fdef = dlsym(def, "fdef"));
+ (void)(*fdef)();
+ atf_tc_expect_fail("rtld fails to detect dynamic-then-static abuse");
+ ATF_CHECK_EQ_MSG(NULL, dlopen("libh_abuse_dynamic.so", 0),
+ "dlopen failed to detect static-then-dynamic abuse");
}
ATF_TC(dynamic_defabuse_lazy);