public inbox for glibc-bugs@sourceware.org help / color / mirror / Atom feed
From: "64.delta at proton dot me" <sourceware-bugzilla@sourceware.org> To: glibc-bugs@sourceware.org Subject: [Bug dynamic-link/29317] New: dlsym with RTLD_DEFAULT causes library to be marked as NODELETE (preventing unloading) Date: Mon, 04 Jul 2022 19:05:41 +0000 [thread overview] Message-ID: <bug-29317-131@http.sourceware.org/bugzilla/> (raw) https://sourceware.org/bugzilla/show_bug.cgi?id=29317 Bug ID: 29317 Summary: dlsym with RTLD_DEFAULT causes library to be marked as NODELETE (preventing unloading) Product: glibc Version: unspecified Status: UNCONFIRMED Severity: normal Priority: P2 Component: dynamic-link Assignee: unassigned at sourceware dot org Reporter: 64.delta at proton dot me Target Milestone: --- Here is a reproducer, using glibc version 2.35: $ cat main.c #include <dlfcn.h> #include <assert.h> int main() { void *foo = dlopen("libfoo.so", RTLD_GLOBAL | RTLD_NOW); assert(foo); void *sym = dlsym(RTLD_DEFAULT, "foo"); // void *sym = dlsym(foo, "foo"); assert(sym); dlclose(foo); assert(!dlopen("libfoo.so", RTLD_NOLOAD | RTLD_NOW)); } $ cat libfoo.c void foo() {} $ gcc libfoo.c -shared -o libfoo.so $ gcc main.c -D_GNU_SOURCE -Wl,-rpath=. && ./a.out a.out: main.c:14: main: Assertion `!dlopen("libfoo.so", RTLD_NOLOAD | RTLD_NOW)' failed. --- Running with LD_DEBUG=all reveals that 'marking ./libfoo.so [0] as NODELETE due to reference to main program' is printed during the call to dlsym. If instead the commented line is used in favour of the line above, then the assertion passes and no such log is printed. As far as I'm aware there's nothing about RTLD_DEFAULT which would require the library be marked as NODELETE, so I assume this is a bug. -- You are receiving this mail because: You are on the CC list for the bug.
next reply other threads:[~2022-07-04 19:05 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-07-04 19:05 64.delta at proton dot me [this message] 2022-07-05 6:33 ` [Bug dynamic-link/29317] " fweimer at redhat dot com 2022-07-05 14:59 ` 64.delta at proton dot me 2022-07-07 7:04 ` fweimer at redhat dot com
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-29317-131@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=glibc-bugs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).