Re: [PATCH v2 0/4] alpha: stack fixes

From: Maciej W. Rozycki
Date: Sun Feb 02 2025 - 12:37:56 EST


On Fri, 31 Jan 2025, Ivan Kokshaysky wrote:

> This series fixes oopses on Alpha/SMP observed since kernel v6.9. [1]
> Thanks to Magnus Lindholm for identifying that remarkably longstanding
> bug.
>
> The problem is that GCC expects 16-byte alignment of the incoming stack
> since early 2004, as Maciej found out [2]:
> Having actually dug speculatively I can see that the psABI was changed in
> GCC 3.5 with commit e5e10fb4a350 ("re PR target/14539 (128-bit long double
> improperly aligned)") back in Mar 2004, when the stack pointer alignment
> was increased from 8 bytes to 16 bytes, and arch/alpha/kernel/entry.S has
> various suspicious stack pointer adjustments, starting with SP_OFF which
> is not a whole multiple of 16.
>
> Also, as Magnus noted, "ALPHA Calling Standard" [3] required the same:
> D.3.1 Stack Alignment
> This standard requires that stacks be octaword aligned at the time a
> new procedure is invoked.
>
> However:
> - the "normal" kernel stack is always misaligned by 8 bytes, thanks to
> the odd number of 64-bit words in 'struct pt_regs', which is the very
> first thing pushed onto the kernel thread stack;
> - syscall, fault, interrupt etc. handlers may, or may not, receive aligned
> stack depending on numerous factors.

Would you please put this analysis into the commit description of 3/4?
It gives a good justification for the change, so it seems appropriate to
me to get it recorded along with the commit for posterity.

NB I've been feeling a little bit unwell over the last couple of days and
consequently I only started my GCC/glibc verification yesterday. Current
ETC is this coming Tue. Perheps it's worth noting that I run this against
6.3.0-rc5 with a couple of backports on top to resolve conflicts, as the
current master does not support EV45 hardware anymore. I'll let you know
of the outcome.

Maciej