Skip to content

Commit

Permalink
x86/entry: Move PUSH_AND_CLEAR_REGS() back into error_entry
Browse files Browse the repository at this point in the history
Commit

  ee774da ("x86/entry: Move PUSH_AND_CLEAR_REGS out of error_entry()")

moved PUSH_AND_CLEAR_REGS out of error_entry, into its own function, in
part to avoid calling error_entry() for XenPV.

However, commit

  7c81c0c ("x86/entry: Avoid very early RET")

had to change that because the 'ret' was too early and moved it into
idtentry, bloating the text size, since idtentry is expanded for every
exception vector.

However, with the advent of xen_error_entry() in commit

  d147553 ("x86/xen: Add UNTRAIN_RET")

it became possible to remove PUSH_AND_CLEAR_REGS from idtentry, back
into *error_entry().

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Borislav Petkov <bp@suse.de>
  • Loading branch information
Peter Zijlstra authored and Borislav Petkov committed Jul 7, 2022
1 parent f54d453 commit 2c08b9b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions arch/x86/entry/entry_64.S
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,8 @@ SYM_CODE_END(ret_from_fork)

SYM_CODE_START_LOCAL(xen_error_entry)
UNWIND_HINT_FUNC
PUSH_AND_CLEAR_REGS save_ret=1
ENCODE_FRAME_POINTER 8
UNTRAIN_RET
RET
SYM_CODE_END(xen_error_entry)
Expand All @@ -339,9 +341,6 @@ SYM_CODE_END(xen_error_entry)
*/
.macro idtentry_body cfunc has_error_code:req

PUSH_AND_CLEAR_REGS
ENCODE_FRAME_POINTER

/*
* Call error_entry() and switch to the task stack if from userspace.
*
Expand Down Expand Up @@ -1042,6 +1041,10 @@ SYM_CODE_END(paranoid_exit)
*/
SYM_CODE_START_LOCAL(error_entry)
UNWIND_HINT_FUNC

PUSH_AND_CLEAR_REGS save_ret=1
ENCODE_FRAME_POINTER 8

testb $3, CS+8(%rsp)
jz .Lerror_kernelspace

Expand Down

0 comments on commit 2c08b9b

Please sign in to comment.