Re: [RFC 1/7] x86/asm/64: Allocate and enable the SYSENTER stack

From: Andy Lutomirski
Date: Mon Nov 13 2017 - 21:18:12 EST


On Mon, Nov 13, 2017 at 11:07 AM, Dave Hansen <dave.hansen@xxxxxxxxx> wrote:
> On 11/10/2017 08:05 PM, Andy Lutomirski wrote:
>> This will simplify some future code changes that will want some
>> temporary stack space in more places. It also lets us get rid of a
>> SWAPGS_UNSAFE_STACK user.
>>
>> This does not depend on CONFIG_IA32_EMULATION because we'll want the
>> stack space even without IA32 emulation.
>
> It was never clear to me why we don't use this on 64-bit today. Does
> anybody know why?

Nothing used it?

As far as I can tell, the original x86_64 Linux port was a little bit
more excited about IST than I think made sense. As a result, we use
IST for #DB and #BP, which is IMO rather nasty and causes a lot more
problems than it solves. But, since #DB uses IST, we don't actually
need a real stack for SYSENTER (because SYSENTER with TF set will
invoke #DB on the IST stack rather than the SYSENTER stack).

I have old patches to stop using IST for #DB and #BP, but I never finished them.