thread joinable race
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
EPICS Base |
Fix Released
|
Critical
|
mdavidsaver |
Bug Description
https:/
In following up on a strange CI test failure I noticed during the recent codeathon[1]
I realized a mistake I made in adding epicsThreadMust
introduced a reference counter to struct epicsThreadOSD. The bug is in
(conditionally) incrementing the ref counter after pthread_create().
This allows a short-lived thread which attempts to self-join to race for a double free().
And it happens that epicsThreadTest does this.
The fix is I think straight forward [3]. I'm wondering how severe this issue should be considered?
It's a race which can cause a crash at runtime. However, the circumstances seem not so common.
[1] https:/
> Dumping a stack trace of thread '_main_':
> [ 0x7f9a9a027ade]: /home/travis/
> [ 0x7f9a9a017d97]: /home/travis/
> [ 0x7f9a9a023273]: /home/travis/
> [ 0x401b5a]: ./epicsThreadTe
> [ 0x7f9a992d1b97]: /lib/x86_
> [ 0x40168a]: ./epicsThreadTe
Or sometimes locally w/ valgrind
> Process terminating with default action of signal 11 (SIGSEGV)
> Access not within mapped region at address 0x8
> at 0x487C0A7: ellDelete (ellLib.c:81)
> by 0x489B8E5: free_threadInfo (osdThread.c:217)
> by 0x489CF06: epicsThreadMustJoin (osdThread.c:656)
> by 0x10A835: (anonymous namespace)
> by 0x489C463: start_routine (osdThread.c:411)
> by 0x483C8B6: mythread_wrapper (hg_intercepts.
> by 0x4E08FA2: start_thread (pthread_
> by 0x4D394CE: clone (clone.S:95)
Or sometimes locally w/ gdb
> malloc(): unsorted double linked list corrupted
occurring during a subsequent create_threadInfo()
[2] https:/
[3] https:/
Changed in epics-base: | |
status: | In Progress → Fix Committed |
Changed in epics-base: | |
status: | Fix Committed → Fix Released |
Fix for posix committed as 02a24a144d0c062 311212c769926c1 e2df5a1a52. Fix for WIN32 in progress.