public inbox for glibc-bugs@sourceware.org help / color / mirror / Atom feed
From: "srk31 at srcf dot ucam.org" <sourceware-bugzilla@sourceware.org> To: glibc-bugs@sourceware.org Subject: [Bug dynamic-link/31168] New: ld.so startup segfaults if constructor does dlopen with RTLD_GLOBAL Date: Thu, 14 Dec 2023 22:35:45 +0000 [thread overview] Message-ID: <bug-31168-131@http.sourceware.org/bugzilla/> (raw) https://sourceware.org/bugzilla/show_bug.cgi?id=31168 Bug ID: 31168 Summary: ld.so startup segfaults if constructor does dlopen with RTLD_GLOBAL Product: glibc Version: 2.35 Status: UNCONFIRMED Severity: normal Priority: P2 Component: dynamic-link Assignee: unassigned at sourceware dot org Reporter: srk31 at srcf dot ucam.org Target Milestone: --- Created attachment 15260 --> https://sourceware.org/bugzilla/attachment.cgi?id=15260&action=edit small reproducer The ld.so of glibc 2.36 (and likely later but I haven't tested) may crash during _dl_init of the main executable, if an early constructor does a dlopen with RTLD_GLOBAL. The problem seems to be that `add_to_global_update()` adds to `main_map->l_searchlist.r_nlist` but `main_map->l_initfini` is not resized to match. This is a problem since `r_nlist` is used to bound the call_init loop in dl-init.c, which ranges over `l_initfini`: 135 i = main_map->l_searchlist.r_nlist; 136 while (i-- > 0) 137 call_init (main_map->l_initfini[i], argc, argv, env); ... meaning the loop will run off the end of the `l_initfini` list, calling `call_init` passing the NULL terminator value instead of a link map. See attached test case... this is doing dlopen during the constructor of an initfirst preloaded object. I'm not sure whether it can be reproduced without initfirst and/or preloading... this combination closely models my use case, which was working fine until at least 2.28. -- You are receiving this mail because: You are on the CC list for the bug.
reply other threads:[~2023-12-14 22:36 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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-31168-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).