[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJZ5v0hvoAD1WLXzpMobTRSasBqy5dypHTysBU3=ionGgWR6nQ@mail.gmail.com>
Date: Fri, 20 Jan 2023 19:10:52 +0100
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Kees Cook <keescook@...omium.org>
Cc: "Rafael J. Wysocki" <rafael@...nel.org>,
Len Brown <lenb@...nel.org>,
Robert Moore <robert.moore@...el.com>,
"Gustavo A. R. Silva" <gustavoars@...nel.org>,
linux-acpi@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-hardening@...r.kernel.org,
acpica-devel@...ts.linuxfoundation.org
Subject: Re: [PATCH] ACPICA: Replace fake flexible arrays with flexible array members
On Sun, Jan 15, 2023 at 7:38 PM Kees Cook <keescook@...omium.org> wrote:
>
> On Fri, Nov 18, 2022 at 10:15:51AM -0800, Kees Cook wrote:
> > Functionally identical to ACPICA upstream pull request 813:
> > https://github.com/acpica/acpica/pull/813
>
> Any update on this? Upstream is currently unbuildable since October.
>
> > One-element arrays (and multi-element arrays being treated as
> > dynamically sized) are deprecated[1] and are being replaced with
> > flexible array members in support of the ongoing efforts to tighten the
> > FORTIFY_SOURCE routines on memcpy(), correctly instrument array indexing
> > with UBSAN_BOUNDS, and to globally enable -fstrict-flex-arrays=3.
> >
> > Replace one-element array with flexible-array member in struct
> > acpi_resource_extended_irq. Replace 4-byte fixed-size array with 4-byte
> > padding in a union with a flexible-array member in struct
> > acpi_pci_routing_table.
> >
> > This results in no differences in binary output.
>
> In the meantime, can you take this patch for Linux, and we can wait for
> ACPICA to catch up?
Applied now (as 6.3 material), sorry for the delay.
Thanks!
> >
> > Cc: "Rafael J. Wysocki" <rafael@...nel.org>
> > Cc: Len Brown <lenb@...nel.org>
> > Cc: Robert Moore <robert.moore@...el.com>
> > Cc: "Gustavo A. R. Silva" <gustavoars@...nel.org>
> > Cc: linux-acpi@...r.kernel.org
> > Cc: devel@...ica.org
> > Signed-off-by: Kees Cook <keescook@...omium.org>
> > ---
> > include/acpi/acrestyp.h | 7 +++++--
> > 1 file changed, 5 insertions(+), 2 deletions(-)
> >
> > diff --git a/include/acpi/acrestyp.h b/include/acpi/acrestyp.h
> > index a7fb8ddb3dc6..ee945084d46e 100644
> > --- a/include/acpi/acrestyp.h
> > +++ b/include/acpi/acrestyp.h
> > @@ -332,7 +332,7 @@ struct acpi_resource_extended_irq {
> > u8 wake_capable;
> > u8 interrupt_count;
> > struct acpi_resource_source resource_source;
> > - u32 interrupts[1];
> > + u32 interrupts[];
> > };
> >
> > struct acpi_resource_generic_register {
> > @@ -679,7 +679,10 @@ struct acpi_pci_routing_table {
> > u32 pin;
> > u64 address; /* here for 64-bit alignment */
> > u32 source_index;
> > - char source[4]; /* pad to 64 bits so sizeof() works in all cases */
> > + union {
> > + char pad[4]; /* pad to 64 bits so sizeof() works in all cases */
> > + DECLARE_FLEX_ARRAY(char, source);
> > + };
> > };
> >
> > #endif /* __ACRESTYP_H__ */
> > --
> > 2.34.1
> >
>
> --
> Kees Cook
Powered by blists - more mailing lists