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: <20180704163721.lxuynjd4dflcyucm@lakrids.cambridge.arm.com>
Date:   Wed, 4 Jul 2018 17:37:23 +0100
From:   Mark Rutland <mark.rutland@....com>
To:     Will Deacon <will.deacon@....com>
Cc:     linux-kernel@...r.kernel.org, peterz@...radead.org,
        boqun.feng@...il.com, Catalin Marinas <catalin.marinas@....com>
Subject: Re: [PATCHv2 11/11] arm64: use instrumented atomics

On Wed, Jul 04, 2018 at 04:24:22PM +0100, Will Deacon wrote:
> On Mon, Jun 25, 2018 at 11:59:52AM +0100, Mark Rutland wrote:
> > Now that the generic atomic headers provide instrumented wrappers of all
> > the atomics implemented by arm64, let's migrate arm64 over to these.
> > 
> > The additional instrumentation will help to find bugs (e.g. when fuzzing
> > with Syzkaller).
> > 
> > Mostly this change involes adding an arch_ prefix to a number of
> > function names and macro definitions. Due to the way we call the LL/SC
> > atomics via the LSE atomic wrappers, this requires adding an arch_
> > prefix to some arm64-specific atomic primitives.
> > 
> > Some unusual whitespace in the cmpxchg wrappers is fixed up as part of
> > the change.
> > 
> > Signed-off-by: Mark Rutland <mark.rutland@....com>
> > Cc: Catalin Marinas <catalin.marinas@....com>
> > Cc: Will Deacon <will.deacon@....com>
> > ---
> >  arch/arm64/include/asm/atomic.h      | 237 ++++++++++++++++++-----------------
> >  arch/arm64/include/asm/atomic_lse.h  |  51 ++++----
> >  arch/arm64/include/asm/cmpxchg.h     | 106 ++++++++--------
> >  arch/arm64/include/asm/lse.h         |   2 +-
> >  arch/arm64/include/asm/sync_bitops.h |  16 +--
> >  5 files changed, 212 insertions(+), 200 deletions(-)
> 
> This is mostly straightforward, but the cmpxchg/cmpxchg_double cases grow
> an 'arch' prefix which suggests that they're part of the API with the core
> atomics and also makes them horribly ugly.

I agree this isn't nice.

> This just looks to be an artifact of __LL_SC_CALL pasting that in. Can
> you drop that auto pasting of 'arch', and instead change the
> non-cmpxchg-case callers of the macro to include the arch prefix
> instead, please?

That leads to having an arch___llsc_ prefix in some cases, which is
equally hideous.

How about I remove the prefix mangling entirely, and always give
functions an __llsc_ or __lse_ prefix. Then, unify the two in our
atomic.h with:

#ifdef CONFIG_ARM64_LSE
#define ATOMIC_PFX	__lse_
#else
#define ATOMIC_PFX	__ll_sc_
#endif

#define arch_atomic_foo		ATOMIC_PFX##atomic_foo
#define arch_atomic_bar		ATOMIC_PFX##atomic_bar

... which clearly delineates the implementation from core API.

Does that sound ok to you?

Thanks,
Mark.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ