Re: [PATCH 5/8] x86/head: remove useless zeroed word

From: Linus Torvalds
Date: Mon Aug 22 2016 - 19:05:44 EST


On Mon, Aug 22, 2016 at 2:48 PM, Andi Kleen <andi@xxxxxxxxxxxxxx> wrote:
>
> Seems dangerous. It wouldn't surprise me if some CPUs or x86 emulations
> load it anyways and trigger page faults if there is really nothing
> there.

Don't be silly, Andi and Peter.

We don't actually *use* lss any more. Not even on 32-bit. The zero is
never accessed. And on x86-64 we never did, obviously.

On 32-bit that zero doesn't even exist any more. On x86-64, it was
never even used at all. On x86-32, it was removed in commit
11d4c3f9b671 ("x86-32: Make sure the stack is set up before we use
it"), when the code stopped doing lss.

On x86-64, it has never made sense. It was added in commit
9cf4f298e29a ("x86: use stack_start in x86_64") to match x86-32 at the
time, but it didn't actually make sense even then, because x86-64
didn't use lss. 32-bit did, but 64-but just did a simple

movq stack_start(%rip),%rsp

like a good user should.

Linus