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: <CAMj1kXFXimHaGdeDBH3fOzuBiVcATA+JNpGqDs+m5h=8M_g+yA@mail.gmail.com>
Date: Wed, 23 Oct 2024 21:37:36 +0200
From: Ard Biesheuvel <ardb@...nel.org>
To: Dan Carpenter <dan.carpenter@...aro.org>
Cc: Naresh Kamboju <naresh.kamboju@...aro.org>, clang-built-linux <llvm@...ts.linux.dev>, 
	open list <linux-kernel@...r.kernel.org>, lkft-triage@...ts.linaro.org, 
	Linux Regressions <regressions@...ts.linux.dev>, Anders Roxell <anders.roxell@...aro.org>, kobak@...dia.com, 
	"rafael.j.wysocki" <rafael.j.wysocki@...el.com>, rui.zhang@...el.com, mochs@...dia.com, 
	Nathan Chancellor <nathan@...nel.org>
Subject: Re: drivers/acpi/prmt.c:156:29: error: passing 1-byte aligned
 argument to 4-byte aligned parameter 1 of 'efi_pa_va_lookup' may result in an
 unaligned pointer access [-Werror,-Walign-mismatch]

On Wed, 23 Oct 2024 at 21:06, Dan Carpenter <dan.carpenter@...aro.org> wrote:
>
> > Config: https://storage.tuxsuite.com/public/linaro/lkft/builds/2npIm4ZOkWenPJ71UOZG57R0jXE/config
>
> > drivers/acpi/prmt.c:156:29: error: passing 1-byte aligned argument to
> > 4-byte aligned parameter 1 of 'efi_pa_va_lookup' may result in an
> > unaligned pointer access [-Werror,-Walign-mismatch]
> >   156 |                         (void *)efi_pa_va_lookup(&th->guid,
> > handler_info->handler_address);
> >       |                                                  ^
>
> The problem is that efi_guid_t is alighned but guid_t is not.  I would have
> thought that Clang would say that even though the alignment in for &th->guid
> isn't spelled out explicitly, it would still end up being aligned at 8 bytes.
>

Yeah this is bizarre tbh. The alignment of the type should be irrelevant here.

> typedef guid_t efi_guid_t __aligned(__alignof__(u32));
>
> The relevant code looks like this:
>
> include/linux/uuid.h
>     13  #define UUID_SIZE 16
>     14
>     15  typedef struct {
>     16          __u8 b[UUID_SIZE];
>     17  } guid_t;
>
> drivers/acpi/prmt.c
>     54  struct prm_handler_info {
>     55          guid_t guid;

So this should be changed to efi_guid_t.

Doing so makes the following pass:

static_assert(__alignof__(((struct prm_handler_info*)0)->guid) > 1);

(it fails with the original guid_t type)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ