All of lore.kernel.org
 help / color / mirror / Atom feed
From: Denys Vlasenko <dvlasenk@redhat.com>
To: Andy Lutomirski <luto@amacapital.net>
Cc: Ingo Molnar <mingo@kernel.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	"Krzysztof A. Sobiecki" <sobkas@gmail.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Borislav Petkov <bp@alien8.de>, "H. Peter Anvin" <hpa@zytor.com>,
	Oleg Nesterov <oleg@redhat.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Alexei Starovoitov <ast@plumgrid.com>,
	Will Drewry <wad@chromium.org>, Kees Cook <keescook@chromium.org>,
	X86 ML <x86@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 3/5] x86/asm/entry/32: Jump from SYSENTER32 to SYSCALL32 code path
Date: Tue, 28 Jul 2015 13:13:04 +0200	[thread overview]
Message-ID: <55B763C0.80302@redhat.com> (raw)
In-Reply-To: <CALCETrV6Zbkn9S8oHX6=JzZ8TCPv1b=8ZzP_B6oenk=OOu1uHw@mail.gmail.com>

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) */


  reply	other threads:[~2015-07-28 11:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-27 22:37 [PATCH 3/5] x86/asm/entry/32: Jump from SYSENTER32 to SYSCALL32 code path Andy Lutomirski
2015-07-28 11:13 ` Denys Vlasenko [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-07-27 20:33 [PATCH 1/5] x86/asm/entry/32: Massage SYSENTER32 fast path to be nearly identical to SYSCALL32 Denys Vlasenko
2015-07-27 20:33 ` [PATCH 3/5] x86/asm/entry/32: Jump from SYSENTER32 to SYSCALL32 code path Denys Vlasenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55B763C0.80302@redhat.com \
    --to=dvlasenk@redhat.com \
    --cc=ast@plumgrid.com \
    --cc=bp@alien8.de \
    --cc=fweisbec@gmail.com \
    --cc=hpa@zytor.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=mingo@kernel.org \
    --cc=oleg@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=sobkas@gmail.com \
    --cc=torvalds@linux-foundation.org \
    --cc=wad@chromium.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.