Re: [Regression] [PATCH v5 2/4] vdso: Switch get/put unaligned from packed struct to memcpy
From: Arnd Bergmann
Date: Wed Oct 07 2026 - 08:43:08 EST
On Tue, Oct 6, 2026, at 14:31, Marc Kleine-Budde wrote:
> Cc+ Arnd
Thanks for the Cc!
> On 28.09.2026 17:39:15, Stefan Kerkmann wrote:
>> Hi Ian,
>>
>> On 10/16/25 22:51, Ian Rogers wrote:
>> > Type punning is necessary for get/put unaligned but the use of a
>> > packed struct violates strict aliasing rules, requiring
>> > -fno-strict-aliasing to be passed to the C compiler. Switch to using
>> > memcpy so that -fno-strict-aliasing isn't necessary.
>> >
>> > Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx>
>> > ---
>
>> Is this an accepted trade-off? My understanding is that the kernel is always
>> built with -fno-strict-aliasing, so the packed-struct type punning was well
>> defined there, and the __packed annotation is what lets GCC generate valid
>> code for the unaligned access.
The previous upstream version was the result of endless discussions, and it
looks like changing it to the memcpy version was premature. At the time we
unified all architectures to use a common implentation, this was the only one
that resulted in correct and fast code on all architectures, so I don't
understand why this was just applied without including everyone who was
involved in coming up with the version that was replaced.
My feeling is that we should just revert this. I'm not sure about the
motivation for the change. It sounds like this was meant to be
used in userland code, and that clashed with assumptions we make
in the kernel, but I don't think that is sufficient reason for
regressing kernel code.
Arnd