Sourceware Bugzilla – Attachment 9533 Details for
Bug 20116
use after free in pthread_create
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
test app to repro the issue
test_threads.c (text/x-csrc), 1.58 KB, created by
Alexey Makhalov
on 2016-09-28 20:18:32 UTC
(
hide
)
Description:
test app to repro the issue
Filename:
MIME Type:
Creator:
Alexey Makhalov
Created:
2016-09-28 20:18:32 UTC
Size:
1.58 KB
patch
obsolete
>/* > * This program calls pthread_create() in a loop to create > * many detached threads. With glibc 2.22 on Photon OS the program > * sometimes crashes with SIGSEGV in pthread_create(), usually after > * several million threads have been created. > */ > >#include <pthread.h> >#include <stdlib.h> >#include <stdio.h> > >static void * >thread_start(void *arg) >{ > int i; > > for (i=0; i<10; i++) > ; > return NULL; >} > >int >main(int argc, char *argv[]) >{ > int st = 0; > int i = 0; > int count = 10000000; > pthread_attr_t attr; > pthread_t thread_id; > > if (argc > 1) { > count = atoi(argv[1]); > } > > if (count <= 0) { > fprintf(stderr, "Usage: test_threads [count]\n"); > exit(1); > } > > st = pthread_attr_init(&attr); > if (st) { > fprintf(stderr, "pthread_attr_init() failed with error %d\n", st); > exit(1); > } > > st = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); > if (st) { > fprintf(stderr, "pthread_setdetachstate() failed with error %d\n", st); > exit(1); > } > > for (i = 0; i < count; i++) { > if (i > 0 && i % 100000 == 0) { > fprintf(stderr, "."); > } > st = pthread_create(&thread_id, &attr, thread_start, NULL); > if (st) { > fprintf(stderr, "pthread_create() failed with error %d on iteration %d\n", st, i); > exit(1); > } > } > fprintf(stderr, "created %d threads\n", count); > > st = pthread_attr_destroy(&attr); > if (st) { > fprintf(stderr, "pthread_attr_destroy() failed with error %d\n", st); > exit(1); > } > > return 0; >}
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 Raw
Actions:
View
Attachments on
bug 20116
:
9279
| 9533 |
9534