From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IoOJk-0007XQ-LX for qemu-devel@nongnu.org; Sat, 03 Nov 2007 15:06:00 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IoOJi-0007S5-Kr for qemu-devel@nongnu.org; Sat, 03 Nov 2007 15:06:00 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IoOJi-0007Rs-Bd for qemu-devel@nongnu.org; Sat, 03 Nov 2007 15:05:58 -0400 Received: from sp604003mt.neufgp.fr ([84.96.92.56] helo=smTp.neuf.fr) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IoOJh-0007KL-VV for qemu-devel@nongnu.org; Sat, 03 Nov 2007 15:05:58 -0400 Received: from [86.73.70.118] by sp604003mt.gpm.neuf.ld (Sun Java System Messaging Server 6.2-5.05 (built Feb 16 2006)) with ESMTP id <0JQY00IOA2DBJMH6@sp604003mt.gpm.neuf.ld> for qemu-devel@nongnu.org; Sat, 03 Nov 2007 20:05:36 +0100 (CET) Date: Sat, 03 Nov 2007 20:05:13 +0100 From: Fabrice Bellard Subject: Re: [Qemu-devel] Re: [PATCH] efault - add data type to put_user()/get_user() In-reply-to: <1194045983.2168.17.camel@phantasm.home.enterpriseandprosperity.com> Message-id: <472CC669.30907@bellard.org> MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1 Content-transfer-encoding: 7BIT References: <1193869827.19343.38.camel@phantasm.home.enterpriseandprosperity.com> <1193870136.19343.43.camel@phantasm.home.enterpriseandprosperity.com> <1193870631.19343.51.camel@phantasm.home.enterpriseandprosperity.com> <1194045983.2168.17.camel@phantasm.home.enterpriseandprosperity.com> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: thayne@c2.net, qemu-devel@nongnu.org I think that using host addresses in __put_user and __get_user is not logical. They should use target addresses as get_user and put_user. As Paul said, It is not worth mixing get/put/copy and lock/unlock functions. The ultimate goal of such cleanup is not only to generate -EFAULT correctly but also to be able to have arbitrary address space changes. In fact it would be good to be able to introduce an arbitrary address space change (such as a translation as Paul did) so that we can verify that all the Linux emulation stills works in this case. Regards, Fabrice. Thayne Harbaugh wrote: > On Wed, 2007-10-31 at 16:44 -0600, Thayne Harbaugh wrote: >> This patch updates get_user() and put_user() to take a third argument of >> data type. get_user() and put_user() use target address which are >> target_ulong and don't reflect the data type pointed to in target >> memory. >> >> Simply casting the target_ulong to a type before passing to >> get/put_user() is poor because target_ulong isn't always a simple cast >> to a host type (consider 32 bit on 64 bit where address are either >> extended or truncate). Also, simple casting of the argument to >> get/put_user() results in several warnings when target and long pointer >> sizes don't match. >> >> This patch has additional updates to fix places where get/put_user() are >> already used. > > This is an updated patch that doesn't conflict with the > abi_long/abi_ulong changes from a couple weeks ago.