|
|
Message-ID: <e131b45f-549f-4caf-a4ac-e110f52ddb93@gmail.com>
Date: Tue, 24 Nov 2026 17:35:31 -0500
From: Demi Marie Obenour <demiobenour@...il.com>
To: oss-security@...ts.openwall.com, Sam James <sam@...too.org>
Subject: Re: libexpat 2.11.0 fixes three vulnerabilities
On 11/23/26 6:35 PM, Sam James wrote:
> Sebastian Pipping <sebastian@...ping.org> writes:
>
>> [...]
>> #1495 Restore and document `-fno-strict-aliasing` for security
>> with both GCC and Clang >=20.
>
> Why Clang >= 20? Clang has supported this flag since forever.
>
>> libexpat continues to be `-Wstrict-aliasing=3` clean and
>> to reject violations via CI but there are multiple known
>> strict aliasing violations within libexpat that despite
>> `-Wstrict-aliasing=3` are not detected by GCC and which
>
> Note that -Wstrict-aliasing=1 is the most aggressive level [0]. Anyway,
> in terms of detection, Clang has TypeSanitizer (-fsanitize=type) but it
> has some issues still. Someone has proposed it for GCC now too.
>
> [0] https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wstrict-aliasing
>
>> are hard to impossible to resolve without a mess. These and
>
> Why are they so hard to resolve here exactly? In general, just memcpy
> and move on.
In protocol handling code, it requires code like this:
memcpy(&out,
((unsigned char *)ptr + struct_size * index + offsetof(type_name, field)),
sizeof(out));
instead of:
out = ((type_name *)ptr)->fam[index].field;
Or it might require:
struct protocol_entry {
uint32_t a, b;
};
struct protocol_entry_mirror;
uint32_t protocol_entry_get_a(const struct protocol_entry_mirror *m) {
uint32_t v;
static_assert(sizeof(v) == sizeof(m->a), "whoops");
memcpy(&v, (const unsigned char *) offsetof(struct protocol_entry, a), sizeof(v));
return endian_fixup(v);
}
which is unreadable (and unmaintainable) unless autogenerated.
It just winds up being a mess, and for existing code it means a lot of changes
all over the place. Building with -fno-strict-aliasing is far, *far* simpler.
I don't know what expat uses type punning for, but I suspect that it, too, would
need a fairly large change.
--
Sincerely,
Demi Marie Obenour (she/her/hers)
Download attachment "OpenPGP_signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists
Please check out the Open Source Software Security Wiki, which is counterpart to this mailing list.
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.