Processed: libc6: "cannot allocate memory in static TLS block" with some library combinations on arm64

2020-07-02 Thread Debian Bug Tracking System
Processing control commands:

> block 960073 by -1
Bug #960073 [python-pyqt5] Package:python-pyqt5 Run the example code with Trace 
and crash (SIGABRT)
960073 was not blocked by any bugs.
960073 was not blocking any bugs.
Added blocking bug(s) of 960073: 964141

-- 
960073: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=960073
964141: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=964141
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems



Bug#964141: libc6: "cannot allocate memory in static TLS block" with some library combinations on arm64

2020-07-02 Thread Dmitry Shachnev
Package: libc6
Version: 2.30-8
Control: block 960073 by -1

Dear glibc maintainers,

Originally I got two reports about issues when loading Qt WebEngine library
from Python using PyQt and PySide bindings, see #960073 and #963709 for
context.

However I can reproduce it without any Python code and even without Qt.

The attached C program tries to load three popular libraries: libsystemd.so.0,
libavformat.so.58 (from ffmpeg) and libglapi.so.0 (from mesa).

When trying to run it on arm64, I get the following:

$ gcc test.c -ldl
$ ./a.out
Failed to load libglapi.so.0: /usr/lib/aarch64-linux-gnu/libglapi.so.0: cannot 
allocate memory in static TLS block

This does not happen on other architectures. This makes me think the amount
of TLS storage on arm64 is too low, can it be somehow increased?

When swapping second and third blocks, it works fine.

Here is an upstream bug report that may be related:
https://sourceware.org/bugzilla/show_bug.cgi?id=25051

And here is patch, currently under review, that may be also related:
https://sourceware.org/pipermail/libc-alpha/2020-May/114247.html

If you think it is a bug not in glibc/dlopen but in one of these libraries,
please let me know.

--
Dmitry Shachnev
#include 
#include 

int main() {
void *systemd_handle, *avformat_handle, *glapi_handle;

systemd_handle = dlopen("libsystemd.so.0", RTLD_LAZY);
if (!systemd_handle) {
printf("Failed to load libsystemd.so.0: %s\n", dlerror());
}

avformat_handle = dlopen("libavformat.so.58", RTLD_LAZY);
if (!avformat_handle) {
printf("Failed to load libavformat.so.58: %s\n", dlerror());
return 1;
}

glapi_handle = dlopen("libglapi.so.0", RTLD_LAZY);
if (!glapi_handle) {
printf("Failed to load libglapi.so.0: %s\n", dlerror());
return 1;
}

dlclose(glapi_handle);
dlclose(avformat_handle);
dlclose(systemd_handle);
return 0;
}


signature.asc
Description: PGP signature