FreeBSD Bugzilla – Attachment 156674 Details for
Bug 200138
[PATCH] Fixed per-thread 'specific' array allocation conflict incurred in libthr by some foreign malloc libraries
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
patch
libthr-fix-race-condition-with-advanced-malloc-libraries.patch (text/plain), 1.04 KB, created by
Yuri Victorovich
on 2015-05-12 02:08:54 UTC
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Yuri Victorovich
Created:
2015-05-12 02:08:54 UTC
Size:
1.04 KB
patch
obsolete
>Index: lib/libthr/thread/thr_spec.c >=================================================================== >--- lib/libthr/thread/thr_spec.c (revision 282798) >+++ lib/libthr/thread/thr_spec.c (working copy) >@@ -169,13 +169,18 @@ > } > > static inline struct pthread_specific_elem * >-pthread_key_allocate_data(void) >+pthread_key_allocate_data(struct pthread *pthread) > { > struct pthread_specific_elem *new_data; > > new_data = (struct pthread_specific_elem *) > calloc(1, sizeof(struct pthread_specific_elem) * PTHREAD_KEYS_MAX); >- return (new_data); >+ if (!pthread->specific) >+ pthread->specific = new_data; >+ else /* some malloc libraries may call pthread_setspecific themselves */ >+ free(new_data); >+ >+ return (pthread->specific); > } > > int >@@ -189,7 +194,7 @@ > pthread = _get_curthread(); > > if ((pthread->specific) || >- (pthread->specific = pthread_key_allocate_data())) { >+ (pthread_key_allocate_data(pthread))) { > if ((unsigned int)key < PTHREAD_KEYS_MAX) { > if (_thread_keytable[key].allocated) { > if (pthread->specific[key].data == NULL) {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 200138
: 156674 |
156695
|
156696