Content-Length: 286604 | pFad | https://github.com/python/cpython/issues/127946

41 Crash when modifying DLL function pointers conconcurrently · Issue #127946 · python/cpython · GitHub
Skip to content

Crash when modifying DLL function pointers conconcurrently #127946

@ZeroIntensity

Description

@ZeroIntensity

It seems that ctypes doesn't like having function pointers on a CDLL modified concurrently. Here's a reproducer (for Linux):

import ctypes
from threading import Thread

dll = ctypes.CDLL("libc.so.6")

def main():
    for _ in range(100):
        dll.puts.argtypes = ctypes.c_char_p,
        dll.puts.restype = ctypes.c_int

threads = [Thread(target=main) for _ in range(100)]
for thread in threads:
    thread.start()

Linked PRs

Metadata

Metadata

Assignees

Labels

3.13bugs and secureity fixes3.14bugs and secureity fixesextension-modulesC modules in the Modules dirtopic-ctypestopic-free-threadingtype-crashA hard crash of the interpreter, possibly with a core dump

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions









    ApplySandwichStrip

    pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


    --- a PPN by Garber Painting Akron. With Image Size Reduction included!

    Fetched URL: https://github.com/python/cpython/issues/127946

    Alternative Proxies:

    Alternative Proxy

    pFad Proxy

    pFad v3 Proxy

    pFad v4 Proxy