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-71e7bc2bab77e64882c031c2af943c3256c1adb0@git.kernel.org>
Date:	Thu, 18 Aug 2016 03:52:34 -0700
From:	tip-bot for David Carrillo-Cisneros <tipbot@...or.com>
To:	linux-tip-commits@...r.kernel.org
Cc:	davidcc@...gle.com, mingo@...nel.org, vincent.weaver@...ne.edu,
	eranian@...gle.com, tglx@...utronix.de,
	alexander.shishkin@...ux.intel.com, linux-kernel@...r.kernel.org,
	jolsa@...hat.com, torvalds@...ux-foundation.org,
	vegard.nossum@...il.com, kan.liang@...el.com, pjt@...gle.com,
	acme@...hat.com, peterz@...radead.org, hpa@...or.com
Subject: [tip:perf/core] perf/core: Check return value of the
 perf_event_read() IPI

Commit-ID:  71e7bc2bab77e64882c031c2af943c3256c1adb0
Gitweb:     http://git.kernel.org/tip/71e7bc2bab77e64882c031c2af943c3256c1adb0
Author:     David Carrillo-Cisneros <davidcc@...gle.com>
AuthorDate: Wed, 17 Aug 2016 13:55:04 -0700
Committer:  Ingo Molnar <mingo@...nel.org>
CommitDate: Thu, 18 Aug 2016 10:35:52 +0200

perf/core: Check return value of the perf_event_read() IPI

The call to smp_call_function_single in perf_event_read() may fail if
an invalid or not online CPU index is passed. Warn user if such bug is
present and return error.

Signed-off-by: David Carrillo-Cisneros <davidcc@...gle.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
Cc: Alexander Shishkin <alexander.shishkin@...ux.intel.com>
Cc: Arnaldo Carvalho de Melo <acme@...hat.com>
Cc: Jiri Olsa <jolsa@...hat.com>
Cc: Kan Liang <kan.liang@...el.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Paul Turner <pjt@...gle.com>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Stephane Eranian <eranian@...gle.com>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: Vegard Nossum <vegard.nossum@...il.com>
Cc: Vince Weaver <vincent.weaver@...ne.edu>
Link: http://lkml.kernel.org/r/1471467307-61171-2-git-send-email-davidcc@google.com
Signed-off-by: Ingo Molnar <mingo@...nel.org>
---
 kernel/events/core.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index a5fc5c8..5650f53 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -3549,9 +3549,10 @@ static int perf_event_read(struct perf_event *event, bool group)
 			.group = group,
 			.ret = 0,
 		};
-		smp_call_function_single(event->oncpu,
-					 __perf_event_read, &data, 1);
-		ret = data.ret;
+		ret = smp_call_function_single(event->oncpu, __perf_event_read, &data, 1);
+		/* The event must have been read from an online CPU: */
+		WARN_ON_ONCE(ret);
+		ret = ret ? : data.ret;
 	} else if (event->state == PERF_EVENT_STATE_INACTIVE) {
 		struct perf_event_context *ctx = event->ctx;
 		unsigned long flags;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ