Patch "perf header: Fix handling of PERF_EVENT_UPDATE__SCALE" has been added to the 4.9-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    perf header: Fix handling of PERF_EVENT_UPDATE__SCALE

to the 4.9-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     perf-header-fix-handling-of-perf_event_update__scale.patch
and it can be found in the queue-4.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.


>From 8434a2ec13d5c8cb25716950bfbf7c9d7b64628a Mon Sep 17 00:00:00 2001
From: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
Date: Wed, 8 Feb 2017 21:57:22 -0300
Subject: perf header: Fix handling of PERF_EVENT_UPDATE__SCALE

From: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>

commit 8434a2ec13d5c8cb25716950bfbf7c9d7b64628a upstream.

In commit daeecbc0c431 ("perf tools: Add event_update event scale type"), the
handling of PERF_EVENT_UPDATE__SCALE cast struct event_update_event->data to a
pointer to event_update_event_scale, uses some field from this casted struct
and then ends up falling through to the handling of another event type,
PERF_EVENT_UPDATE__CPUS were it casts that ev->data to yet another type, oops,
fix it by inserting the missing break.

Noticed when building perf using gcc 7 on Fedora Rawhide:

  util/header.c: In function 'perf_event__process_event_update':
  util/header.c:3207:16: error: this statement may fall through [-Werror=implicit-fallthrough=]
     evsel->scale = ev_scale->scale;
     ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
  util/header.c:3208:2: note: here
    case PERF_EVENT_UPDATE__CPUS:
    ^~~~

This wasn't noticed because probably PERF_EVENT_UPDATE__CPUS comes after
PERF_EVENT_UPDATE__SCALE, so we would just create a bogus evsel->own_cpus when
processing a PERF_EVENT_UPDATE__SCALE to then leak it and create a new cpu map
with the correct data.

Cc: David Ahern <dsahern@xxxxxxxxx>
Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
Cc: Kan Liang <kan.liang@xxxxxxxxx>
Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
Cc: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
Fixes: daeecbc0c431 ("perf tools: Add event_update event scale type")
Link: http://lkml.kernel.org/n/tip-lukcf9hdj092ax2914ss95at@xxxxxxxxxxxxxx
Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

---
 tools/perf/util/header.c |    1 +
 1 file changed, 1 insertion(+)

--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -3184,6 +3184,7 @@ int perf_event__process_event_update(str
 	case PERF_EVENT_UPDATE__SCALE:
 		ev_scale = (struct event_update_event_scale *) ev->data;
 		evsel->scale = ev_scale->scale;
+		break;
 	case PERF_EVENT_UPDATE__CPUS:
 		ev_cpus = (struct event_update_event_cpus *) ev->data;
 


Patches currently in stable-queue which might be from acme@xxxxxxxxxx are

queue-4.9/perf-thread_map-correctly-size-buffer-used-with-dirent-dt_name.patch
queue-4.9/perf-tests-avoid-possible-truncation-with-dirent-d_name-snprintf.patch
queue-4.9/perf-top-use-__fallthrough.patch
queue-4.9/perf-scripting-perl-fix-compile-error-with-some-perl5-versions.patch
queue-4.9/perf-bench-numa-avoid-possible-truncation-when-using-snprintf.patch
queue-4.9/perf-probe-add-error-checks-to-offline-probe-post-processing.patch
queue-4.9/perf-header-fix-handling-of-perf_event_update__scale.patch
queue-4.9/tools-string-use-__fallthrough-in-perf_atoll.patch
queue-4.9/perf-intel-pt-use-__fallthrough.patch
queue-4.9/tools-include-add-a-__fallthrough-statement.patch
queue-4.9/tools-strfilter-use-__fallthrough.patch
queue-4.9/perf-probe-fix-to-probe-on-gcc-generated-symbols-for-offline-kernel.patch



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]