Re: Improve hackbench

From: Ingo Molnar
Date: Fri Jan 04 2008 - 08:02:03 EST



* Török Edwin <edwintorok@xxxxxxxxx> wrote:

> On x86-64 there's a bug [*], that causes hackbench to segfault when
> compiled with optimizations:
> in reap_worker():
> int status;
> ...
> pthread_join(id, (void **)(void *)&status);
>
> That is not correct, sizeof(void*) > sizeof(int) on x86-64.
> Something gets overwritten on the stack, I tried with gcc
> -fstack-protector, but it doesn't detect it !?
> After applying the patch, it no longer segfaults.
>
> This patch fixes it:
> --- hackbench.c 2008-01-04 10:08:26.000000000 +0200
> +++ ../hackbench.c 2008-01-04 13:45:22.000000000 +0200
> @@ -241,8 +241,10 @@
> wait(&status);
> if (!WIFEXITED(status))
> exit(1);
> - } else
> - pthread_join(id, (void **)(void *)&status);
> + } else {
> + void* status;
> + pthread_join(id, (void **)&status);
> + }
> }

thanks, applied & updated the file.

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/