Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1193538 > unrolled thread

Re: [PATCH 3/5] x86/asm/entry/32: Jump from SYSENTER32 to SYSCALL32 code path

Started byAndy Lutomirski <luto@amacapital.net>
First post2015-07-28 00:40 +0200
Last post2015-07-28 13:20 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  Re: [PATCH 3/5] x86/asm/entry/32: Jump from SYSENTER32 to SYSCALL32  code path Andy Lutomirski <luto@amacapital.net> - 2015-07-28 00:40 +0200
    Re: [PATCH 3/5] x86/asm/entry/32: Jump from SYSENTER32 to SYSCALL32  code path Denys Vlasenko <dvlasenk@redhat.com> - 2015-07-28 13:20 +0200

#1193538 — Re: [PATCH 3/5] x86/asm/entry/32: Jump from SYSENTER32 to SYSCALL32 code path

FromAndy Lutomirski <luto@amacapital.net>
Date2015-07-28 00:40 +0200
SubjectRe: [PATCH 3/5] x86/asm/entry/32: Jump from SYSENTER32 to SYSCALL32 code path
Message-ID<pQZdT-7ag-3@gated-at.bofh.it>
> Subject: [PATCH 3/5] x86/asm/entry/32: Jump from SYSENTER32 to SYSCALL32 code path

Shouldn't that be /64, not /32, or maybe /64/compat?

On Mon, Jul 27, 2015 at 1:33 PM, Denys Vlasenko <dvlasenk@redhat.com> wrote:
> In 32-bit SYSENTER code, load arg6 into R9 instead of EBP.
> Jump to SYSCALL code path after we finish setting up pt_regs
> and clearing FLAGS_NT.
>
> This leaves most of SYSENTER32 code path inaccessible.
>
> Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
> CC: Ingo Molnar <mingo@kernel.org>
> CC: Linus Torvalds <torvalds@linux-foundation.org>
> CC: Krzysztof A. Sobiecki <sobkas@gmail.com>
> CC: Steven Rostedt <rostedt@goodmis.org>
> CC: Borislav Petkov <bp@alien8.de>
> CC: "H. Peter Anvin" <hpa@zytor.com>
> CC: Andy Lutomirski <luto@amacapital.net>
> CC: Oleg Nesterov <oleg@redhat.com>
> CC: Frederic Weisbecker <fweisbec@gmail.com>
> CC: Alexei Starovoitov <ast@plumgrid.com>
> CC: Will Drewry <wad@chromium.org>
> CC: Kees Cook <keescook@chromium.org>
> CC: x86@kernel.org
> CC: linux-kernel@vger.kernel.org
> ---
>  arch/x86/entry/entry_64_compat.S | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/arch/x86/entry/entry_64_compat.S b/arch/x86/entry/entry_64_compat.S
> index df102e8..d74745a 100644
> --- a/arch/x86/entry/entry_64_compat.S
> +++ b/arch/x86/entry/entry_64_compat.S
> @@ -93,7 +93,7 @@ ENTRY(entry_SYSENTER_compat)
>          * 32-bit zero extended
>          */
>         ASM_STAC
> -1:     movl    (%rbp), %ebp
> +1:     movl    (%rbp), %r9d

You're sticking arg6 into r9d here, I think, and then:


>
>         orl     $TS_COMPAT, ASM_THREAD_INFO(TI_status, %rsp, SIZEOF_PTREGS)
>         testl   $_TIF_WORK_SYSCALL_ENTRY, ASM_THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS)
> @@ -343,6 +344,7 @@ ENTRY(entry_SYSCALL_compat)
>         _ASM_EXTABLE(1b, ia32_badarg)
>         ASM_CLAC
>
> +sysenter_jumps_here:
>         orl     $TS_COMPAT, ASM_THREAD_INFO(TI_status, %rsp, SIZEOF_PTREGS)
>         testl   $_TIF_WORK_SYSCALL_ENTRY, ASM_THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS)
>         jnz     cstar_tracesys

you land here, which eventually does:

    movl    %ebp, %r9d        /* arg6 */

What am I missing?

--Andy
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1194135

FromDenys Vlasenko <dvlasenk@redhat.com>
Date2015-07-28 13:20 +0200
Message-ID<pRb5p-7Bt-49@gated-at.bofh.it>
In reply to#1193538
On 07/28/2015 12:37 AM, Andy Lutomirski wrote:
>> Subject: [PATCH 3/5] x86/asm/entry/32: Jump from SYSENTER32 to SYSCALL32 code path
> 
> Shouldn't that be /64, not /32, or maybe /64/compat?
> 
> On Mon, Jul 27, 2015 at 1:33 PM, Denys Vlasenko <dvlasenk@redhat.com> wrote:
>> In 32-bit SYSENTER code, load arg6 into R9 instead of EBP.
>> Jump to SYSCALL code path after we finish setting up pt_regs
>> and clearing FLAGS_NT.
>>
>> This leaves most of SYSENTER32 code path inaccessible.
>>
>> Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
>> CC: Ingo Molnar <mingo@kernel.org>
>> CC: Linus Torvalds <torvalds@linux-foundation.org>
>> CC: Krzysztof A. Sobiecki <sobkas@gmail.com>
>> CC: Steven Rostedt <rostedt@goodmis.org>
>> CC: Borislav Petkov <bp@alien8.de>
>> CC: "H. Peter Anvin" <hpa@zytor.com>
>> CC: Andy Lutomirski <luto@amacapital.net>
>> CC: Oleg Nesterov <oleg@redhat.com>
>> CC: Frederic Weisbecker <fweisbec@gmail.com>
>> CC: Alexei Starovoitov <ast@plumgrid.com>
>> CC: Will Drewry <wad@chromium.org>
>> CC: Kees Cook <keescook@chromium.org>
>> CC: x86@kernel.org
>> CC: linux-kernel@vger.kernel.org
>> ---
>>  arch/x86/entry/entry_64_compat.S | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/x86/entry/entry_64_compat.S b/arch/x86/entry/entry_64_compat.S
>> index df102e8..d74745a 100644
>> --- a/arch/x86/entry/entry_64_compat.S
>> +++ b/arch/x86/entry/entry_64_compat.S
>> @@ -93,7 +93,7 @@ ENTRY(entry_SYSENTER_compat)
>>          * 32-bit zero extended
>>          */
>>         ASM_STAC
>> -1:     movl    (%rbp), %ebp
>> +1:     movl    (%rbp), %r9d
> 
> You're sticking arg6 into r9d here, I think, and then:
> 
> 
>>
>>         orl     $TS_COMPAT, ASM_THREAD_INFO(TI_status, %rsp, SIZEOF_PTREGS)
>>         testl   $_TIF_WORK_SYSCALL_ENTRY, ASM_THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS)
>> @@ -343,6 +344,7 @@ ENTRY(entry_SYSCALL_compat)
>>         _ASM_EXTABLE(1b, ia32_badarg)
>>         ASM_CLAC
>>
>> +sysenter_jumps_here:
>>         orl     $TS_COMPAT, ASM_THREAD_INFO(TI_status, %rsp, SIZEOF_PTREGS)
>>         testl   $_TIF_WORK_SYSCALL_ENTRY, ASM_THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS)
>>         jnz     cstar_tracesys
> 
> you land here, which eventually does:
> 
>     movl    %ebp, %r9d        /* arg6 */
> 
> What am I missing?

Please "git pull" from Ingo's tree. There was a revert,
arg6 is no longer held in EBP in SYSCALL code:

cstar_do_call:
        /* 32-bit syscall -> 64-bit C ABI argument conversion */
        movl    %edi, %r8d              /* arg5 */
        /* r9 already loaded */         /* arg6 */
        xchg    %ecx, %esi              /* rsi:arg2, rcx:arg4 */
        movl    %ebx, %edi              /* arg1 */
        movl    %edx, %edx              /* arg3 (zero extension) */

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web