Can TLS be implemented switching from MAP_SHARED to MAP_PRIVATE a page reserved for TLS variables ??

Florian Weimer fweimer@redhat.com
Tue Apr 7 09:11:12 GMT 2020


* William Tambe via Libc-help:

> Can TLS be implemented switching from MAP_SHARED to MAP_PRIVATE a page
> reserved for TLS variables ?

Backing storage for some TLS variables will still be allocated using
malloc, so this has only limited effect in any case.

> Switching such a page from MAP_SHARED to MAP_PRIVATE would effectively
> make it local to that thread.

NPTL depends on the TCB be accessible across different threads, so this
is not possible.

C makes cross-thread access implementation-defined, but I expect that
quite a few programs expect it to work, so you may have to support is an
extension.

Thanks,
Florian



More information about the Libc-help mailing list