Re: [PATCH 03/18] x86/asm/64: Move SWAPGS into the common iret-to-usermode path

From: Dave Hansen
Date: Fri Oct 27 2017 - 14:08:36 EST


On 10/26/2017 01:26 AM, Andy Lutomirski wrote:
> diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
> index 493e5e234d36..1909a4e42b81 100644
> --- a/arch/x86/entry/entry_64.S
> +++ b/arch/x86/entry/entry_64.S
> @@ -254,7 +254,7 @@ return_from_SYSCALL_64:
> movq RCX(%rsp), %rcx
> movq RIP(%rsp), %r11
> cmpq %rcx, %r11 /* RCX == RIP */
> - jne opportunistic_sysret_failed
> + jne swapgs_restore_regs_and_return_to_usermode

Could we just leave the "opportunistic_sysret_failed" label and put it
at the same location as "swapgs_restore_regs_and_return_to_usermode".
It's kinda nice to have the failure paths spelled out.

Just reading this, I have no idea if "RCX == RIP" is good or bad and
whether we're proceeding with the sysret or giving up on it.