lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 1 Nov 2017 13:35:12 -0700
From:   Andy Lutomirski <luto@...nel.org>
To:     Brian Gerst <brgerst@...il.com>
Cc:     Andy Lutomirski <luto@...nel.org>, X86 ML <x86@...nel.org>,
        Borislav Petkov <bpetkov@...e.de>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Dave Hansen <dave.hansen@...el.com>,
        Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: [PATCH 07/18] x86/asm/64: Merge the fast and slow SYSRET paths

On Wed, Nov 1, 2017 at 10:25 AM, Brian Gerst <brgerst@...il.com> wrote:
> On Thu, Oct 26, 2017 at 4:26 AM, Andy Lutomirski <luto@...nel.org> wrote:
>> They did almost the same thing.  Remove a bunch of pointless
>> instructions (mostly hidden in macros) and reduce cognitive load by
>> merging them.
>>
>> Signed-off-by: Andy Lutomirski <luto@...nel.org>
>> ---
>>  arch/x86/entry/entry_64.S | 6 +++---
>>  1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
>> index 9dafafa3e0ec..c855ee91a3a5 100644
>> --- a/arch/x86/entry/entry_64.S
>> +++ b/arch/x86/entry/entry_64.S
>> @@ -220,10 +220,9 @@ entry_SYSCALL_64_fastpath:
>>         TRACE_IRQS_ON           /* user mode is traced as IRQs on */
>>         movq    RIP(%rsp), %rcx
>>         movq    EFLAGS(%rsp), %r11
>> -       RESTORE_C_REGS_EXCEPT_RCX_R11
>> -       movq    RSP(%rsp), %rsp
>> +       addq    $6*8, %rsp      /* skip extra regs -- they were preserved */
>>         UNWIND_HINT_EMPTY
>> -       USERGS_SYSRET64
>> +       jmp     .Lpop_c_regs_except_rcx_r11_and_sysret
>>
>>  1:
>>         /*
>> @@ -315,6 +314,7 @@ syscall_return_via_sysret:
>>         /* rcx and r11 are already restored (see code above) */
>>         UNWIND_HINT_EMPTY
>>         POP_EXTRA_REGS
>> +.Lpop_c_regs_except_rcx_r11_and_sysret:
>>         popq    %rsi    /* skip r11 */
>>         popq    %r10
>>         popq    %r9
>
> Wouldn't it be more logical to keep the SYSRET path at the end of the
> fast path (reverse of what you are doing here)?  That way the fast
> path falls through without jumping.

Ugh, probably.  I think I'll save that for v3, though.  I want to keep
this moving.

Powered by blists - more mailing lists