Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: f7caeb8c520f7c911c67e84c011ac6a21ba2fb3fdec7cfd73549285e2a2447b2
Ticket: 1967630fffffffffffffffffffffffffffffffff
tclLoadDl.c dlerror() is not thread safe
User & Date: serhiy.storchaka on 2026-10-25 11:49:46
Changes

  1. foundin changed to: "9.1.0"
  2. icomment:
    Reproduced on NetBSD 10.1 and OpenBSD 7.9, where the dlerror() state is process-wide: a failing [load] concurrent with a successful [load] in another thread gets the other thread's message or NULL, and NULL crashes in Tcl_ObjPrintf(). Linux, FreeBSD and macOS keep it per thread.
    
    Proposed fix in branch [/timeline?r=unix-dlerror-mutex|unix-dlerror-mutex], based on the attached patch: a mutex from dlopen()/dlsym() until dlerror() has been read, and "unknown" for a NULL message. It only covers Tcl's own calls, not dlopen() by other code in the process.
    
  3. login: "serhiy.storchaka"
  4. mimetype: "text/x-fossil-wiki"