Re: [GIT pull] timers/vdso for v7.0-rc1
From: Linus Torvalds
Date: Tue Feb 10 2026 - 21:05:27 EST
On Tue, 10 Feb 2026 at 17:38, Linus Torvalds
<torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> So __builtin_memcpy() at least should work. I'm still not convinced
> that it's necessarily the *better* option, but at least my immediate
> worries are not a problem.
So because I worried about the interaction with named address spaces,
and started looking at the implementation closer, I just went
"WHAA??".
The __put_unaligned_t() implementation looks entirely sane and straightforward.
But that __get_unaligned_t() code is just a mess. Why does it play
those crazy type games? The normal way to avoid all of that when the
worry is aliasing is to just use a union.
IOW, why is it doing all those odd things, when it would appear that
the simple implementation would be something like this:
#define __get_unaligned_t(type, ptr) ({ \
union { type __val; char __arr[]; } __res; \
__builtin_memcpy(__res.__arr, (void *)(ptr), sizeof(type)); \
__res.__val; \
})
which is a lot more idiomatic and doesn't play any odd games with
types (you could make "__arr[]" do that "sizeof(type)" too, but there
isn't really any upside)
Am I missing some odd case?
Linus