From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from sog-mx-1.v43.ch3.sourceforge.com ([172.29.43.191] helo=mx.sourceforge.net) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1QvvLE-0001aR-H6 for user-mode-linux-devel@lists.sourceforge.net; Tue, 23 Aug 2011 18:04:48 +0000 Received: from zeniv.linux.org.uk ([195.92.253.2]) by sog-mx-1.v43.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) id 1QvvLE-0007Id-1K for user-mode-linux-devel@lists.sourceforge.net; Tue, 23 Aug 2011 18:04:48 +0000 Date: Tue, 23 Aug 2011 19:04:18 +0100 From: Al Viro Message-ID: <20110823180418.GJ2203@ZenIV.linux.org.uk> References: <4E52EF2A.8060608@zytor.com> <20110823010146.GY2203@ZenIV.linux.org.uk> <20110823011312.GZ2203@ZenIV.linux.org.uk> <20110823021717.GA2203@ZenIV.linux.org.uk> <20110823061531.GC2203@ZenIV.linux.org.uk> <20110823173317.GI2203@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20110823173317.GI2203@ZenIV.linux.org.uk> List-Id: The user-mode Linux development list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: user-mode-linux-devel-bounces@lists.sourceforge.net Subject: Re: [uml-devel] SYSCALL, ptrace and syscall restart breakages (Re: [RFC] weird crap with vdso on uml/i386) To: Linus Torvalds Cc: Andrew Lutomirski , "user-mode-linux-devel@lists.sourceforge.net" , Richard Weinberger , "linux-kernel@vger.kernel.org" , Borislav Petkov , "mingo@redhat.com" , "H. Peter Anvin" , Ingo Molnar On Tue, Aug 23, 2011 at 06:33:17PM +0100, Al Viro wrote: > * SYSCALL is not terminally broken wrt restarts. My apologies for > misreading what was going on. > * SYSENTER with Linus' patch does work just fine wrt restarts + ptrace > * SYSCALL is losing ptrace-made changes to arguments when it restarts. > Might or might not be a problem for somebody. BTW, that one (irrelevant to UML even if we do end up coping with SYSCALL there) might be worth spelling it out: tracer: ptrace(tracee, PTRACE_SYSCALL); tracee: recvfrom(..., &addrlen); tracer: ptrace(tracee, PTRACE_POKEUSER, EBP, &len2); ptrace(tracee, PTRACE_DETACH, 0, 0); tracee: completes recvfrom(), using &len2 instead of the &addrlen That works just fine, regardless of the way syscall is entered; yes, including SYSCALL - there we take care to handle ptrace on the way in. However, if it's SYSCALL and (ex-)tracee takes a restart, the second time around we'll have the original value of 6th argument used. Changes made by POKEUSER are lost. It's not a problem with int 0x80 or SYSENTER (now, with int 0x80 instead of jmp). It's probably not going to be a real issue for anyone, but I pity the poor bastard stuck with debugging that if it *does* become someone's problem. ------------------------------------------------------------------------------ Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 _______________________________________________ User-mode-linux-devel mailing list User-mode-linux-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754948Ab1HWSFA (ORCPT ); Tue, 23 Aug 2011 14:05:00 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:45237 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752684Ab1HWSEz (ORCPT ); Tue, 23 Aug 2011 14:04:55 -0400 Date: Tue, 23 Aug 2011 19:04:18 +0100 From: Al Viro To: Linus Torvalds Cc: Andrew Lutomirski , "H. Peter Anvin" , Borislav Petkov , Ingo Molnar , "user-mode-linux-devel@lists.sourceforge.net" , Richard Weinberger , "linux-kernel@vger.kernel.org" , "mingo@redhat.com" Subject: Re: [uml-devel] SYSCALL, ptrace and syscall restart breakages (Re: [RFC] weird crap with vdso on uml/i386) Message-ID: <20110823180418.GJ2203@ZenIV.linux.org.uk> References: <4E52EF2A.8060608@zytor.com> <20110823010146.GY2203@ZenIV.linux.org.uk> <20110823011312.GZ2203@ZenIV.linux.org.uk> <20110823021717.GA2203@ZenIV.linux.org.uk> <20110823061531.GC2203@ZenIV.linux.org.uk> <20110823173317.GI2203@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110823173317.GI2203@ZenIV.linux.org.uk> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 23, 2011 at 06:33:17PM +0100, Al Viro wrote: > * SYSCALL is not terminally broken wrt restarts. My apologies for > misreading what was going on. > * SYSENTER with Linus' patch does work just fine wrt restarts + ptrace > * SYSCALL is losing ptrace-made changes to arguments when it restarts. > Might or might not be a problem for somebody. BTW, that one (irrelevant to UML even if we do end up coping with SYSCALL there) might be worth spelling it out: tracer: ptrace(tracee, PTRACE_SYSCALL); tracee: recvfrom(..., &addrlen); tracer: ptrace(tracee, PTRACE_POKEUSER, EBP, &len2); ptrace(tracee, PTRACE_DETACH, 0, 0); tracee: completes recvfrom(), using &len2 instead of the &addrlen That works just fine, regardless of the way syscall is entered; yes, including SYSCALL - there we take care to handle ptrace on the way in. However, if it's SYSCALL and (ex-)tracee takes a restart, the second time around we'll have the original value of 6th argument used. Changes made by POKEUSER are lost. It's not a problem with int 0x80 or SYSENTER (now, with int 0x80 instead of jmp). It's probably not going to be a real issue for anyone, but I pity the poor bastard stuck with debugging that if it *does* become someone's problem.