[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

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



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 <dlfcn.h>
#include <stdio.h>

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;
}

Attachment: signature.asc
Description: PGP signature


Reply to: