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: <CAMuHMdXg=0Q9e1O6W0Gp+fPoP8-5VQ-2fGGg54w=seaqF9H8PQ@mail.gmail.com>
Date: Mon, 1 Sep 2025 10:48:42 +0200
From: Geert Uytterhoeven <geert@...ux-m68k.org>
To: David Laight <david.laight.linux@...il.com>
Cc: Lance Yang <lance.yang@...ux.dev>, Finn Thain <fthain@...ux-m68k.org>, 
	akpm@...ux-foundation.org, linux-kernel@...r.kernel.org, mhiramat@...nel.org, 
	oak@...sinkinet.fi, peterz@...radead.org, stable@...r.kernel.org, 
	will@...nel.org, Lance Yang <ioworker0@...il.com>
Subject: Re: [PATCH] atomic: Specify natural alignment for atomic_t

Hi David,

On Mon, 25 Aug 2025 at 14:07, David Laight <david.laight.linux@...il.com> wrote:
> On Mon, 25 Aug 2025 15:46:42 +0800
> Lance Yang <lance.yang@...ux.dev> wrote:
> > On 2025/8/25 14:17, Finn Thain wrote:
> > > On Mon, 25 Aug 2025, Lance Yang wrote:
> > >> What if we squash the runtime check fix into your patch?
> > >
> > > Did my patch not solve the problem?
> >
> > Hmm... it should solve the problem for natural alignment, which is a
> > critical fix.
> >
> > But it cannot solve the problem of forced misalignment from drivers using
> > #pragma pack(1). The runtime warning will still trigger in those cases.
> >
> > I built a simple test module on a kernel with your patch applied:
> >
> > ```
> > #include <linux/module.h>
> > #include <linux/init.h>
> >
> > struct __attribute__((packed)) test_container {
> >      char padding[49];
> >      struct mutex io_lock;
> > };
> >
> > static int __init alignment_init(void)
> > {
> >      struct test_container cont;
> >      pr_info("io_lock address offset mod 4: %lu\n", (unsigned long)&cont.io_lock % 4);
>
> Doesn't that give a compilation warning from 'taking the address of a packed member'?
> Ignore that at your peril.
>
> More problematic is that, IIRC, m68k kmalloc() allocates 16bit aligned memory.
> This has broken other things in the past.

Really? AFAIK it always returns memory that is at least aligned to the
cache line size (i.e. 16 bytes on m68k). So perhaps you are confusing
"16bit" with "16byte"?

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