[Bug dynamic-link/19810] New: dlopen with both RTLD_NOLOAD and RTLD_NODELETE causes a segmentation fault

aurelien at aurel32 dot net sourceware-bugzilla@sourceware.org
Fri Mar 11 18:22:00 GMT 2016


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

            Bug ID: 19810
           Summary: dlopen with both RTLD_NOLOAD and RTLD_NODELETE causes
                    a segmentation fault
           Product: glibc
           Version: 2.23
               URL: http://bugs.debian.org/817900
            Status: NEW
          Severity: normal
          Priority: P2
         Component: dynamic-link
          Assignee: unassigned at sourceware dot org
          Reporter: aurelien at aurel32 dot net
  Target Milestone: ---

Since glibc 2.22, dlopen(LIBM_SO, RTLD_LAZY | RTLD_NOLOAD | RTLD_NODELETE)
triggers a segmentation fault instead of returning a NULL pointer.

This is caused by the following commit:

commit b632bdd3f7c0ba0c79f23f5e4404eebb87ebdaa8
Author: Siddhesh Poyarekar <siddhesh@redhat.com>
Date:   Thu Jul 16 08:53:28 2015 +0530

    Set NODELETE flag when opening already open objects with RTLD_NODELETE

    The DF_1_NODELETE flag is set too late when opening a DSO, due to
    which, if a DSO is already open, subsequently opening it with
    RTLD_NODELETE fails to set the DF_1_NODELETE flag.  This patch fixes
    this by setting the flag immediately after bumping the opencount.

    Verified on x86_64.

        [BZ #18676]
        * elf/tst-nodelete-opened.c: New test case.
        * elf/tst-nodelete-opened-lib.c: New test case module.
        * elf/Makefile (tests, modules-names): Use them.
        * elf/dl-open.c (dl_open_worker): Set DF_1_NODELETE flag
        early.

The setting of the NODELETE has been moved a tiny bit too early. A patch will
follow on the mailing list.

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


More information about the Glibc-bugs mailing list