Bug 197462 - dlmopen with LM_ID_NEWLM and RTLD_GLOBAL segfaults in add_to_global
Summary: dlmopen with LM_ID_NEWLM and RTLD_GLOBAL segfaults in add_to_global
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: glibc
Version: rawhide
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Brian Brock
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2006-07-02 08:07 UTC by Nicholas Miell
Modified: 2007-11-30 22:11 UTC (History)
0 users

Fixed In Version: 2.4.90-15
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2006-08-07 10:49:28 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
gdb debugging log (3.79 KB, text/plain)
2006-07-02 08:07 UTC, Nicholas Miell
no flags Details
test program (174 bytes, text/x-csrc)
2006-07-02 08:08 UTC, Nicholas Miell
no flags Details

Description Nicholas Miell 2006-07-02 08:07:02 UTC
Created attachment 131847 [details]
gdb debugging log

Comment 1 Nicholas Miell 2006-07-02 08:07:02 UTC
dlmopen will segfault in the rtld when passed flags LM_ID_NEWLM and
RTLD_GLOBAL|RTLD_NOW.

Failure is at dl-open.c line 102/103:

99        if (GL(dl_ns)[new->l_ns]._ns_global_scope_alloc == 0)
100         {
101           /* This is the first dynamic object given global scope.  */
102           GL(dl_ns)[new->l_ns]._ns_global_scope_alloc
103             = GL(dl_ns)[new->l_ns]._ns_main_searchlist->r_nlist + to_add + 8;
104           new_global = (struct link_map **)
105             malloc (GL(dl_ns)[new->l_ns]._ns_global_scope_alloc
106                     * sizeof (struct link_map *));

because _rtld_local._dl_ns[new->l_ns]._ns_main_searchlist is NULL.

Comment 2 Nicholas Miell 2006-07-02 08:08:03 UTC
Created attachment 131848 [details]
test program

Comment 3 Ulrich Drepper 2006-07-26 14:35:02 UTC
It makes no sense to use RTLD_GLOBAL when dlmopen loads the object in anything
but the first namespace.  I added a test to catch that upstream.  It'll be in
the next rawhide release.


Note You need to log in before you can comment on or make changes to this bug.