forked from pool/glibc
37 lines
1.1 KiB
Diff
37 lines
1.1 KiB
Diff
|
2019-02-15 Florian Weimer <fweimer@redhat.com>
|
||
|
|
||
|
[BZ #24211]
|
||
|
* nptl/pthread_join_common.c (__pthread_timedjoin_ex): Do not read
|
||
|
pd->result after the thread descriptor has been freed.
|
||
|
|
||
|
Index: glibc-2.29/nptl/pthread_join_common.c
|
||
|
===================================================================
|
||
|
--- glibc-2.29.orig/nptl/pthread_join_common.c
|
||
|
+++ glibc-2.29/nptl/pthread_join_common.c
|
||
|
@@ -86,6 +86,7 @@ __pthread_timedjoin_ex (pthread_t thread
|
||
|
pthread_cleanup_pop (0);
|
||
|
}
|
||
|
|
||
|
+ void *pd_result = pd->result;
|
||
|
if (__glibc_likely (result == 0))
|
||
|
{
|
||
|
/* We mark the thread as terminated and as joined. */
|
||
|
@@ -93,7 +94,7 @@ __pthread_timedjoin_ex (pthread_t thread
|
||
|
|
||
|
/* Store the return value if the caller is interested. */
|
||
|
if (thread_return != NULL)
|
||
|
- *thread_return = pd->result;
|
||
|
+ *thread_return = pd_result;
|
||
|
|
||
|
/* Free the TCB. */
|
||
|
__free_tcb (pd);
|
||
|
@@ -101,7 +102,7 @@ __pthread_timedjoin_ex (pthread_t thread
|
||
|
else
|
||
|
pd->joinid = NULL;
|
||
|
|
||
|
- LIBC_PROBE (pthread_join_ret, 3, threadid, result, pd->result);
|
||
|
+ LIBC_PROBE (pthread_join_ret, 3, threadid, result, pd_result);
|
||
|
|
||
|
return result;
|
||
|
}
|