Re: x86-64: Maintain 16-byte stack alignment

From: Linus Torvalds
Date: Thu Jan 12 2017 - 16:41:01 EST


On Thu, Jan 12, 2017 at 12:55 PM, Josh Poimboeuf <jpoimboe@xxxxxxxxxx> wrote:
>
> - Who's going to run sparse all the time to catch unauthorized users of
> __aligned__(16)?

Well, considering that we apparently only have a small handful of
existing users without anybody having ever run any tool at all, I
don't think this is necessarily a huge problem.

One of the build servers could easily add the "make C=2" case to a
build test, and just grep the error reports for the 'excessive
alignment' string. The zero-day build bot already does much fancier
things.

So I don't think it would necessarily be all that hard to get a clean
build, and just say "if you need aligned stack space, you have to do
it yourself by hand".

That saId, if we now always enable frame pointers on x86 (and it has
gotten more and more difficult to avoid it), then the 16-byte
alignment would fairly natural.

The 8-byte alignment mainly makes sense when the basic call sequence
just adds 8 bytes, and you have functions without frames (that still
call other functions).

Linus