This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug dynamic-link/18676] New: RTLD_NODELETE on an already open DSO does not prevent unloading
- From: "siddhesh at redhat dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Wed, 15 Jul 2015 08:02:58 +0000
- Subject: [Bug dynamic-link/18676] New: RTLD_NODELETE on an already open DSO does not prevent unloading
- Auto-submitted: auto-generated
https://sourceware.org/bugzilla/show_bug.cgi?id=18676
Bug ID: 18676
Summary: RTLD_NODELETE on an already open DSO does not prevent
unloading
Product: glibc
Version: unspecified
Status: NEW
Severity: normal
Priority: P2
Component: dynamic-link
Assignee: siddhesh at redhat dot com
Reporter: siddhesh at redhat dot com
Target Milestone: ---
Loading an already opened DSO with RTLD_NODELETE does not prevent the DSO from
being unloaded. A simple program below demonstrates this:
cat > test.c
include <dlfcn.h>
#include <stdio.h>
int
do_test (void)
{
void *h1 = dlopen ("$ORIGIN/tst-nodelete-opened-lib.so", RTLD_LAZY);
if (h1 == NULL)
{
printf ("h1: failed to open DSO: %s\n", dlerror ());
return 1;
}
void *h2 = dlopen ("$ORIGIN/tst-nodelete-opened-lib.so",
RTLD_LAZY | RTLD_NODELETE);
if (h2 == NULL)
{
printf ("h2: failed to open DSO: %s\n", dlerror ());
return 1;
}
int *foo = dlsym (h2, "foo_var");
if (foo == NULL)
{
printf ("failed to load symbol foo_var: %s\n", dlerror ());
return 1;
}
dlclose (h1);
dlclose (h2);
printf ("foo == %d\n", *foo);
return 0;
}
#define TEST_FUNCTION do_test ()
#include "../test-skeleton.c"
cat > tst-nodelete-opened-lib.c
int foo_var = 42;
Expected result:
No segfault.
Actual Result:
Segfault.
Patch coming up.
--
You are receiving this mail because:
You are on the CC list for the bug.