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: <ZxwDCUcyTABN8Exj@slm.duckdns.org>
Date: Fri, 25 Oct 2024 10:43:53 -1000
From: Tejun Heo <tj@...nel.org>
To: David Vernet <void@...ifault.com>
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()

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?

Thanks.

-- 
tejun

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ