Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1571000
| From | Alexei Starovoitov <alexei.starovoitov@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: crash in perf_event_read |
| Date | 2017-01-31 20:00 +0100 |
| Message-ID | <t5LOO-4b0-27@gated-at.bofh.it> (permalink) |
| References | <t5AJI-6bL-15@gated-at.bofh.it> <t5Ekh-87F-9@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Tue, Jan 31, 2017 at 11:27:10AM +0100, Peter Zijlstra wrote:
> Subject: perf: Fix crash in perf_event_read()
>
> Alexei had his box explode because doing read() on a package
> (rapl/uncore) event that isn't currently scheduled in ends up doing an
> out-of-bounds load.
>
> Rework the code to more explicitly deal with event->oncpu being -1.
>
> Reported-by: Alexei Starovoitov <alexei.starovoitov@gmail.com>
> Cc: David Carrillo-Cisneros <davidcc@google.com>
> Cc: Stephane Eranian <eranian@google.com>
> Fixes: d6a2f9035bfc ("perf/core: Introduce PMU_EV_CAP_READ_ACTIVE_PKG")
> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Thanks for the quick fix!
Everything is clean after several hours.
Tested-by: Alexei Starovoitov <ast@kernel.org>
> /*
> * Purposely ignore the smp_call_function_single() return
> @@ -3702,7 +3706,8 @@ static int perf_event_read(struct perf_event *event, bool group)
> * Therefore, either way, we'll have an up-to-date event count
> * after this.
> */
in that comment above (not shown in this diff) there is a line:
"If event->oncpu isn't a valid CPU it means..."
it doesn't match the code due to merge conflict resolution in 2cc538412a.
Probably makes sense to fix it s/event->oncpu/event_cpu/ as part of this diff.
> - (void)smp_call_function_single(cpu_to_read, __perf_event_read, &data, 1);
> + (void)smp_call_function_single(event_cpu, __perf_event_read, &data, 1);
> + preempt_enable();
> ret = data.ret;
> } else if (event->state == PERF_EVENT_STATE_INACTIVE) {
> struct perf_event_context *ctx = event->ctx;
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
crash in perf_event_read Alexei Starovoitov <alexei.starovoitov@gmail.com> - 2017-01-31 08:10 +0100
Re: crash in perf_event_read Peter Zijlstra <peterz@infradead.org> - 2017-01-31 12:00 +0100
Re: crash in perf_event_read Alexei Starovoitov <alexei.starovoitov@gmail.com> - 2017-01-31 20:00 +0100
Re: crash in perf_event_read David Carrillo-Cisneros <davidcc@google.com> - 2017-02-02 08:50 +0100
[tip:perf/urgent] perf/core: Fix crash in perf_event_read() tip-bot for Peter Zijlstra <tipbot@zytor.com> - 2017-02-10 09:40 +0100
csiph-web