From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MzTxT-0005Mw-Kr for qemu-devel@nongnu.org; Sun, 18 Oct 2009 07:29:55 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MzTxS-0005Mg-84 for qemu-devel@nongnu.org; Sun, 18 Oct 2009 07:29:54 -0400 Received: from [199.232.76.173] (port=47408 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MzTxS-0005Md-4I for qemu-devel@nongnu.org; Sun, 18 Oct 2009 07:29:54 -0400 Received: from fg-out-1718.google.com ([72.14.220.158]:46938) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MzTxR-0000OU-ME for qemu-devel@nongnu.org; Sun, 18 Oct 2009 07:29:53 -0400 Received: by fg-out-1718.google.com with SMTP id d23so1493665fga.10 for ; Sun, 18 Oct 2009 04:29:52 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <20091018030944.GB15656@shareable.org> References: <761ea48b0907110814t12c644b6mf733d3b5e28e152@mail.gmail.com> <20091017195726.GB9922@laped.iglesias.mooo.com> <20091018030944.GB15656@shareable.org> Date: Sun, 18 Oct 2009 13:29:52 +0200 Message-ID: <761ea48b0910180429l9fdf32r7f0a8f7ceebb9eee@mail.gmail.com> Subject: Re: [Qemu-devel] [PATCH] User mode: Handle x86_64 vsyscall From: Laurent Desnogues Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jamie Lokier Cc: "Edgar E. Iglesias" , qemu-devel@nongnu.org On Sun, Oct 18, 2009 at 5:09 AM, Jamie Lokier wrote: [...] > > Please don't do that. =A0Some code traces instructions through the > vsyscall/vdso page, and will be surprised if a syscall instruction > does not do what's expected based on the registers at that point. > > Also I don't know if anyone's done this, but I have played with the > idea of an optimising x86->x86 JIT translator (similar to valgrind or > qemu's TCG) which would include the vdso instruction sequence in it's > traces, just because it didn't treat that any differently from other > userspace code. =A0Making the syscall instruction behave differently due > to EIP would break that sort of thing. > > There's no performance penalty in setting a few registers prior to > using the syscall instruction normally, so please do that. My proposed patch intercepts vsyscall as soon as the PC is in the [VSYSCALL_START, VSYSCALL_END[ range, so all instructions in that range won't be translated. Doing it differently will cause problems due to the virtual address. > On x86_64, the vsyscall page has fixed address (see > linux/arch/x86/kernel/vsyscall_64.c), but the vdso usually has > variable address. > > On x86_32, the vdso has randomised address unless configurd to be a > fixed address. =A0On older kernels it was a fixed address and some > binary programs assume they can call that. So QEMU can't do things properly and some binaries will fail, right? Laurent