]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
x86/entry: Switch the stack after error_entry() returns
authorLai Jiangshan <jiangshan.ljs@antgroup.com>
Thu, 21 Apr 2022 14:10:49 +0000 (22:10 +0800)
committerThadeu Lima de Souza Cascardo <cascardo@canonical.com>
Tue, 19 Jul 2022 19:13:23 +0000 (16:13 -0300)
commit90f93ae2530b22c2703ffacc6ecd9c5b2c70e9e7
treef68f6a51944a4b433c37c4480f0f9b39f7b293d6
parent6937b2ffcde87d8e8d2eae13d8281d56fecdd985
x86/entry: Switch the stack after error_entry() returns

commit 520a7e80c96d655fbe4650d9cc985bd9d0443389 upstream.

error_entry() calls fixup_bad_iret() before sync_regs() if it is a fault
from a bad IRET, to copy pt_regs to the kernel stack. It switches to the
kernel stack directly after sync_regs().

But error_entry() itself is also a function call, so it has to stash
the address it is going to return to, in %r12 which is unnecessarily
complicated.

Move the stack switching after error_entry() and get rid of the need to
handle the return address.

  [ bp: Massage commit message. ]

Signed-off-by: Lai Jiangshan <jiangshan.ljs@antgroup.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lore.kernel.org/r/20220503032107.680190-3-jiangshanlai@gmail.com
CVE-2022-29900
CVE-2022-29901
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
arch/x86/entry/entry_64.S