Skip to content

Ensure stack is aligned for kernel entries

Julien Thierry kvmarm linux-arm-kernel 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest0 of 7 patches 0 repliesNew

Patches in v1 No applies recorded yet

None of the 7 patches the cover letter announces are in this archive.

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/7] Ensure stack is aligned for kernel entries

Hi Will,

Quoted 9 lines · Will Deacon

Hi Julien,

Quoted 5 lines · Julien Thierry

Having SCTLR_ELx.SA enabled requires the SP to be 16-bytes aligned before using it to access memory. When taking an exception, it is possible that the context during which the exception occured had SP mis-aligned. The entry code needs to make sure that the stack is aligned before using it to save the context.

Quoted 4 lines

Do you know what we haven't had reports of this crashing? Is it because GCC tends to keep the SP aligned anyway, so we're getting away with it for the moment? Trying to work out whether this is a candidate for -stable.

I think that GCC tends to keep the SP aligned anyway is the most likely explanation, yes.

I tried looking for specific options that could make this more likely, but all I could find was the option -mpreferred-stack-boundary only available for x86 and -mstack-alignment only provided by clang.

Couldn't find anything yet on the gcc arm64 side that would either guarantee we'd have an aligned stack nor that GCC would make it very very likely.

I can try to investigate a bit more.

Thanks,

Signature · 1 line
Julien Thierry