x86/traps: Use pt_regs directly in fixup_bad_iret()
commit 0aca53c6b522f8d6e2681ca875acbbe105f5fdcf upstream. Always stash the address error_entry() is going to return to, in %r12 and get rid of the void *error_entry_ret; slot in struct bad_iret_stack which was supposed to account for it and pt_regs pushed on the stack. After this, both fixup_bad_iret() and sync_regs() can work on a struct pt_regs pointer directly. [ bp: Rewrite commit message, touch ups. ] 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-2-jiangshanlai@gmail.com Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
760adb59f6
commit
01bc8bd64c
@@ -1041,9 +1041,12 @@ SYM_CODE_START_LOCAL(error_entry)
|
||||
* Pretend that the exception came from user mode: set up pt_regs
|
||||
* as if we faulted immediately after IRET.
|
||||
*/
|
||||
mov %rsp, %rdi
|
||||
popq %r12 /* save return addr in %12 */
|
||||
movq %rsp, %rdi /* arg0 = pt_regs pointer */
|
||||
call fixup_bad_iret
|
||||
mov %rax, %rsp
|
||||
ENCODE_FRAME_POINTER
|
||||
pushq %r12
|
||||
jmp .Lerror_entry_from_usermode_after_swapgs
|
||||
SYM_CODE_END(error_entry)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user