This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author tjollans
Recipients tjollans, xxm
Date 2021-06-04.18:13:40
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1622830421.14.0.729514664287.issue43740@roundup.psfhosted.org>
In-reply-to
Content
I cannot reproduce this on my OpenSUSE (glibc 2.33, Linux 5.12.4) or Ubuntu 20.04 (glibc 2.31, Linux 5.4.0) machines, but I can reproduce it on an old Debian Stretch VM I happened to have lying around (glibc 2.24, Linux 4.9.0). (FreeBSD 12.2 and Windows 10 also fine.)

This doesn't look like a bug in Python, but like a bug in glibc (and Apple's libc?) (or Linux?) that is fixed in current versions.

This C program produces the same result - segfault on old Linux, error message on new Linux.

#include <stdio.h>
#include <dlfcn.h>
#include <stdlib.h>
#include <string.h>

static const char *FRAGMENT =  "abs/";
#define REPEATS 10000000

int main()
{
        size_t fragment_len = strlen(FRAGMENT);
        size_t len = fragment_len * REPEATS;
        char *name = malloc(len + 1);
        name[len] = '\0';
        for (char *p = name; p < name + len; p += fragment_len) {
                memcpy(p, FRAGMENT, fragment_len);
        }
        
        void *handle = dlopen(name, RTLD_LAZY);
        if (handle == NULL) {
                printf("Failed:\n%s\n", dlerror());
                free(name);
                return 1;
        } else {
                printf("Success.");
                dlclose(handle);
                free(name);
                return 0;
        }
}
History
Date User Action Args
2021-06-04 18:13:41tjollanssetrecipients: + tjollans, xxm
2021-06-04 18:13:41tjollanssetmessageid: <1622830421.14.0.729514664287.issue43740@roundup.psfhosted.org>
2021-06-04 18:13:41tjollanslinkissue43740 messages
2021-06-04 18:13:40tjollanscreate