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: <20251006102228.GT3245006@noisy.programming.kicks-ass.net>
Date: Mon, 6 Oct 2025 12:22:28 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Arnd Bergmann <arnd@...db.de>
Cc: Finn Thain <fthain@...ux-m68k.org>,
	Geert Uytterhoeven <geert@...ux-m68k.org>,
	Will Deacon <will@...nel.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Boqun Feng <boqun.feng@...il.com>, Jonathan Corbet <corbet@....net>,
	Mark Rutland <mark.rutland@....com>, linux-kernel@...r.kernel.org,
	Linux-Arch <linux-arch@...r.kernel.org>, linux-m68k@...r.kernel.org,
	Lance Yang <lance.yang@...ux.dev>
Subject: Re: [RFC v2 2/3] atomic: Specify alignment for atomic_t and
 atomic64_t

On Mon, Oct 06, 2025 at 12:07:24PM +0200, Arnd Bergmann wrote:

> It looks like Mark Rutland fixed the try_cmpxchg() function this
> way in commit ec570320b09f ("locking/atomic: Correct (cmp)xchg()
> instrumentation"), but for some reason we still have the wrong
> annotation on the atomic_try_cmpxchg() helpers.

> Mark, I've tried to modify your script to produce that output,
> the output looks correct to me, but it makes the script more
> complex than I liked and I'm not sure that matching on
> "${type}"="p" is the best way to check for this.

I don't see anything wrong with this. The result looks good.

> diff --git a/scripts/atomic/gen-atomic-instrumented.sh b/scripts/atomic/gen-atomic-instrumented.sh
> index 592f3ec89b5f..9c1d53f81eb2 100755
> --- a/scripts/atomic/gen-atomic-instrumented.sh
> +++ b/scripts/atomic/gen-atomic-instrumented.sh
> @@ -12,7 +12,7 @@ gen_param_check()
>  	local arg="$1"; shift
>  	local type="${arg%%:*}"
>  	local name="$(gen_param_name "${arg}")"
> -	local rw="write"
> +	local rw="atomic_write"
>  
>  	case "${type#c}" in
>  	i) return;;
> @@ -20,14 +20,17 @@ gen_param_check()
>  
>  	if [ ${type#c} != ${type} ]; then
>  		# We don't write to constant parameters.
> -		rw="read"
> +		rw="atomic_read"
> +	elif [ "${type}" = "p" ] ; then
> +		# The "old" argument in try_cmpxchg() gets accessed non-atomically
> +		rw="read_write"
>  	elif [ "${meta}" != "s" ]; then
>  		# An atomic RMW: if this parameter is not a constant, and this atomic is
>  		# not just a 's'tore, this parameter is both read from and written to.
> -		rw="read_write"
> +		rw="atomic_read_write"
>  	fi
>  
> -	printf "\tinstrument_atomic_${rw}(${name}, sizeof(*${name}));\n"
> +	printf "\tinstrument_${rw}(${name}, sizeof(*${name}));\n"
>  }
>  
>  #gen_params_checks(meta, arg...)
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ