[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a9f2739c-7582-853e-ea94-e13f5ea4698@codesourcery.com>
Date: Thu, 11 May 2023 22:52:25 +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:
> Okay, understood. If this is a C-only thing, we can ignore the C++
> impact.
We're a lot more careful lately in WG14 about checking for C++
compatibility issues and expecting approval from the liaison group for
anything with possible compatibility concerns for syntax in the common
subset of C and C++. So, no, we can't ignore the C++ impact for adding
empty types; it would need careful consideration in the liaison group.
> What depends on the "different objects have different addresses"
> principle? And why do unions not break this -- they could point to the
> same locations within the object? And don't flexible arrays already need
> special handling in this regard?
"including a pointer to an object and a subobject at its beginning" and
"one is a pointer to one past the end of one array object and the other is
a pointer to the start of a different array object that happens to
immediately follow the first array object in the address space" are both
cases included in the semantics for comparison operators. If you allow
zero-size objects you get more special cases there (and quite possibly
affect optimizations based on points-to analysis that can determine
pointers are based on different objects, if an object is not known at
compile time to have nonzero size).
--
Joseph S. Myers
joseph@...esourcery.com
Powered by blists - more mailing lists