From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
stable@vger.kernel.org, David Ahern <dsahern@gmail.com>,
Jiri Olsa <jolsa@kernel.org>, Kan Liang <kan.liang@intel.com>,
Namhyung Kim <namhyung@kernel.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 4.9 12/25] perf header: Fix handling of PERF_EVENT_UPDATE__SCALE
Date: Thu, 13 Jul 2017 17:40:26 +0200 [thread overview]
Message-ID: <20170713154002.354512800@linuxfoundation.org> (raw)
In-Reply-To: <20170713154001.535209166@linuxfoundation.org>
4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnaldo Carvalho de Melo <acme@redhat.com>
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@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Fixes: daeecbc0c431 ("perf tools: Add event_update event scale type")
Link: http://lkml.kernel.org/n/tip-lukcf9hdj092ax2914ss95at@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
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;
next prev parent reply other threads:[~2017-07-13 15:41 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-13 15:40 [PATCH 4.9 00/25] 4.9.38-stable review Greg Kroah-Hartman
2017-07-13 15:40 ` [PATCH 4.9 01/25] mqueue: fix a use-after-free in sys_mq_notify() Greg Kroah-Hartman
2017-07-13 15:40 ` [PATCH 4.9 02/25] Add "shutdown" to "struct class" Greg Kroah-Hartman
2017-07-13 15:40 ` [PATCH 4.9 03/25] tpm: Issue a TPM2_Shutdown for TPM2 devices Greg Kroah-Hartman
2017-07-13 15:40 ` [PATCH 4.9 04/25] tools include: Add a __fallthrough statement Greg Kroah-Hartman
2017-07-13 15:40 ` [PATCH 4.9 05/25] tools string: Use __fallthrough in perf_atoll() Greg Kroah-Hartman
2017-07-13 15:40 ` [PATCH 4.9 06/25] tools strfilter: Use __fallthrough Greg Kroah-Hartman
2017-07-13 15:40 ` [PATCH 4.9 07/25] perf top: " Greg Kroah-Hartman
2017-07-13 15:40 ` [PATCH 4.9 08/25] perf thread_map: Correctly size buffer used with dirent->dt_name Greg Kroah-Hartman
2017-07-13 15:40 ` [PATCH 4.9 09/25] perf intel-pt: Use __fallthrough Greg Kroah-Hartman
2017-07-13 15:40 ` [PATCH 4.9 10/25] perf tests: Avoid possible truncation with dirent->d_name + snprintf Greg Kroah-Hartman
2017-07-13 15:40 ` [PATCH 4.9 11/25] perf bench numa: Avoid possible truncation when using snprintf() Greg Kroah-Hartman
2017-07-13 15:40 ` Greg Kroah-Hartman [this message]
2017-07-13 15:40 ` [PATCH 4.9 13/25] perf scripting perl: Fix compile error with some perl5 versions Greg Kroah-Hartman
2017-07-13 15:40 ` [PATCH 4.9 14/25] perf probe: Fix to probe on gcc generated symbols for offline kernel Greg Kroah-Hartman
2017-07-13 15:40 ` [PATCH 4.9 15/25] perf probe: Add error checks to offline probe post-processing Greg Kroah-Hartman
2017-07-13 15:40 ` [PATCH 4.9 16/25] md: fix incorrect use of lexx_to_cpu in does_sb_need_changing Greg Kroah-Hartman
2017-07-13 15:40 ` [PATCH 4.9 17/25] md: fix super_offset endianness in super_1_rdev_size_change Greg Kroah-Hartman
2017-07-13 15:40 ` [PATCH 4.9 18/25] locking/rwsem-spinlock: Fix EINTR branch in __down_write_common() Greg Kroah-Hartman
2017-07-13 15:40 ` [PATCH 4.9 19/25] staging: vt6556: vnt_start Fix missing call to vnt_key_init_table Greg Kroah-Hartman
2017-07-13 15:40 ` [PATCH 4.9 20/25] staging: comedi: fix clean-up of comedi_class in comedi_init() Greg Kroah-Hartman
2017-07-13 15:40 ` [PATCH 4.9 23/25] ext4: check return value of kstrtoull correctly in reserved_clusters_store Greg Kroah-Hartman
2017-07-13 15:40 ` [PATCH 4.9 24/25] x86/mm/pat: Dont report PAT on CPUs that dont support it Greg Kroah-Hartman
2017-07-13 15:40 ` [PATCH 4.9 25/25] [media] saa7134: fix warm Medion 7134 EEPROM read Greg Kroah-Hartman
2017-07-13 16:47 ` [PATCH 4.9 00/25] 4.9.38-stable review Sumit Semwal
2017-07-14 1:34 ` Guenter Roeck
[not found] ` <5967dc72.7187df0a.f1fb5.37a1@mx.google.com>
2017-07-14 9:52 ` Greg Kroah-Hartman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170713154002.354512800@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@redhat.com \
--cc=dsahern@gmail.com \
--cc=jolsa@kernel.org \
--cc=kan.liang@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=namhyung@kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox