Bug 15291 - cannot enable executable stack as shared object requires
Summary: cannot enable executable stack as shared object requires
Status: RESOLVED FIXED
Alias: None
Product: glibc
Classification: Unclassified
Component: libc (show other bugs)
Version: 2.14
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-03-21 09:06 UTC by Yogesh Gaur
Modified: 2014-06-13 18:41 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:
fweimer: security-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yogesh Gaur 2013-03-21 09:06:39 UTC
I have taken the patch provided for the issue "do_lookup_x may access dangling memory" fixed in bugzilla http://sourceware.org/bugzilla/show_bug.cgi?id=13579

With this patch crash issue of "do_lookup_x may access dangling memory" gets solved but I am getting one more new issue on my MIPS target.

error : ./libjpeg.so: cannot enable executable stack as shared object requires: Invalid argument.

--------------------------------------------------------------
cat test.c
#include <stdio.h>
#include <dlfcn.h>
#include <pthread.h>

void *handle;

static void *thread_abc()
{
        handle = dlopen ("./libjpeg.so", RTLD_LAZY | RTLD_GLOBAL);
        printf ("<thread_abc> Handle:%p\n", handle);
        dlclose (handle);
        return NULL;
}

static void *thread_xyz()
{
        handle = dlopen ("./libjpeg.so", RTLD_LAZY | RTLD_GLOBAL);
        printf ("<thread_abc> Handle:%p\n", handle);
        dlclose (handle);
        return NULL;
}

int main()
{
        int i=0;
        handle = dlopen ("./libjpeg.so", RTLD_LAZY | RTLD_GLOBAL);
        printf ("<thread_abc> Handle:%p\n", handle);
        if((error=dlerror()) != NULL)
                printf("error : %s\n", error);
        if(handle==NULL)
                return 0;
        printf ("<thread_abc> Handle:%p\n", handle);
        dlclose (handle);
        printf ("Returning from main\n");
        return 0;
}

-------------------------------------------------

When I check my libjpeg.so with readelf it didn't have any STACK frame

$ mipsel-34kv3r1-linux-gnu-readelf -l libjpeg.so | grep "STACK"
$

Furthermore, I checked that if I removed the patch for BUG 13579, then this issue is not occurring.
Comment 1 Yogesh Gaur 2013-03-22 03:26:18 UTC
Issue fixed.

After applying patch for BUG 13579, I have only replace ld and libc library on my target and thus this was causing issue.

After I have replaced library libpthread.so also, then no issue occurs.