From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IXvmN-0004aE-Dp for qemu-devel@nongnu.org; Wed, 19 Sep 2007 05:23:31 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IXvmM-0004ZG-EP for qemu-devel@nongnu.org; Wed, 19 Sep 2007 05:23:30 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IXvmM-0004Z0-0H for qemu-devel@nongnu.org; Wed, 19 Sep 2007 05:23:30 -0400 Received: from bangui.magic.fr ([195.154.194.245]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1IXvmL-0007rN-Hq for qemu-devel@nongnu.org; Wed, 19 Sep 2007 05:23:29 -0400 Subject: Re: [Fwd: [Qemu-devel] RFC: linux user problems] From: Jocelyn Mayer In-Reply-To: <20070919090752.GN9972@networkno.de> References: <1190158103.14938.315.camel@rapid> <20070919090752.GN9972@networkno.de> Content-Type: text/plain Date: Wed, 19 Sep 2007 11:23:03 +0200 Message-Id: <1190193783.12194.4.camel@jma4.dev.netgem.com> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Reply-To: l_indien@magic.fr, qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org On Wed, 2007-09-19 at 10:07 +0100, Thiemo Seufer wrote: > J. Mayer wrote: > > Following my previous message, I did a patch that makes syscalls take > > target_long/target_ulong argument and return target_long value instead > > of long/unsigned long. > > I also included the #ifdef protection for do_socketcall and do_ipc to > > avoid compilation warnings. > > And I also converted the fd given to do_ioctl to be an int. > > > > In addition to my previous remarks, I noticed some other things while > > reading the code: > > - the do_msgctl function seems very strange to me. It looks like half of > > the code is missing in the switch... > > - do_ipc directly uses pointers from the emulated environment without > > using lock_user related functions like it seems to be done everywhere > > else. > > - there are at least two problems in IPCOP_shmat: > > * the returned address could not fit in the target address space when > > emulating a 32 bits > > target on a 64 bits host > > * the returned address is always casted into a 32 bits value. I changed > > this to be target_ulong. > > - I also noticed some suspicious warnings (cast between pointer and > > integer of different size) that may hide other problems: > > * target_to_host_cmsg:567 > > * host_to_target_cmsg:612 > > * do_ipc:1609 > > * do_ipc: 1621 > > * do_ipc: 1645 > > * do_ipc: 1655 > > * do_ipc: 1677 (multiple times) > > * do_ipc: 1687 > > * do_ipc: 1711 > > * do_syscall:2686 > > * do_syscall: 3903 > > * do_syscall: 4671 > > > > May someone take a look at my patch and say if it seems reasonable to > > include this in the repository ? > > Looks reasonable, but introduces new compiler warnings > (on a ppc32/Linux host): > > Most (all?) targets show: > > /home/ths/qemu/qemu-work/linux-user/syscall.c: In function do_ipc': > /home/ths/qemu/qemu-work/linux-user/syscall.c:1612: warning: long int format, target_long arg (arg 2) My fault, I did only compile on x86_64, forgot to check in 32 bits mode, and did not see this warning (I may have missed it...), sorry. > > There's also one instance of: > > /home/ths/qemu/qemu-work/linux-user/syscall.c: At top level: > /home/ths/qemu/qemu-work/linux-user/syscall.c:1258: warning: 'shm_regions' defined but not used > > which looks like a missing #ifdef TARGET_NR_ipc. I will check more closely as there are also a lot of inline functions (then not generating compilation warnings) that are used only from do_ipc. Putting them in the #ifdef TARGET_NR_ipc may show other unused variables or functions. Thanks for the report.