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-next>] [day] [month] [year] [list]
Message-ID: <1497685332-122353-1-git-send-email-zhouchengming1@huawei.com>
Date:   Sat, 17 Jun 2017 15:42:12 +0800
From:   Zhou Chengming <zhouchengming1@...wei.com>
To:     <mingo@...hat.com>, <peterz@...radead.org>
CC:     <linux-kernel@...r.kernel.org>, <acme@...nel.org>,
        <alexander.shishkin@...ux.intel.com>, <guohanjun@...wei.com>,
        <zhouchengming1@...wei.com>
Subject: [PATCH] perf/core: make sure group events are for the same cpu

The else branch are broken for taskctx: two events can on the same
taskctx, but on different cpu. This patch fix it, we don't need to
check move_group. We first make sure we're on the same task, or both
per-cpu events, and then make sure we're events for the same cpu.

Signed-off-by: Zhou Chengming <zhouchengming1@...wei.com>
---
 kernel/events/core.c | 31 +++++++++++--------------------
 1 file changed, 11 insertions(+), 20 deletions(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index 6c4e523..59270bd 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -10010,28 +10010,19 @@ static int perf_event_set_clock(struct perf_event *event, clockid_t clk_id)
 			goto err_context;
 
 		/*
-		 * Do not allow to attach to a group in a different
-		 * task or CPU context:
+		 * Make sure we're both on the same task, or both
+		 * per-cpu events.
 		 */
-		if (move_group) {
-			/*
-			 * Make sure we're both on the same task, or both
-			 * per-cpu events.
-			 */
-			if (group_leader->ctx->task != ctx->task)
-				goto err_context;
+		if (group_leader->ctx->task != ctx->task)
+			goto err_context;
 
-			/*
-			 * Make sure we're both events for the same CPU;
-			 * grouping events for different CPUs is broken; since
-			 * you can never concurrently schedule them anyhow.
-			 */
-			if (group_leader->cpu != event->cpu)
-				goto err_context;
-		} else {
-			if (group_leader->ctx != ctx)
-				goto err_context;
-		}
+		/*
+		 * Make sure we're both events for the same CPU;
+		 * grouping events for different CPUs is broken; since
+		 * you can never concurrently schedule them anyhow.
+		 */
+		if (group_leader->cpu != event->cpu)
+			goto err_context;
 
 		/*
 		 * Only a group leader can be exclusive or pinned
-- 
1.8.3.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ