Re: [PATCH] x86: entry_32.S: change ESPFIX test to not touch PT_OLDSS(%esp)

From: Linus Torvalds
Date: Mon Mar 09 2015 - 13:59:43 EST


On Mon, Mar 9, 2015 at 10:45 AM, Andy Lutomirski <luto@xxxxxxxxxxxxxx> wrote:
>
> If sp0 is set to the very top of the stack, then an NMI immediately
> after sysenter will have OLDSS off the top of the stack, and reading
> it can crash. This is why 32-bit kernels have a (buggy!) 8 byte
> offset in sp0.

So I think that for sysenter, we *should* have that 8-byte buffer.

Not in general for sp0, but for MSR_IA32_SYSENTER_ESP (which is sp1, afaik).

Just make the rule be that you can never ever have a kernel stack
frame that doesn't contain room for ss/sp at the top.

We have various code that looks at and touches "pt_regs" anyway, and
accesses things out for debugging/oopsing/tracing etc. Let's not make
the rule be that you cannot look at regs->ss without checking various
random other fields first.

Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/