[lxc-devel] [PATCH] remove static_lock()/static_unlock() and start to use thread local storage (v2)

Serge Hallyn serge.hallyn at ubuntu.com
Mon Dec 23 15:25:55 UTC 2013


Quoting Andrey Mazo (mazo at telum.ru):
> Hi all,
> 
> Sorry for coming too late to the discussion.
> In fact, I've already acked [1] the changeset.
> But after sleeping more on it, I'm concerned about __thread and bionic.
> Quoting android-ndk-r9c/docs/text/system/libc/OVERVIEW.text:
>   At the moment, thread-local storage defined through the __thread compiler
>   keyword is not supported by the Bionic C library and dynamic linker.
> 
> The same OVERVIEW.TXT was present until recently in bionic sources [2].
> Moreover, grepping (today's git HEAD) bionic sources for __thread, PT_TLS (thread-local storage segment), .tbss and .tdata section names shows nothing.
> So, while utils.c compiles fine (due to GNU gcc/binutils support for __thread), lxc-* will likely segfault on the first access to the "values" array (because of missing memory segment due to bionic dynamic loader's lack of __thread support).
> I suppose, we could allocate a TLS slot for "values" pointer via pthread_key_create() and set it to a per-thread malloc()'ed memory chunk via pthread_setspecific(). (this seems to be quite verbose though)

Stéphane, have you run lxc with this patch on android without
passing -P (which should get the lxcpath from default values)?


More information about the lxc-devel mailing list