Summary: | Calling dl_iterate_phdr via dlopen/dlsym causes failure: ld-elf.so.1: Can't find module with TLS index 1 | ||||||
---|---|---|---|---|---|---|---|
Product: | Base System | Reporter: | Yuri Victorovich <yuri> | ||||
Component: | misc | Assignee: | freebsd-bugs (Nobody) <bugs> | ||||
Status: | Closed Works As Intended | ||||||
Severity: | Affects Only Me | CC: | jwb, kib | ||||
Priority: | --- | ||||||
Version: | 13.2-STABLE | ||||||
Hardware: | Any | ||||||
OS: | Any | ||||||
Attachments: |
|
Description
Yuri Victorovich
2023-08-07 06:40:17 UTC
This is expected outcome, since libc only provides stubs to satisfy the static linker. In the test program, change the "/lib/libc.so.7" path into RTLD_DEFAULT. It should work then. (In reply to Konstantin Belousov from comment #1) Thank you. A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=21a52f99440c9bec7679f3b0c5c9d888901c3694 commit 21a52f99440c9bec7679f3b0c5c9d888901c3694 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2023-08-09 05:07:05 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2023-08-09 05:07:05 +0000 libc dlfcn.c: make dl_iterate_phdr() from libc more useful Apparently there are applications that resolve dl_iterate_phdr from libc and try to call the symbol. Our libc only provides stubs for dl* to satisfy static linker or statically linked binaries, and is not prepared to this situation. Add a code to dso libc to find real dl_iterate_phdr and redirect the call to it. Reported by: yuri PR: 272992 Sponsored by: The FreeBSD Foundation MFC after: 1 week lib/libc/gen/dlfcn.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) A commit in branch stable/13 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=b53ecd5cf63b90a72436642056733b686d881eb1 commit b53ecd5cf63b90a72436642056733b686d881eb1 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2023-08-09 05:07:05 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2023-08-13 04:35:41 +0000 libc dlfcn.c: make dl_iterate_phdr() from libc more useful PR: 272992 (cherry picked from commit 21a52f99440c9bec7679f3b0c5c9d888901c3694) lib/libc/gen/dlfcn.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) Has anyone checked whether this commit resolves the threadpoolctl issue? https://github.com/joblib/threadpoolctl/issues/125 Thanks... |