[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 16:14:41 UTC 2013


Quoting Stéphane Graber (stgraber at ubuntu.com):
> On Mon, Dec 23, 2013 at 09:25:55AM -0600, Serge Hallyn wrote:
> > 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)?
> 
> I'm unfortunately 7000km away from my LXC on Android hardware and will
> only be able to test it on the 3rd of January.

Should we revert the patch with a note to test on android on jan 4th?


More information about the lxc-devel mailing list