Received: from eggs.gnu.org ([2001:4830:134:3::10]:46502) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X7Rco-00015A-RS for qemu-devel@nongnu.org; Wed, 16 Jul 2014 12:00:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X7Rck-00088x-J0 for qemu-devel@nongnu.org; Wed, 16 Jul 2014 12:00:10 -0400 Received: from 216-12-86-13.cv.mvl.ntelos.net ([216.12.86.13]:44868 helo=brightrain.aerifal.cx) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X7Rck-00085K-4o for qemu-devel@nongnu.org; Wed, 16 Jul 2014 12:00:06 -0400 Date: Wed, 16 Jul 2014 11:59:58 -0400 From: Rich Felker Message-ID: <20140716155957.GL17402@brightrain.aerifal.cx> References: <20140716040233.GA25975@brightrain.aerifal.cx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Rich Felker Subject: Re: [Qemu-devel] [musl] Re: Bogus struct stat64 for qemu-microblaze (user emulation)? List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: "Edgar E. Iglesias" , musl@lists.openwall.com, QEMU Developers , microblaze-linux@lists.itee.uq.edu.au, Stefan Kristiansson On Wed, Jul 16, 2014 at 09:36:23AM +0100, Peter Maydell wrote: > On 16 July 2014 05:02, Rich Felker wrote: > > The qemu-microblaze definition of struct stat64 seems to mismatch the > > kernel definition, which is using asm-generic/stat.h. See: > > > > http://git.qemu.org/?p=qemu.git;a=blob;f=linux-user/syscall_defs.h;h=c9e6323905486452f518102bf40ba73143c9d601;hb=HEAD#l1469 > > http://git.qemu.org/?p=qemu.git;a=blob;f=linux-user/syscall.c;h=a50229d0d72fc68966515fcf2bc308b833a3c032;hb=HEAD#l4949 > > > > This seems to be causing a truncated-to-32-bit inode number to be > > stored in the location where st_ino should reside, and a spurious copy > > of the inode number to be written in a unused slot at the end of the > > structure. > > Sounds quite plausible -- we've had issues with other archs > not having correct stat struct definitions in QEMU. I don't > suppose anybody's done much testing of the microblaze > linux-user code. The bug seems to have been introduced here. http://git.qemu.org/?p=qemu.git;a=commitdiff;h=a523eb06ec3fb2f4f4f4d362bb23704811d11379 I'm CC'ing the author/committer in case he has any input on why he did this. > > Is my analysis correct? Stefan Kristiansson and I found this while > > working on the or1k port of musl libc, where it seems our structure > > for the existing microblaze port is wrongly aligned with the qemu > > definition rather than the definition the real kernel is using. Before > > I try correcting this on our side, I want to make sure we're working > > with the right version. > > I would definitely trust the kernel definition, not QEMU's! Yes. Rich