Received: from [140.186.70.92] (port=33238 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PB6Nt-0008M6-P3 for qemu-devel@nongnu.org; Wed, 27 Oct 2010 09:49:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PB6K8-0007td-H8 for qemu-devel@nongnu.org; Wed, 27 Oct 2010 09:48:11 -0400 Received: from adelie.canonical.com ([91.189.90.139]:59814) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PB6K8-0007t9-AX for qemu-devel@nongnu.org; Wed, 27 Oct 2010 09:45:52 -0400 Received: from loganberry.canonical.com ([91.189.90.37]) by adelie.canonical.com with esmtp (Exim 4.69 #1 (Debian)) id 1PB6K4-00034k-P6 for ; Wed, 27 Oct 2010 14:45:49 +0100 Received: from loganberry.canonical.com (localhost [127.0.0.1]) by loganberry.canonical.com (Postfix) with ESMTP id ADF792E8148 for ; Wed, 27 Oct 2010 13:45:43 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Date: Wed, 27 Oct 2010 13:36:48 -0000 From: James Morse <655120@bugs.launchpad.net> Sender: bounces@canonical.com References: <20101005124907.5972.17735.malonedeb@palladium.canonical.com> Message-Id: <20101027133648.15844.53157.malone@potassium.ubuntu.com> Errors-To: bounces@canonical.com Subject: [Qemu-devel] [Bug 655120] Re: VirtFS EFAULT when accessing not existing files Reply-To: Bug 655120 <655120@bugs.launchpad.net> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Reproducible here with guest kernel 2.6.36 built for i686 and qemu-kvm buil= t from a fresh git clone taken on 27/10/2010. Host kernel is 2.6.30.10105.2.23.fc11.i686.PAE Guest 9p filesystem mounted as both 9p2000.u and 9p2000.L with the same pro= blem. In the guest syscall 'stat' on a non-existent path returns EFAULT (bad addr= ess) instead of ENOENT. This also affects syscall 'open', and is preventing new files from being cr= eated. I believe this is caused by 'v9fs_vfs_lookup' in 'fs/9p/vfs_inode.c' return= ing EFAULT instead of ENOENT. 'p9_client_walk' also returns EFAULT instead of ENOENT. Eventually we get to 'pdu_read' in 'net/9p/protocol.c', which is being call= ed to read '4 bytes', but calculates the space left in the 'pdu' (offset:10= size:11) as being 1. This call returns '3' (presumably how many bytes are = left unread). = In this case it gets back to 9pdu_vreadf, on line 178, (reading a 'd' 32bit= integer), which sets EFAULT as the error code. This then propagates all the way back to vfs. This looks to me like a short-read, but I don't know enough about the plan9= filesystem protocol to be able to debug this further. ** Attachment added: "Stack trace from pdu_read" https://bugs.launchpad.net/qemu/+bug/655120/+attachment/1713038/+files/9= p_shortread_stacktrace.txt -- = VirtFS EFAULT when accessing not existing files https://bugs.launchpad.net/bugs/655120 You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. Status in QEMU: New Bug description: =C2=A0use as client Debian squeeze i386 with a custom kernel: Linux (none) 2.6.35.5 #3 Thu Sep 23 18:36:02 UTC 2010 i686 GNU/Linux And as host Debian squeeze amd64 Linux asd 2.6.32-5-amd64 #1 SMP Fri Sep 17 21:50:19 UTC 2010 x86_64 GNU/Lin= ux kvm version is: kvm-88-5908-gdd67374 Started the client using: sudo /usr/local/kvm/bin/qemu-system-x86_64 -m 1024 -kernel linux-2.6.35.5.q= emu -drive file=3Droot.img,if=3Dvirtio -net nic,macaddr=3D02:ca:ff:ee:ba:be= ,model=3Dvirtio,vlan=3D1 -net tap,ifname=3Dtap1,vlan=3D1,script=3Dno -virtf= s local,path=3D/host,security_model=3Dmapped,mount_tag=3Dhost -nographic I've done following inside the guest: $ mount -t 9p -o trans=3Dvirtio,version=3D9p2000.L host /mnt $ ls -l /mnt/not-existing ls: cannot access /mnt/not-existing: Bad address This does not happen when not using 9p2000.L $ mount -t 9p -o trans=3Dvirtio host /mnt $ ls -l /mnt/not-existing ls: cannot access /mnt/not-existing: No such file or directory This return code will for example break make or many other tools. $ echo $PATH /mnt/usr/bin:/mnt/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin= :/sbin:/bin $ make KERNELDIR=3D/usr/src/linux make: execvp: pwd: Bad address Makefile:54: /Makefile.linux: No such file or directory make: *** No rule to make target `/Makefile.linux'. Stop.