From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37589) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKn7C-0005Bd-5J for qemu-devel@nongnu.org; Mon, 09 Feb 2015 07:06:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YKn78-0008Fr-Tl for qemu-devel@nongnu.org; Mon, 09 Feb 2015 07:06:58 -0500 Received: from mailapp01.imgtec.com ([195.59.15.196]:30472 helo=imgpgp01.kl.imgtec.org) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKn78-0008FV-J8 for qemu-devel@nongnu.org; Mon, 09 Feb 2015 07:06:54 -0500 Message-ID: <54D8A2D3.6050603@imgtec.com> Date: Mon, 9 Feb 2015 12:06:43 +0000 From: James Hogan MIME-Version: 1.0 References: <1422630485-29975-1-git-send-email-leon.alrae@imgtec.com> In-Reply-To: <1422630485-29975-1-git-send-email-leon.alrae@imgtec.com> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="npF6XIAcbAMuB6tmC3bdVJktMFEHh5TlT" Subject: Re: [Qemu-devel] [PATCH] linux-user: correct stat structure in MIPS N32 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Leon Alrae , qemu-devel@nongnu.org Cc: riku.voipio@iki.fi, aurelien@aurel32.net --npF6XIAcbAMuB6tmC3bdVJktMFEHh5TlT Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Hi Leon, On 30/01/15 15:08, Leon Alrae wrote: > Simple "hello world" MIPS N32 userland program crashes with segfault du= e to > incorrectly defined stat structure in QEMU. >=20 > Correct "target_stat" definition to match kernel's "stat64" as in MIPS = N32 > there are only plain "stat" syscalls using 64-bit structure. >=20 > Reported-by: Daniel Sanders > Signed-off-by: Leon Alrae > Tested-by: Daniel Sanders Reviewed-by: James Hogan Cheers James > --- > linux-user/syscall_defs.h | 86 +++++++++++----------------------------= -------- > 1 file changed, 19 insertions(+), 67 deletions(-) >=20 > diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h > index ebb3be1..0fc4317 100644 > --- a/linux-user/syscall_defs.h > +++ b/linux-user/syscall_defs.h > @@ -1600,73 +1600,25 @@ struct target_stat { > #elif defined(TARGET_ABI_MIPSN32) > =20 > struct target_stat { > - unsigned st_dev; > - int st_pad1[3]; /* Reserved for network id */ > - unsigned int st_ino; > - unsigned int st_mode; > - unsigned int st_nlink; > - int st_uid; > - int st_gid; > - unsigned st_rdev; > - unsigned int st_pad2[2]; > - unsigned int st_size; > - unsigned int st_pad3; > - /* > - * Actually this should be timestruc_t st_atime, st_mtime and st_ctim= e > - * but we don't have it under Linux. > - */ > - unsigned int target_st_atime; > - unsigned int target_st_atime_nsec; > - unsigned int target_st_mtime; > - unsigned int target_st_mtime_nsec; > - unsigned int target_st_ctime; > - unsigned int target_st_ctime_nsec; > - unsigned int st_blksize; > - unsigned int st_blocks; > - unsigned int st_pad4[14]; > -}; > - > -/* > - * This matches struct stat64 in glibc2.1, hence the absolutely insane= > - * amounts of padding around dev_t's. The memory layout is the same a= s of > - * struct stat of the 64-bit kernel. > - */ > - > -#define TARGET_HAS_STRUCT_STAT64 > -struct target_stat64 { > - unsigned int st_dev; > - unsigned int st_pad0[3]; /* Reserved for st_dev expansion */ > - > - target_ulong st_ino; > - > - unsigned int st_mode; > - unsigned int st_nlink; > - > - int st_uid; > - int st_gid; > - > - unsigned int st_rdev; > - unsigned int st_pad1[3]; /* Reserved for st_rdev expansion */ > - > - int st_size; > - > - /* > - * Actually this should be timestruc_t st_atime, st_mtime and st_ctim= e > - * but we don't have it under Linux. > - */ > - int target_st_atime; > - unsigned int target_st_atime_nsec; /* Reserved for st_atime expansion= */ > - > - int target_st_mtime; > - unsigned int target_st_mtime_nsec; /* Reserved for st_mtime expansion= */ > - > - int target_st_ctime; > - unsigned int target_st_ctime_nsec; /* Reserved for st_ctime expansion= */ > - > - unsigned int st_blksize; > - unsigned int st_pad2; > - > - int st_blocks; > + abi_ulong st_dev; > + abi_ulong st_pad0[3]; /* Reserved for st_dev expansion */ > + uint64_t st_ino; > + unsigned int st_mode; > + unsigned int st_nlink; > + int st_uid; > + int st_gid; > + abi_ulong st_rdev; > + abi_ulong st_pad1[3]; /* Reserved for st_rdev expansion */ > + int64_t st_size; > + abi_long target_st_atime; > + abi_ulong target_st_atime_nsec; /* Reserved for st_atime ex= pansion */ > + abi_long target_st_mtime; > + abi_ulong target_st_mtime_nsec; /* Reserved for st_mtime ex= pansion */ > + abi_long target_st_ctime; > + abi_ulong target_st_ctime_nsec; /* Reserved for st_ctime ex= pansion */ > + abi_ulong st_blksize; > + abi_ulong st_pad2; > + int64_t st_blocks; > }; > =20 > #elif defined(TARGET_ABI_MIPSO32) >=20 --npF6XIAcbAMuB6tmC3bdVJktMFEHh5TlT Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBAgAGBQJU2KLaAAoJEGwLaZPeOHZ6B/AQALrgFKG+N3+oohnfVCYJU84Z os5XA7r7NFimTJkuyD6bONxpWc/G4leeUZfdLvFqFXwWbjbgDasAurmM/UsUU+Ba VutNj9AYmp6PAA74xlM0hMZMTcysrDokinjPrS/EDl3S2/RpUpOz6EexsQis9UuZ XTEudBERsYgWo3Raj/bp/9pvxHV9eqoeDp+7unSKX4zSCLG0pmAFgCkVVcYkZbmn i52eQB6Yw/kL/JKu5Js4hwngc8yBDb8dtbAZ1SCPC1y9Ch8Z2qWNCqQX8+VrU0Kq G2vB7/qUxVkzz/2gt8n1ZxoOtWeIP5+aH4Vh9d4aX8tpbJtW9rJg//wPgu/j/SWV jHfROTWLFrq0N9QtRoSPZPk40d++godKnrGxg+OFW2nqe8hvoquvFwp76GvS6F5O Dj2GjqgoNcubN4G67UTzhHqKJtFOroYejD+qnvSVkuQJBQHPg249XdhAEJAkVmk4 gDDT52kLNKGRhOAY03kzvVLvTjitRaa9aULkrranTl5wvgQdNrnNvrYqj2E2u7Fn 04/WC/JFLm7CAUdYV+d17y5gfZp/9vfj9FS1tLb/Qe6GzBE6OW+uFTYeCgS2CzAt wI8k4cvOxI4CWK6fS+1s3gm8JZL3QORgp+mOgvmzZZ0P5cTpCWo5y8IPZ62ZaFgq c3w5eZ9eOITXRX7JiUTi =WAv8 -----END PGP SIGNATURE----- --npF6XIAcbAMuB6tmC3bdVJktMFEHh5TlT--