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] [day] [month] [year] [list]
Message-ID: <20250619165213.GK794930@e132581.arm.com>
Date: Thu, 19 Jun 2025 17:52:13 +0100
From: Leo Yan <leo.yan@....com>
To: Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...hat.com>,
	Arnaldo Carvalho de Melo <acme@...nel.org>,
	Namhyung Kim <namhyung@...nel.org>,
	Mark Rutland <mark.rutland@....com>,
	Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
	Jiri Olsa <jolsa@...nel.org>, Ian Rogers <irogers@...gle.com>,
	Adrian Hunter <adrian.hunter@...el.com>,
	"Liang, Kan" <kan.liang@...ux.intel.com>,
	Marco Elver <elver@...gle.com>,
	Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
	James Clark <james.clark@...aro.org>,
	linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] perf/aux: Properly launch pending disable flow

Hi Peter, Ingo,

On Mon, Jun 09, 2025 at 01:57:59PM +0100, Leo Yan wrote:
> On Thu, May 22, 2025 at 04:05:10PM +0100, Leo Yan wrote:
> > If an AUX event overruns, the event core layer intends to disable the
> > event by setting the 'pending_disable' flag. Unfortunately, the event
> > is not actually disabled afterwards.

Do you mind to check if this is a valid fix?  Thanks!

Leo.

> > Since commit ca6c21327c6a ("perf: Fix missing SIGTRAPs"), the
> > 'pending_disable' flag was changed to a boolean toggles. However, the
> > AUX event code was not updated accordingly. The flag ends up holding a
> > CPU number. If this number is zero, the flag is taken as false and the
> > IRQ work is never triggered.
> > 
> > Later, with commit 2b84def990d3 ("perf: Split __perf_pending_irq() out
> > of perf_pending_irq()"), a new IRQ work 'pending_disable_irq' was
> > introduced to handle event disabling. The AUX event path was not updated
> > to kick off the work queue.
> > 
> > To fix this issue, when an AUX ring buffer overrun is detected, call
> > perf_event_disable_inatomic() to initiate the pending disable flow.
> > 
> > Fixes: ca6c21327c6a ("perf: Fix missing SIGTRAPs")
> > Fixes: 2b84def990d3 ("perf: Split __perf_pending_irq() out of perf_pending_irq()")
> > Signed-off-by: Leo Yan <leo.yan@....com>
> 
> Gentle ping.  This would be an important fix for AUX trace.
> 
> Thanks,
> Leo
> 
> > ---
> >  kernel/events/ring_buffer.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c
> > index d2aef87c7e9f..aa9a759e824f 100644
> > --- a/kernel/events/ring_buffer.c
> > +++ b/kernel/events/ring_buffer.c
> > @@ -441,7 +441,7 @@ void *perf_aux_output_begin(struct perf_output_handle *handle,
> >  		 * store that will be enabled on successful return
> >  		 */
> >  		if (!handle->size) { /* A, matches D */
> > -			event->pending_disable = smp_processor_id();
> > +			perf_event_disable_inatomic(handle->event);
> >  			perf_output_wakeup(handle);
> >  			WRITE_ONCE(rb->aux_nest, 0);
> >  			goto err_put;
> > @@ -526,7 +526,7 @@ void perf_aux_output_end(struct perf_output_handle *handle, unsigned long size)
> >  
> >  	if (wakeup) {
> >  		if (handle->aux_flags & PERF_AUX_FLAG_TRUNCATED)
> > -			handle->event->pending_disable = smp_processor_id();
> > +			perf_event_disable_inatomic(handle->event);
> >  		perf_output_wakeup(handle);
> >  	}
> >  
> > -- 
> > 2.34.1
> > 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ