Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F107109823
D43859.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D43859.diff
View Options
diff --git a/libexec/rtld-elf/tests/Makefile b/libexec/rtld-elf/tests/Makefile
--- a/libexec/rtld-elf/tests/Makefile
+++ b/libexec/rtld-elf/tests/Makefile
@@ -13,6 +13,8 @@
SRCS.$t= $t.c common.c
.endfor
+ATF_TESTS_C+= dlopen_test
+
WARNS?= 3
.include <bsd.test.mk>
diff --git a/libexec/rtld-elf/tests/dlopen_test.c b/libexec/rtld-elf/tests/dlopen_test.c
new file mode 100644
--- /dev/null
+++ b/libexec/rtld-elf/tests/dlopen_test.c
@@ -0,0 +1,52 @@
+/*-
+ *
+ * Copyright (C) 2024 Kyle Evans <kevans@FreeBSD.org>
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ */
+
+#include <dlfcn.h>
+
+#include <atf-c.h>
+
+ATF_TC_WITHOUT_HEAD(dlopen_basic);
+ATF_TC_BODY(dlopen_basic, tc)
+{
+ void *hdl, *sym;
+
+ hdl = dlopen("libthr.so", RTLD_NOW);
+ ATF_REQUIRE(hdl != NULL);
+
+ sym = dlsym(hdl, "pthread_create");
+ ATF_REQUIRE(sym != NULL);
+
+ dlclose(hdl);
+
+ sym = dlsym(hdl, "pthread_create");
+ ATF_REQUIRE(sym == NULL);
+}
+
+ATF_TC_WITHOUT_HEAD(dlopen_recursing);
+ATF_TC_BODY(dlopen_recursing, tc)
+{
+ void *hdl;
+
+ /*
+ * If this doesn't crash, we're OK; a regression at one point caused
+ * some infinite recursion here.
+ */
+ hdl = dlopen("libthr.so", RTLD_NOW | RTLD_GLOBAL);
+ ATF_REQUIRE(hdl != NULL);
+
+ dlclose(hdl);
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+
+ ATF_TP_ADD_TC(tp, dlopen_basic);
+ ATF_TP_ADD_TC(tp, dlopen_recursing);
+
+ return atf_no_error();
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Jan 11, 6:26 AM (19 h, 35 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15751352
Default Alt Text
D43859.diff (1 KB)
Attached To
Mode
D43859: rtld: add some dlopen tests
Attached
Detach File
Event Timeline
Log In to Comment