Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sat, 6 Oct 2012 22:39:39 +0200
From: Szabolcs Nagy <nsz@...t70.net>
To: musl@...ts.openwall.com
Subject: Re: TLS (thread-local storage) support

* Szabolcs Nagy <nsz@...t70.net> [2012-10-06 16:33:01 +0200]:
> should the attached code work with dlopen
> when compiled as a dso?
> 
> (i wanted to check if the alignments are ok after a dlopen,
> but i can see how this usage may not be supported)
> 
> it seems it dies here in the ctor

a more minimal example:

a.c:
__thread int xx;
int *p;
__attribute__((constructor)) static void init(void)
{
        p = &xx;
}

b.c:
#include <dlfcn.h>
void *h;
int main()
{
        h = dlopen("./a.so", RTLD_LAZY);
}

compiled as
musl-gcc -shared -fPIC -g -o a.so a.c
musl-gcc -g -o b b.c

./b segfaults in init at p=&xx

Powered by blists - more mailing lists

Your e-mail address:

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.