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: <CAMuHMdV92Lu646bJ3cmEoR5C4rfkFsaf0E_uYPbSiLwrTtMbTw@mail.gmail.com>
Date: Tue, 16 Sep 2025 12:10:41 +0200
From: Geert Uytterhoeven <geert@...ux-m68k.org>
To: Finn Thain <fthain@...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, 
	John Paul Adrian Glaubitz <glaubitz@...sik.fu-berlin.de>
Subject: Re: [RFC v2 3/3] atomic: Add alignment check to instrumented atomic operations

Hi Finn,

CC Adrian,

On Tue, 16 Sept 2025 at 02:16, Finn Thain <fthain@...ux-m68k.org> wrote:
> On Mon, 15 Sep 2025, Arnd Bergmann wrote:
> > On Mon, Sep 15, 2025, at 12:37, Finn Thain wrote:
> > > On Mon, 15 Sep 2025, Peter Zijlstra wrote:
> > >>
> > >> > When you do atomic operations on atomic_t or atomic64_t, (sizeof(long)
> > >> > - 1) probably doesn't make much sense. But atomic operations get used on
> > >> > scalar types (aside from atomic_t and atomic64_t) that don't have natural
> > >> > alignment. Please refer to the other thread about this:
> > >> > https://lore.kernel.org/all/ed1e0896-fd85-5101-e136-e4a5a37ca5ff@linux-m68k.org/
> > >>
> > >> Perhaps set ARCH_SLAB_MINALIGN ?
> > >
> > > That's not going to help much. The 850 byte offset of task_works into
> > > struct task_struct and the 418 byte offset of exit_state in struct
> > > task_struct are already misaligned.
> >
> > Has there been any progress on building m68k kernels with -mint-align?
>
> Not that I know of.
>
> > IIRC there are only a small number of uapi structures that need
> > __packed annotations to maintain the existing syscall ABI.
>
> Packing uapi structures (and adopting -malign-int) sounds easier than the
> alternative, which might be to align certain internal kernel struct
> members, on a case-by-case basis, where doing so could be shown to improve
> performance on some architecture or other (while keeping -mno-align-int).

indeed.

> Well, it's easy to find all the structs that belong to the uapi, but it's
> not easy to find all the internal kernel structs that describe MMIO
> registers. For -malign-int, both kinds of structs are a problem.

For structures under arch/m68k/include/asm/, just create a single
C file that calculates sizeof() of each structure, and compare the
generated code with and without -malign-int.  Any differences should
be investigated, and attributed when needed.

For structures inside m68k-specific drivers, do something similar inside
those drivers ('git grep "struct\s*[a-zA-Z0-9_]*\s*{"' is your friend).

Most Amiga-specific drivers should be fine, as they were used on APUS
(PowerPC) before.  I guess the same is true for some of the Mac-specific
drivers that are shared with PowerPC.

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ