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: <20191028162840.GD5671@hirez.programming.kicks-ass.net>
Date:   Mon, 28 Oct 2019 17:28:40 +0100
From:   Peter Zijlstra <peterz@...radead.org>
To:     Alexander Shishkin <alexander.shishkin@...ux.intel.com>
Cc:     Arnaldo Carvalho de Melo <acme@...hat.com>,
        Ingo Molnar <mingo@...hat.com>, linux-kernel@...r.kernel.org,
        jolsa@...hat.com, adrian.hunter@...el.com,
        mathieu.poirier@...aro.org, mark.rutland@....com
Subject: Re: [PATCH v3 1/3] perf: Allow using AUX data in perf samples

On Mon, Oct 28, 2019 at 05:27:12PM +0100, Peter Zijlstra wrote:
> And while I get why we need recursion protection for pmu::snapshot_aux,
> I'm a little puzzled on why it is over the padding, that is, why isn't
> the whole of aux_in_sampling inside (the newly minted)
> perf_pmu_snapshot_aux() ?

That is, given the previous delta, the below.

---
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -6292,9 +6292,17 @@ long perf_pmu_snapshot_aux(struct perf_e
 	 * IRQs need to be disabled to prevent IPIs from racing with us.
 	 */
 	local_irq_save(flags);
+	/*
+	 * Guard against NMI hits inside the critical section;
+	 * see also perf_prepare_sample_aux().
+	 */
+	WRITE_ONCE(rb->aux_in_sampling, 1);
+	barrier();
 
 	ret = event->pmu->snapshot_aux(event, handle, size);
 
+	barrier();
+	WRITE_ONCE(rb->aux_in_sampling, 0);
 	local_irq_restore(flags);
 
 	return ret;
@@ -6316,13 +6324,6 @@ static void perf_aux_sample_output(struc
 	if (!rb)
 		return;
 
-	/*
-	 * Guard against NMI hits inside the critical section;
-	 * see also perf_prepare_sample_aux().
-	 */
-	WRITE_ONCE(rb->aux_in_sampling, 1);
-	barrier();
-
 	size = perf_pmu_snapshot_aux(sampler, handle, data->aux_size);
 
 	/*
@@ -6348,9 +6349,6 @@ static void perf_aux_sample_output(struc
 	}
 
 out_clear:
-	barrier();
-	WRITE_ONCE(rb->aux_in_sampling, 0);
-
 	ring_buffer_put(rb);
 }
 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ