[Issue 18063] New: thread_attachThis returns dangling pointer

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Dec 11 11:05:42 UTC 2017


https://issues.dlang.org/show_bug.cgi?id=18063

          Issue ID: 18063
           Summary: thread_attachThis returns dangling pointer
           Product: D
           Version: D2
          Hardware: x86_64
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: druntime
          Assignee: nobody at puremagic.com
          Reporter: acehreli at yahoo.com

thread_detachThis fails to reset the thread-local sm_this pointer; so,
thread_attachThis hands out a stale one.

The following call sequence from a non-D thread is sufficient to reproduce the
issue:

    thread_attachThis();
    thread_detachThis();
    thread_attachThis();

Although, the effects of the undefined behavior shows up after exercising the
GC.

Pull request including a test program is coming shortly...

--


More information about the Digitalmars-d-bugs mailing list