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]
Date:   Tue, 10 Oct 2017 17:41:39 +0100
From:   Mark Rutland <mark.rutland@....com>
To:     Joe Perches <joe@...ches.com>
Cc:     paulmck@...ux.vnet.ibm.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 13/13] rcutorture: formal: prepare for ACCESS_ONCE()
 removal

On Tue, Oct 10, 2017 at 09:27:54AM -0700, Joe Perches wrote:
> On Tue, 2017-10-10 at 07:52 -0700, Paul E. McKenney wrote:
> > On Tue, Oct 10, 2017 at 01:50:39PM +0100, Mark Rutland wrote:
> > > On Tue, Oct 10, 2017 at 05:47:12AM -0700, Paul E. McKenney wrote:
> > > > On Tue, Oct 10, 2017 at 10:54:14AM +0100, Mark Rutland wrote:
> > > > > On Mon, Oct 09, 2017 at 12:51:12PM -0700, Paul E. McKenney wrote:
> > > > > > On Mon, Oct 09, 2017 at 07:28:50PM +0100, Mark Rutland wrote:
> > > > > > > diff --git a/tools/testing/selftests/rcutorture/formal/srcu-cbmc/src/barriers.h b/tools/testing/selftests/rcutorture/formal/srcu-cbmc/src/barriers.h
> > > > > > > index 6687acc..ee4e4f8 100644
> > > > > > > --- a/tools/testing/selftests/rcutorture/formal/srcu-cbmc/src/barriers.h
> > > > > > > +++ b/tools/testing/selftests/rcutorture/formal/srcu-cbmc/src/barriers.h
> > > > > > > @@ -34,8 +34,9 @@
> > > > > > >  #define rs_smp_mb() do {} while (0)
> > > > > > >  #endif
> > > > > > > 
> > > > > > > -#define ACCESS_ONCE(x) (*(volatile typeof(x) *) &(x))
> > > > > > > -#define READ_ONCE(x) ACCESS_ONCE(x)
> > > > > > > -#define WRITE_ONCE(x, val) (ACCESS_ONCE(x) = (val))
> > > > > > > +#define __ACCESS_ONCE(x) (*(volatile typeof(x) *) &(x))
> > > > > > > +#define ACCESS_ONCE(x) __ACCESS_ONCE(x)
> > > > > > > +#define READ_ONCE(x) __ACCESS_ONCE(x)
> > > > > > > +#define WRITE_ONCE(x, val) (__ACCESS_ONCE(x) = (val))
> > > > > > 
> > > > > > How about something like the following?
> > > > > > 
> > > > > > #define READ_ONCE(x) (*(volatile typeof(x) *) &(x))
> > > > > > #define WRITE_ONCE(x) ((*(volatile typeof(x) *) &(x)) = (val))
> > > > > 
> > > > > Sure; folded in and pushed out. :)
> > > > 
> > > > Thank you!
> > > > 
> > > > > I've assumed that the ACCESS_ONCE() definition needs to be kept until
> > > > > that's ripped out treewide. Please shout if that's not the case!
> > > > 
> > > > You have it right.  This case is an exception because this code is
> > > > used only by RCU, which has long since had ACCESS_ONCE() ripped out.
> > > 
> > > Sorry; I meant that in this case, I leave this code as:
> > > 
> > > #define ACCESS_ONCE(x) (*(volatile typeof(x) *) &(x))
> > > #define READ_ONCE(x) (*(volatile typeof(x) *) &(x))
> > > #define WRITE_ONCE(x) ((*(volatile typeof(x) *) &(x)) = (val))
> > > 
> > > ... if you mean that we can drop ACCESS_ONCE() in this case, then I can
> > > rip that out.
> > 
> > We can drop ACCESS_ONCE() in this case.
> 
> Once ACCESS_ONCE is removed from the code in the tree
> it can also be removed from checkpatch

Sure thing. We're expecting to rip that out with the ACCESS_ONCE
definitions in a post-Coccinelle patch.

If you're happy to give a sign-off for the below, we can drop that into
the post-coccienelle patch/series.

Thanks,
Mark.

> ---
>  scripts/checkpatch.pl | 22 ----------------------
>  1 file changed, 22 deletions(-)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 2a8c6c3c1bdb..440262a87d26 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -6224,28 +6224,6 @@ sub process {
>  			}
>  		}
>  
> -# whine about ACCESS_ONCE
> -		if ($^V && $^V ge 5.10.0 &&
> -		    $line =~ /\bACCESS_ONCE\s*$balanced_parens\s*(=(?!=))?\s*($FuncArg)?/) {
> -			my $par = $1;
> -			my $eq = $2;
> -			my $fun = $3;
> -			$par =~ s/^\(\s*(.*)\s*\)$/$1/;
> -			if (defined($eq)) {
> -				if (WARN("PREFER_WRITE_ONCE",
> -					 "Prefer WRITE_ONCE(<FOO>, <BAR>) over ACCESS_ONCE(<FOO>) = <BAR>\n" . $herecurr) &&
> -				    $fix) {
> -					$fixed[$fixlinenr] =~ s/\bACCESS_ONCE\s*\(\s*\Q$par\E\s*\)\s*$eq\s*\Q$fun\E/WRITE_ONCE($par, $fun)/;
> -				}
> -			} else {
> -				if (WARN("PREFER_READ_ONCE",
> -					 "Prefer READ_ONCE(<FOO>) over ACCESS_ONCE(<FOO>)\n" . $herecurr) &&
> -				    $fix) {
> -					$fixed[$fixlinenr] =~ s/\bACCESS_ONCE\s*\(\s*\Q$par\E\s*\)/READ_ONCE($par)/;
> -				}
> -			}
> -		}
> -
>  # check for mutex_trylock_recursive usage
>  		if ($line =~ /mutex_trylock_recursive/) {
>  			ERROR("LOCKING",
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ