[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <74ee73d2-04e-ea8-9430-93929446e925@codesourcery.com>
Date: Thu, 11 May 2023 20:53:52 +0000
From: Joseph Myers <joseph@...esourcery.com>
To: Kees Cook <keescook@...omium.org>
CC: Alejandro Colomar <alx.manpages@...il.com>, GCC <gcc@....gnu.org>,
Alejandro Colomar <alx@...nx.com>,
Andrew Clayton <a.clayton@...nx.com>,
Andrew Clayton <andrew@...ital-domain.net>,
<linux-hardening@...r.kernel.org>
Subject: Re: [wish] Flexible array members in unions
On Thu, 11 May 2023, Kees Cook via Gcc wrote:
> On Thu, May 11, 2023 at 06:29:10PM +0200, Alejandro Colomar wrote:
> > On 5/11/23 18:07, Alejandro Colomar wrote:
> > [...]
> > > Would you allow flexible array members in unions? Is there any
> > > strong reason to disallow them?
>
> Yes please!! And alone in a struct, too.
>
> AFAICT, there is no mechanical/architectural reason to disallow them
> (especially since they _can_ be constructed with some fancy tricks,
> and they behave as expected.) My understanding is that it's disallowed
> due to an overly strict reading of the very terse language that created
> flexible arrays in C99.
Standard C has no such thing as a zero-size object or type, which would
lead to problems with a struct or union that only contains a flexible
array member there.
--
Joseph S. Myers
joseph@...esourcery.com
Powered by blists - more mailing lists