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>] [day] [month] [year] [list]
Message-ID: <20160125130845.GX6357@twins.programming.kicks-ass.net>
Date:	Mon, 25 Jan 2016 14:08:45 +0100
From:	Peter Zijlstra <peterz@...radead.org>
To:	linux-kernel@...r.kernel.org, mingo@...nel.org,
	torvalds@...ux-foundation.org, eranian@...gle.com,
	tglx@...utronix.de, hpa@...or.com, acme@...hat.com,
	dsahern@...il.com, namhyung@...nel.org, vincent.weaver@...ne.edu,
	jolsa@...hat.com
Cc:	alexander.shishkin@...ux.intel.com
Subject: Re: [tip:perf/urgent] perf: Fix perf_event_exit_task() race


---

Subject: perf: Fix orphan hole
From: Peter Zijlstra <peterz@...radead.org>
Date: Fri Jan 22 22:13:41 CET 2016

We should set event->owner before we install the event, otherwise
there is a hole where the target task can fork() and we'll not inherit
the event because it thinks the event is orphaned.

Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
---
 kernel/events/core.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -8489,6 +8489,8 @@ SYSCALL_DEFINE5(perf_event_open,
 	perf_event__header_size(event);
 	perf_event__id_header_size(event);
 
+	event->owner = current;
+
 	perf_install_in_context(ctx, event, event->cpu);
 	perf_unpin_context(ctx);
 
@@ -8498,8 +8500,6 @@ SYSCALL_DEFINE5(perf_event_open,
 
 	put_online_cpus();
 
-	event->owner = current;
-
 	mutex_lock(&current->perf_event_mutex);
 	list_add_tail(&event->owner_entry, &current->perf_event_list);
 	mutex_unlock(&current->perf_event_mutex);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ