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: <20241025204802.GA24112@maniforge>
Date: Fri, 25 Oct 2024 15:48:02 -0500
From: David Vernet <void@...ifault.com>
To: Tejun Heo <tj@...nel.org>
Cc: sched-ext@...a.com, kernel-team@...a.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] scx: Fix raciness in scx_ops_bypass()

On Fri, Oct 25, 2024 at 10:43:53AM -1000, Tejun Heo wrote:
> Hello,
> 
> This looks great overall. One nit below.
> 
> On Fri, Oct 25, 2024 at 03:39:29PM -0500, David Vernet wrote:
> ...
> >  static void scx_ops_bypass(bool bypass)
> >  {
> > -	int depth, cpu;
> > +	int cpu;
> > +	unsigned long flags;
> >  
> > +	raw_spin_lock_irqsave(&__scx_ops_bypass_lock, flags);
> >  	if (bypass) {
> > -		depth = atomic_inc_return(&scx_ops_bypass_depth);
> > -		WARN_ON_ONCE(depth <= 0);
> > -		if (depth != 1)
> > -			return;
> > +		scx_ops_bypass_depth++;
> > +		WARN_ON_ONCE(scx_ops_bypass_depth <= 0);
> > +		if (scx_ops_bypass_depth != 1)
> > +			goto unlock;
> >  	} else {
> > -		depth = atomic_dec_return(&scx_ops_bypass_depth);
> > -		WARN_ON_ONCE(depth < 0);
> > -		if (depth != 0)
> > -			return;
> > +		scx_ops_bypass_depth--;
> > +		WARN_ON_ONCE(scx_ops_bypass_depth < 0);
> > +		if (scx_ops_bypass_depth != 0)
> > +			goto unlock;
> 
> Now that we know irq is disabled in the body, can you also please change
> rq_lock_irqsave() to rq_lock?

Ah good point, will send v3 shortly.

> 
> Thanks.
> 
> -- 
> tejun

Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ