Re: [PATCH] perf bench: Fix NULL pointer dereference in "perf bench all"

From: Patrick Palka
Date: Thu Mar 13 2014 - 10:48:09 EST


On Thu, Mar 13, 2014 at 10:34 AM, Arnaldo Carvalho de Melo
<acme@xxxxxxxxxxxxxxxxxx> wrote:
> Em Wed, Mar 12, 2014 at 06:40:51PM -0400, Patrick Palka escreveu:
>> for_each_bench() must check that the "benchmarks" field of a collection
>> is not NULL before dereferencing it because the "all" collection in
>> particular has a NULL "benchmarks" field (signifying that it has no
>> benchmarks to iterate over).
>>
>> This fixes a NULL pointer dereference when running "perf bench all".
>
> Can you please mention against which tree you're fixing things? I just
> tried to reproduce it here on perf/urgent and this problem is not
> reproducible by simply running:
>
> perf bench all
>
> So now I'm going to try on perf/core, tip/master, etc :-\

I'm fixing this on top on Linus' tree, which is currently on ac9dc67b7.

Without the patch, the output of "./perf bench all" looks like:

# Running sched/messaging benchmark...
# 20 sender and receiver processes per group
# 10 groups == 400 processes run

Total time: 0.623 [sec]

# Running sched/pipe benchmark...
# Executed 1000000 pipe operations between two processes

Total time: 32.199 [sec]

32.199419 usecs/op
31056 ops/sec

# Running mem/memcpy benchmark...
# Copying 1MB Bytes ...

1.247206 GB/Sec
1.268263 GB/Sec (with prefault)

# Running mem/memset benchmark...
# Copying 1MB Bytes ...

1.429813 GB/Sec
8.418642 GB/Sec (with prefault)

zsh: segmentation fault ./perf bench all


Patrick
--
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/