x86/sev-es: Allocate and map an IST stack for #VC handler
authorJoerg Roedel <jroedel@suse.de>
Mon, 7 Sep 2020 13:15:43 +0000 (15:15 +0200)
committerBorislav Petkov <bp@suse.de>
Wed, 9 Sep 2020 09:33:19 +0000 (11:33 +0200)
commit02772fb9b68e6a72a5e17f994048df832fe2b15e
treeac6c3c2e41d924a7ddd9bbce6d605b0790dbc978
parent885689e47dfa1499b756a07237eb645234d93cf9
x86/sev-es: Allocate and map an IST stack for #VC handler

Allocate and map an IST stack and an additional fall-back stack for
the #VC handler.  The memory for the stacks is allocated only when
SEV-ES is active.

The #VC handler needs to use an IST stack because a #VC exception can be
raised from kernel space with unsafe stack, e.g. in the SYSCALL entry
path.

Since the #VC exception can be nested, the #VC handler switches back to
the interrupted stack when entered from kernel space. If switching back
is not possible, the fall-back stack is used.

Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/20200907131613.12703-43-joro@8bytes.org
arch/x86/include/asm/cpu_entry_area.h
arch/x86/include/asm/page_64_types.h
arch/x86/kernel/cpu/common.c
arch/x86/kernel/dumpstack_64.c
arch/x86/kernel/sev-es.c