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] [day] [month] [year] [list]
Message-ID: <7c2c4da1-57f6-23b6-dbff-6288ef3f2a4f@linux-m68k.org>
Date: Wed, 1 Oct 2025 11:46:34 +1000 (AEST)
From: Finn Thain <fthain@...ux-m68k.org>
To: Geert Uytterhoeven <geert@...ux-m68k.org>
cc: Arnd Bergmann <arnd@...db.de>, Peter Zijlstra <peterz@...radead.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 Tue, 30 Sep 2025, Geert Uytterhoeven wrote:

> > To silence the misalignment WARN from CONFIG_DEBUG_ATOMIC, for 64-bit 
> > atomic operations, for my small m68k .config, it was also necesary to 
> > increase ARCH_SLAB_MINALIGN to 8. However, I'm not advocating a
> 
> Probably ARCH_SLAB_MINALIGN should be 4 on m68k.  Somehow I thought that 
> was already the case, but it is __alignof__(unsigned long long) = 2.
> 

I agree -- setting ARCH_SLAB_MINALIGN to 4 would be better style, and may 
avoid surprises in future. Right now that won't have any effect because 
that value gets increased to sizeof(void *) by calculate_alignment() and 
gets increased to ARCH_KMALLOC_MINALIGN or ARCH_DMA_MINALIGN by 
__kmalloc_minalign().

> > ARCH_SLAB_MINALIGN increase, as that wastes memory. I think it might be
> > more useful to limit the alignment test for CONFIG_DEBUG_ATOMIC, as
> > follows.
> 
> Did you check what would be the actual impact of increasing it to 4 or 8?
> 
> > --- a/include/linux/instrumented.h
> > +++ b/include/linux/instrumented.h
> > @@ -68,7 +68,7 @@ static __always_inline void instrument_atomic_read(const volatile void *v, size_
> >  {
> >         kasan_check_read(v, size);
> >         kcsan_check_atomic_read(v, size);
> > -       WARN_ON_ONCE(IS_ENABLED(CONFIG_DEBUG_ATOMIC) && ((unsigned long)v & (size - 1)));
> > +       WARN_ON_ONCE(IS_ENABLED(CONFIG_DEBUG_ATOMIC) && ((unsigned long)v & (size - 1) & 3));
> 
> I'd make that an arch-overridable define instead of hardcoded 3.
> 

How about (sizeof(atomic_long_t) - 1)?

Can you comment on this, Peter?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ