From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nd9zG-0000ne-9i for qemu-devel@nongnu.org; Thu, 04 Feb 2010 17:15:46 -0500 Received: from [199.232.76.173] (port=56410 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nd9zF-0000nR-TA for qemu-devel@nongnu.org; Thu, 04 Feb 2010 17:15:45 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1Nd9zE-0001Zo-BM for qemu-devel@nongnu.org; Thu, 04 Feb 2010 17:15:45 -0500 Received: from moutng.kundenserver.de ([212.227.126.186]:63572) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Nd9z4-0001XA-1i for qemu-devel@nongnu.org; Thu, 04 Feb 2010 17:15:44 -0500 Message-ID: <4B6B46F4.2040903@mail.berlios.de> Date: Thu, 04 Feb 2010 23:15:16 +0100 From: Stefan Weil MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] User mode: Handle x86_64 vsyscall References: <761ea48b0907110814t12c644b6mf733d3b5e28e152@mail.gmail.com> <20091017195726.GB9922@laped.iglesias.mooo.com> <20091018030944.GB15656@shareable.org> <761ea48b0910180429l9fdf32r7f0a8f7ceebb9eee@mail.gmail.com> In-Reply-To: <761ea48b0910180429l9fdf32r7f0a8f7ceebb9eee@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Laurent Desnogues Cc: "Edgar E. Iglesias" , qemu-devel@nongnu.org Laurent Desnogues schrieb: > On Sun, Oct 18, 2009 at 5:09 AM, Jamie Lokier wrote: > [...] >> Please don't do that. Some 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. Making 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. On 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 I can confirm that some binaries fail: x86_64-linux-user/qemu-x86_64 ./bntest with bntest from openssl creates a core dump. Will Laurent's patch be applied, or is there a better way to fix the problem? Stefan