Current-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: rbtree problems in libpthread
M.Drochner%fz-juelich.de@localhost said:
> more creative finding malloc() sizes
Well, not creative but some fuzzing can be helpful.
Here is a version which should be helpful to trigger
the bug under varying conditions. With the "seed"
from time(0) I'm getting errors in one of 5..10 tries.
If people try this in their systems we can collect
a list of working seed values which we can put into
a regression test then.
(The bug is fixed in pthread.c rev. 1.109, so the
test systems must be from before that change.)
best regards
Matthias
-------------------------------------------------------------------
-------------------------------------------------------------------
Forschungszentrum Juelich GmbH
52425 Juelich
Sitz der Gesellschaft: Juelich
Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498
Vorsitzende des Aufsichtsrats: MinDir'in Baerbel Brumme-Bothe
Geschaeftsfuehrung: Prof. Dr. Achim Bachem (Vorsitzender),
Dr. Ulrich Krafft (stellv. Vorsitzender), Prof. Dr. Harald Bolt,
Dr. Sebastian M. Schmidt
-------------------------------------------------------------------
-------------------------------------------------------------------
#include <err.h>
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
static void *
f(void *arg)
{
sleep(1000);
return 0;
}
#define NUM 100
int
main(int argc, char *argv[])
{
pthread_t thr[NUM];
int seed, i, j, res, errors;
char nam[20];
#if 1
seed = 1238601465;
#else
seed = time(0);
#endif
srandom(seed);
errors = 0;
for (i = 0; i < NUM; i++) {
res = pthread_create(&thr[i], 0, f, 0);
if (res)
err(1, "pthread_create");
for (j = 0; j <= i; j++) {
res = pthread_getname_np(thr[j], nam, sizeof(nam));
if (res) {
printf("getname(%d/%d): %s\n", i, j,
strerror(res));
errors++;
}
}
if (errors)
break;
if (!(i % 7))
malloc(random() & 0xffffff);
}
if (errors) {
printf("%d errors\n", errors);
#if 0
printf("seed was %d\n");
#endif
}
return 0;
}
Home |
Main Index |
Thread Index |
Old Index