Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: rbtree problems in libpthread 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

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)

        return 0;

#define NUM 100
main(int argc, char *argv[])
        pthread_t thr[NUM];
        int seed, i, j, res, errors;
        char nam[20];

#if 1
        seed = 1238601465;
        seed = time(0);

        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,
                if (errors)
                if (!(i % 7))
                        malloc(random() & 0xffffff);
        if (errors) {
                printf("%d errors\n", errors);
#if 0
                printf("seed was %d\n");
        return 0;

Home | Main Index | Thread Index | Old Index