[SRU][Artful][Bionic][PATCH 0/1] powerpc/perf: Fix oops when grouping different pmu events

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[SRU][Artful][Bionic][PATCH 0/1] powerpc/perf: Fix oops when grouping different pmu events

Joseph Salisbury-3
BugLink: http://bugs.launchpad.net/bugs/1746225

== SRU Justification ==
Due to this bug, perf fuzzer resulted in crash and system goes for a reboot
and results in a call trace shown in the bug.  It is due to grouping of
different PMU events, which is fixed by mainline commit 5aa04b3eb6fca63d2e9827be656dcadc26d54e1
 
Commit 5aa04b3eb6fca63d2e9827be656dcadc26d54e11 is in mailine as of v4.15-rc5.
   

== Fix ==
commit 5aa04b3eb6fca63d2e9827be656dcadc26d54e11
Author: Ravi Bangoria <[hidden email]>
Date:   Thu Nov 30 14:03:22 2017 +0530

    powerpc/perf: Fix oops when grouping different pmu events


== Regression Potential ==
Low.  This fix is specific to powerpc.

== Test Case ==
A test kernel was built with this patch and tested by the original bug reporter.
The bug reporter states the test kernel resolved the bug.


Ravi Bangoria (1):
  powerpc/perf: Fix oops when grouping different pmu events

 arch/powerpc/perf/core-book3s.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--
2.7.4


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

[SRU][Artful][Bionic][PATCH 1/1] powerpc/perf: Fix oops when grouping different pmu events

Joseph Salisbury-3
From: Ravi Bangoria <[hidden email]>

BugLink: http://bugs.launchpad.net/bugs/1746225

When user tries to group imc (In-Memory Collections) event with
normal event, (sometime) kernel crashes with following log:

    Faulting instruction address: 0x00000000
    [link register   ] c00000000010ce88 power_check_constraints+0x128/0x980
    ...
    c00000000010e238 power_pmu_event_init+0x268/0x6f0
    c0000000002dc60c perf_try_init_event+0xdc/0x1a0
    c0000000002dce88 perf_event_alloc+0x7b8/0xac0
    c0000000002e92e0 SyS_perf_event_open+0x530/0xda0
    c00000000000b004 system_call+0x38/0xe0

'event_base' field of 'struct hw_perf_event' is used as flags for
normal hw events and used as memory address for imc events. While
grouping these two types of events, collect_events() tries to
interpret imc 'event_base' as a flag, which causes a corruption
resulting in a crash.

Consider only those events which belongs to 'perf_hw_context' in
collect_events().

Signed-off-by: Ravi Bangoria <[hidden email]>
Reviewed-By: Madhavan Srinivasan <[hidden email]>
Signed-off-by: Michael Ellerman <[hidden email]>
(cherry picked from commit 5aa04b3eb6fca63d2e9827be656dcadc26d54e11)
Signed-off-by: Joseph Salisbury <[hidden email]>
---
 arch/powerpc/perf/core-book3s.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c
index 6c2d416..61140e0 100644
--- a/arch/powerpc/perf/core-book3s.c
+++ b/arch/powerpc/perf/core-book3s.c
@@ -1410,7 +1410,7 @@ static int collect_events(struct perf_event *group, int max_count,
  int n = 0;
  struct perf_event *event;
 
- if (!is_software_event(group)) {
+ if (group->pmu->task_ctx_nr == perf_hw_context) {
  if (n >= max_count)
  return -1;
  ctrs[n] = group;
@@ -1418,7 +1418,7 @@ static int collect_events(struct perf_event *group, int max_count,
  events[n++] = group->hw.config;
  }
  list_for_each_entry(event, &group->sibling_list, group_entry) {
- if (!is_software_event(event) &&
+ if (event->pmu->task_ctx_nr == perf_hw_context &&
     event->state != PERF_EVENT_STATE_OFF) {
  if (n >= max_count)
  return -1;
--
2.7.4


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

ACK / APPLIED[B]: [SRU][Artful][Bionic][PATCH 0/1] powerpc/perf: Fix oops when grouping different pmu events

Seth Forshee
In reply to this post by Joseph Salisbury-3
On Fri, Feb 02, 2018 at 03:50:13PM -0500, Joseph Salisbury wrote:

> BugLink: http://bugs.launchpad.net/bugs/1746225
>
> == SRU Justification ==
> Due to this bug, perf fuzzer resulted in crash and system goes for a reboot
> and results in a call trace shown in the bug.  It is due to grouping of
> different PMU events, which is fixed by mainline commit 5aa04b3eb6fca63d2e9827be656dcadc26d54e1
>  
> Commit 5aa04b3eb6fca63d2e9827be656dcadc26d54e11 is in mailine as of v4.15-rc5.
>    
>
> == Fix ==
> commit 5aa04b3eb6fca63d2e9827be656dcadc26d54e11
> Author: Ravi Bangoria <[hidden email]>
> Date:   Thu Nov 30 14:03:22 2017 +0530
>
>     powerpc/perf: Fix oops when grouping different pmu events
>
>
> == Regression Potential ==
> Low.  This fix is specific to powerpc.
>
> == Test Case ==
> A test kernel was built with this patch and tested by the original bug reporter.
> The bug reporter states the test kernel resolved the bug.

Limited scope, positive testing.

Acked-by: Seth Forshee <[hidden email]>

Applied to bionic/master-next, thanks!

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

Re: [SRU][Artful][Bionic][PATCH 0/1] powerpc/perf: Fix oops when grouping different pmu events

Joseph Salisbury-3
In reply to this post by Joseph Salisbury-3
On 02/02/2018 03:50 PM, Joseph Salisbury wrote:

> BugLink: http://bugs.launchpad.net/bugs/1746225
>
> == SRU Justification ==
> Due to this bug, perf fuzzer resulted in crash and system goes for a reboot
> and results in a call trace shown in the bug.  It is due to grouping of
> different PMU events, which is fixed by mainline commit 5aa04b3eb6fca63d2e9827be656dcadc26d54e1
>  
> Commit 5aa04b3eb6fca63d2e9827be656dcadc26d54e11 is in mailine as of v4.15-rc5.
>    
>
> == Fix ==
> commit 5aa04b3eb6fca63d2e9827be656dcadc26d54e11
> Author: Ravi Bangoria <[hidden email]>
> Date:   Thu Nov 30 14:03:22 2017 +0530
>
>     powerpc/perf: Fix oops when grouping different pmu events
>
>
> == Regression Potential ==
> Low.  This fix is specific to powerpc.
>
> == Test Case ==
> A test kernel was built with this patch and tested by the original bug reporter.
> The bug reporter states the test kernel resolved the bug.
>
>
> Ravi Bangoria (1):
>   powerpc/perf: Fix oops when grouping different pmu events
>
>  arch/powerpc/perf/core-book3s.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
If anyone has time, looking to get a second ack for Artful.


Thanks,


Joe



--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

ACK: [SRU][Artful][Bionic][PATCH 0/1] powerpc/perf: Fix oops when grouping different pmu events

Kleber Souza
In reply to this post by Joseph Salisbury-3
On 02/02/18 21:50, Joseph Salisbury wrote:

> BugLink: http://bugs.launchpad.net/bugs/1746225
>
> == SRU Justification ==
> Due to this bug, perf fuzzer resulted in crash and system goes for a reboot
> and results in a call trace shown in the bug.  It is due to grouping of
> different PMU events, which is fixed by mainline commit 5aa04b3eb6fca63d2e9827be656dcadc26d54e1
>  
> Commit 5aa04b3eb6fca63d2e9827be656dcadc26d54e11 is in mailine as of v4.15-rc5.
>    
>
> == Fix ==
> commit 5aa04b3eb6fca63d2e9827be656dcadc26d54e11
> Author: Ravi Bangoria <[hidden email]>
> Date:   Thu Nov 30 14:03:22 2017 +0530
>
>     powerpc/perf: Fix oops when grouping different pmu events
>
>
> == Regression Potential ==
> Low.  This fix is specific to powerpc.
>
> == Test Case ==
> A test kernel was built with this patch and tested by the original bug reporter.
> The bug reporter states the test kernel resolved the bug.
>
>
> Ravi Bangoria (1):
>   powerpc/perf: Fix oops when grouping different pmu events
>
>  arch/powerpc/perf/core-book3s.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>

Acked-by: Kleber Sacilotto de Souza <[hidden email]>

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team