lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-e8968e654191390a1300f0847250353a1c9da30d@git.kernel.org>
Date:	Wed, 13 Jul 2016 00:26:17 -0700
From:	tip-bot for Jiri Olsa <tipbot@...or.com>
To:	linux-tip-commits@...r.kernel.org
Cc:	hpa@...or.com, mingo@...nel.org, a.p.zijlstra@...llo.nl,
	acme@...hat.com, namhyung@...nel.org, dsahern@...il.com,
	linux-kernel@...r.kernel.org, jolsa@...nel.org, tglx@...utronix.de
Subject: [tip:perf/core] perf python: Fix pyrf_evlist__read_on_cpu event
 consuming

Commit-ID:  e8968e654191390a1300f0847250353a1c9da30d
Gitweb:     http://git.kernel.org/tip/e8968e654191390a1300f0847250353a1c9da30d
Author:     Jiri Olsa <jolsa@...nel.org>
AuthorDate: Sun, 10 Jul 2016 13:07:56 +0200
Committer:  Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Tue, 12 Jul 2016 16:16:44 -0300

perf python: Fix pyrf_evlist__read_on_cpu event consuming

We can't consume the event before parsing it. Under heavy load we could
get caught by kernel writer overwriting the event we're trying to parse.

Signed-off-by: Jiri Olsa <jolsa@...nel.org>
Cc: David Ahern <dsahern@...il.com>
Cc: Namhyung Kim <namhyung@...nel.org>
Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Link: http://lkml.kernel.org/r/1468148882-10362-5-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
 tools/perf/util/python.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c
index d0c1267..c68ef03 100644
--- a/tools/perf/util/python.c
+++ b/tools/perf/util/python.c
@@ -865,12 +865,14 @@ static PyObject *pyrf_evlist__read_on_cpu(struct pyrf_evlist *pevlist,
 		PyObject *pyevent = pyrf_event__new(event);
 		struct pyrf_event *pevent = (struct pyrf_event *)pyevent;
 
-		perf_evlist__mmap_consume(evlist, cpu);
-
 		if (pyevent == NULL)
 			return PyErr_NoMemory();
 
 		err = perf_evlist__parse_sample(evlist, event, &pevent->sample);
+
+		/* Consume the even only after we parsed it out. */
+		perf_evlist__mmap_consume(evlist, cpu);
+
 		if (err)
 			return PyErr_Format(PyExc_OSError,
 					    "perf: can't parse sample, err=%d", err);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ