[PATCH 4.9 60/60] perf/core: Fix crash in perf_event_read()

2017-02-13 Thread Greg Kroah-Hartman
4.9-stable review patch. If anyone has any objections, please let me know. -- From: Peter Zijlstra commit 451d24d1e5f40bad000fa9abe36ddb16fc9928cb upstream. Alexei had his box explode because doing read() on a package (rapl/uncore) event that isn't

[PATCH 4.9 60/60] perf/core: Fix crash in perf_event_read()

2017-02-13 Thread Greg Kroah-Hartman
4.9-stable review patch. If anyone has any objections, please let me know. -- From: Peter Zijlstra commit 451d24d1e5f40bad000fa9abe36ddb16fc9928cb upstream. Alexei had his box explode because doing read() on a package (rapl/uncore) event that isn't currently scheduled in ends

[tip:perf/urgent] perf/core: Fix crash in perf_event_read()

2017-02-10 Thread tip-bot for Peter Zijlstra
10 Feb 2017 09:04:50 +0100 perf/core: 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. Repo

[tip:perf/urgent] perf/core: Fix crash in perf_event_read()

2017-02-10 Thread tip-bot for Peter Zijlstra
Commit-ID: 451d24d1e5f40bad000fa9abe36ddb16fc9928cb Gitweb: http://git.kernel.org/tip/451d24d1e5f40bad000fa9abe36ddb16fc9928cb Author: Peter Zijlstra AuthorDate: Tue, 31 Jan 2017 11:27:10 +0100 Committer: Ingo Molnar CommitDate: Fri, 10 Feb 2017 09:04:50 +0100 perf/core: Fix crash

Re: crash in perf_event_read

2017-02-01 Thread David Carrillo-Cisneros
t; >> which is this C code: >> perf_event_read(): >> local_cpu = get_cpu(); >> cpu_to_read = find_cpu_to_read(event, local_cpu); >> put_cpu(); >> >> find_cpu_to_read(): >> event_pkg = topology_physical_package_id(event_cpu); >> local_pkg

Re: crash in perf_event_read

2017-02-01 Thread David Carrillo-Cisneros
): >> local_cpu = get_cpu(); >> cpu_to_read = find_cpu_to_read(event, local_cpu); >> put_cpu(); >> >> find_cpu_to_read(): >> event_pkg = topology_physical_package_id(event_cpu); >> local_pkg = topology_physical_package_id(local_cpu); >> if

Re: crash in perf_event_read

2017-01-31 Thread Alexei Starovoitov
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. >

Re: crash in perf_event_read

2017-01-31 Thread Alexei Starovoitov
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. >

Re: crash in perf_event_read

2017-01-31 Thread Peter Zijlstra
== RDI == ffff > or in other words event->oncpu == -1 > which I think is technically possible here. > > Any suggestions how to fix this? > Happy to test any patches, though I don't know how to reproduce reliably. Right you are, that's buggered. Something like the be

Re: crash in perf_event_read

2017-01-31 Thread Peter Zijlstra
pu(); > > find_cpu_to_read(): > event_pkg = topology_physical_package_id(event_cpu); > local_pkg = topology_physical_package_id(local_cpu); > if (event_pkg == local_pkg) > > If I read the asm correctly at the time of the crash > event_cpu == RDI == 00

crash in perf_event_read

2017-01-30 Thread Alexei Starovoitov
Hi Peter, rarely I'm seeing the following crash: [40196.164255] BUG: unable to handle kernel paging request at a11a [40196.179636] IP: perf_event_read+0xd3/0x1a0 [40196.188669] PGD 82e93a067 [40196.188670] PUD 7e1ddf067 [40196.194629] PMD 0 [40196.200589] [40196.208284] Oops:

crash in perf_event_read

2017-01-30 Thread Alexei Starovoitov
Hi Peter, rarely I'm seeing the following crash: [40196.164255] BUG: unable to handle kernel paging request at a11a [40196.179636] IP: perf_event_read+0xd3/0x1a0 [40196.188669] PGD 82e93a067 [40196.188670] PUD 7e1ddf067 [40196.194629] PMD 0 [40196.200589] [40196.208284] Oops: