This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug dynamic-link/19773] New: replacing .so which was opened and closed, leads to segfault on next dlopen/dlsym


https://sourceware.org/bugzilla/show_bug.cgi?id=19773

            Bug ID: 19773
           Summary: replacing .so which was opened and closed, leads to
                    segfault on next dlopen/dlsym
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: dynamic-link
          Assignee: unassigned at sourceware dot org
          Reporter: vl.homutov at gmail dot com
  Target Milestone: ---

Created attachment 9067
  --> https://sourceware.org/bugzilla/attachment.cgi?id=9067&action=edit
minimal testcase reproducing issue

in pseudocode:

handle = dlopen(foo.so)
dlclose(foo.so)

now replace foo.so with another of itself, which was in another directory,
by external process

handle = dlopen(foo.so) // same handle returned
sym = dlsym(handle, blah) <-- CRASH !


The complete C example is in the attached tarball.
just run 'make fail' to get segfault.
Note that 'make pass' will work normally, despite the ONLY difference
is the path, used to run binary: './bin/dltest' vs './dltest'

Also note that a different sequence of dlopen/dlclose will lead to crash in
another place (swap #if condition in example to see)

This was tested on centos6, ubuntu 15.04 and gentoo (glibc 2.21) - same
behaviour everywhere.
Also, I've tested with freebsd10 and no issues there with this code.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]