Re: perf: easily crash kernel with rapl event close
From: Vince Weaver
Date: Thu Jan 22 2015 - 13:19:16 EST
On Thu, 22 Jan 2015, Stephane Eranian wrote:
> Fix looks like this:
>
> diff --git a/arch/x86/kernel/cpu/perf_event_intel_rapl.c
> b/arch/x86/kernel/cpu/perf_event_intel_rapl.c
> index 6e434f8..c4bb8b8 100644
> --- a/arch/x86/kernel/cpu/perf_event_intel_rapl.c
> +++ b/arch/x86/kernel/cpu/perf_event_intel_rapl.c
> @@ -142,7 +142,7 @@ static inline u64 rapl_scale(u64 v)
> * or use ldexp(count, -32).
> * Watts = Joules/Time delta
> */
> - return v << (32 - __this_cpu_read(rapl_pmu->hw_unit));
> + return v << (32 - __this_cpu_read(rapl_pmu)->hw_unit);
> }
>
>
> Will post the patch shortly.
> Thanks Vince for reporting this issue.
Well that's obviously a classic misplaced-parenthesis bug, but I patched
and re-ran my tests anyway to make sure this really fixed things.
(It did). So in case it is useful:
Tested-by: Vince Weaver <vincent.weaver@xxxxxxxxx>
--
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/