From: "H. Peter Anvin" <hpa@zytor.com>
To: Greg Lueck <lueckintel@yahoo.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
Andrew Lutomirski <luto@mit.edu>
Cc: Andi Kleen <andi@firstfloor.org>,
"x86@kernel.org" <x86@kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"kimwooyoung@gmail.com" <kimwooyoung@gmail.com>
Subject: Re: New vsyscall emulation breaks JITs
Date: Tue, 09 Aug 2011 20:49:16 -0500 [thread overview]
Message-ID: <c3bb5412-8600-40e2-aa7f-a844457c24ba@email.android.com> (raw)
In-Reply-To: <1312934493.45753.YahooMailNeo@web120015.mail.ne1.yahoo.com>
Greg Lueck <lueckintel@yahoo.com> wrote:
>Yes, this sounds like a cleaner solution. What happens, though, if the
>system call is interrupted by a signal or by ptrace(ATTACH)? Does RIP
>point at the target of the RET instruction? Is it moved back to the
>entry of the vsyscall page? Does it point immediately after the
>SYSCALL instruction? GDB might also care about these details.
>
>> That's a fun corner case. Is the problem that you might receive a
>> signal while single-stepping?
>
>
>Actually, the situation is more difficult. The application may have
>received a signal while inside the gate, sometime before the SYSENTER
>trap. The signal context frame on the application's stack now has RIP
>pointing someplace inside the gate. At this point, Pin attaches to the
>native process, and it has no reasonable way to know about the saved
>context with this RIP value. Later, the application (running under
>Pin) will return from its handler and resume execution in the middle of
>the gate code. What can Pin do here? It' s too late to execute
>natively at the start of the gate. If Pin executes natively at the
>signal return point, Pin will lose control of the application and it
>will execute natively from that point forward.
>
>-- Greg
>
>
>
>
>________________________________
>From: Linus Torvalds <torvalds@linux-foundation.org>
>To: Andrew Lutomirski <luto@mit.edu>
>Cc: Greg Lueck <lueckintel@yahoo.com>; H. Peter Anvin <hpa@zytor.com>;
>Andi Kleen <andi@firstfloor.org>; "x86@kernel.org" <x86@kernel.org>;
>"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>;
>"kimwooyoung@gmail.com" <kimwooyoung@gmail.com>
>Sent: Tuesday, August 9, 2011 6:36 PM
>Subject: Re: New vsyscall emulation breaks JITs
>
>On Tue, Aug 9, 2011 at 2:04 PM, Andrew Lutomirski <luto@mit.edu> wrote:
>>
>> Here's a different proposal, then:
>>
>> What if the kernel had the sequence:
>>
>> mov $__NR_whatever,%eax
>> syscall
>> ret
>>
>> in the vsyscall page but marked the vsyscall page NX.
>
>This sounds like a sound idea. And then the difference between "fast
>and native" and "slow and trapping" ends up literally being just the
>NX bit.
>
> Linus
The logical answer is that rip will point to the entry to the vsyscall page.
--
Sent from my mobile phone. Please excuse my brevity and lack of formatting.
prev parent reply other threads:[~2011-08-10 1:49 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-05 20:09 Andi Kleen
2011-08-05 20:23 ` H. Peter Anvin
2011-08-05 20:26 ` Andi Kleen
2011-08-05 20:36 ` H. Peter Anvin
2011-08-05 20:47 ` Andi Kleen
2011-08-05 20:45 ` Andrew Lutomirski
2011-08-05 20:48 ` H. Peter Anvin
2011-08-05 20:52 ` Andi Kleen
2011-08-05 21:00 ` Andrew Lutomirski
2011-08-05 21:21 ` Andi Kleen
2011-08-05 21:26 ` Andrew Lutomirski
2011-08-05 22:06 ` H. Peter Anvin
2011-08-05 22:11 ` Andrew Lutomirski
2011-08-06 0:20 ` Andrew Lutomirski
2011-08-06 0:32 ` H. Peter Anvin
2011-08-06 3:01 ` [RFC] x86-64: Allow emulated vsyscalls from user addresses Andy Lutomirski
2011-08-06 3:04 ` [RFC v2] " Andy Lutomirski
2011-08-06 6:45 ` Ingo Molnar
2011-08-07 12:19 ` Borislav Petkov
2011-08-07 12:58 ` Andrew Lutomirski
2011-08-07 15:44 ` Borislav Petkov
2011-08-07 16:14 ` Andrew Lutomirski
2011-08-11 13:16 ` Pavel Machek
2011-08-11 13:27 ` Andrew Lutomirski
2011-08-09 22:27 ` New vsyscall emulation breaks JITs Suresh Siddha
2011-08-09 13:26 ` Andrew Lutomirski
2011-08-09 15:04 ` Andi Kleen
2011-08-09 15:22 ` Andrew Lutomirski
2011-08-09 16:47 ` [RFC] x86-64: Add vsyscall=emulate|native|none option Andy Lutomirski
2011-08-09 19:54 ` Linus Torvalds
2011-08-09 16:57 ` New vsyscall emulation breaks JITs H. Peter Anvin
2011-08-09 17:05 ` Andrew Lutomirski
[not found] ` <1312919938.17118.YahooMailNeo@web120010.mail.ne1.yahoo.com>
2011-08-09 20:59 ` H. Peter Anvin
2011-08-09 21:04 ` Andrew Lutomirski
2011-08-09 22:36 ` Linus Torvalds
2011-08-10 0:56 ` H. Peter Anvin
[not found] ` <1312934493.45753.YahooMailNeo@web120015.mail.ne1.yahoo.com>
2011-08-10 1:49 ` H. Peter Anvin [this message]
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=c3bb5412-8600-40e2-aa7f-a844457c24ba@email.android.com \
--to=hpa@zytor.com \
--cc=andi@firstfloor.org \
--cc=kimwooyoung@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lueckintel@yahoo.com \
--cc=luto@mit.edu \
--cc=torvalds@linux-foundation.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®