[Bug locale/32483] New: ctype.h macros segfault in multithreaded programs with multiple libc.so

janderson at rice dot edu sourceware-bugzilla@sourceware.org
Thu Dec 19 16:53:53 GMT 2024


https://sourceware.org/bugzilla/show_bug.cgi?id=32483

            Bug ID: 32483
           Summary: ctype.h macros segfault in multithreaded programs with
                    multiple libc.so
           Product: glibc
           Version: 2.41
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: locale
          Assignee: unassigned at sourceware dot org
          Reporter: janderson at rice dot edu
  Target Milestone: ---

Created attachment 15852
  --> https://sourceware.org/bugzilla/attachment.cgi?id=15852&action=edit
Small reproducer

The ctype.h macros (isdigit, isspace, etc.) segfault if called from a secondary
thread (created in the base namespace) and dlmopen'd namespace.

In this scenario `*__ctype_b_loc()` is a zero pointer which causes the
segfault. AFAICT `__ctype_init()` is only called for the base namespace during
`start_thread()`, the dlmopen'd namespace's locale TLS is left
default-initialized to a zero pointer that then gets dereferenced in the
`isdigit()` macro and segfaults.

Reproducer attached.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Glibc-bugs mailing list