x86/entry/32: Unwind the ESPFIX stack earlier on exception entry
authorAndy Lutomirski <luto@kernel.org>
Wed, 20 Nov 2019 09:10:49 +0000 (10:10 +0100)
committerPeter Zijlstra <peterz@infradead.org>
Thu, 21 Nov 2019 18:37:44 +0000 (19:37 +0100)
commita1a338e5b6fe9e0a39c57c232dc96c198bb53e47
tree1895708bea9167003a38d7eb4a4431b4dc5edb00
parent82cb8a0b1d8d07817b5d59f7fa1438e1fceafab2
x86/entry/32: Unwind the ESPFIX stack earlier on exception entry

Right now, we do some fancy parts of the exception entry path while SS
might have a nonzero base: we fill in regs->ss and regs->sp, and we
consider switching to the kernel stack. This results in regs->ss and
regs->sp referring to a non-flat stack and it may result in
overflowing the entry stack. The former issue means that we can try to
call iret_exc on a non-flat stack, which doesn't work.

Tested with selftests/x86/sigreturn_32.

Fixes: 45d7b255747c ("x86/entry/32: Enter the kernel via trampoline stack")
Signed-off-by: Andy Lutomirski <luto@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: stable@kernel.org
arch/x86/entry/entry_32.S