From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36334) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z4d8u-0002vy-Ji for qemu-devel@nongnu.org; Mon, 15 Jun 2015 18:46:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z4d8q-0004aG-JO for qemu-devel@nongnu.org; Mon, 15 Jun 2015 18:46:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35239) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z4d8q-0004ZH-DF for qemu-devel@nongnu.org; Mon, 15 Jun 2015 18:46:08 -0400 Message-ID: <557F55A9.6@redhat.com> Date: Mon, 15 Jun 2015 16:46:01 -0600 From: Eric Blake MIME-Version: 1.0 References: <1434407728-7260-1-git-send-email-laurent@vivier.eu> In-Reply-To: <1434407728-7260-1-git-send-email-laurent@vivier.eu> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="BKRKvtTohn0DwtoqwV9ngs4UhXAwgRBNw" Subject: Re: [Qemu-devel] [PATCH v2] linux-user: ioctl() command type is int List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Laurent Vivier , peter.maydell@linaro.org, riku.voipio@linaro.org Cc: qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --BKRKvtTohn0DwtoqwV9ngs4UhXAwgRBNw Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 06/15/2015 04:35 PM, Laurent Vivier wrote: > When executing a 64bit target chroot on 64bit host, > the ioctl() command can mismatch. >=20 >=20 > The origin of the problem is in syscall.c:do_ioctl(). >=20 > static abi_long do_ioctl(int fd, abi_long cmd, abi_long arg) It's annoying that Linux picked ioctl(int, unsigned long request, ...), particularly since POSIX picked ioctl(int, int request, ...) [1] and therefore Linux is constrained to never accept a 'request' that doesn't fit in 32 bits. Especially so since the POSIX definition of ioctl() applies only to the obsolete STREAMS interface that Linux never really picked up on. (The gnulib project has determined ways to write an ioctl() wrapper that always takes an int request, then widens to long as necessary before calling the real syscall, with no ill effects [2]) [1] http://pubs.opengroup.org/onlinepubs/9699919799/functions/ioctl.html [2] http://git.savannah.gnu.org/cgit/gnulib.git/tree/lib/ioctl.c However, I don't feel comfortable enough with this code to give a competent review, only to offer up that bit of trivia and the vague impression that it looks like you are safe in this patch. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --BKRKvtTohn0DwtoqwV9ngs4UhXAwgRBNw 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 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJVf1WqAAoJEKeha0olJ0Nqq7IH/0HuHBYJPgMPJyvURm80g8tb ag4yY7RvuPica9qUm4Olo1IImT0lCTzMDIy0fRfo1eYOv0wUXRCSf0AordM+vvC1 ZreuY94BgEdaNtrUKPtvvwCbc3+gdvbWG/D9ehpQ9TkM+M9vj0zCLoS13f1iUWw6 HmUho9vhYI1MzBKUZUXHCXdGtOlc2J0EbxBha29E+rZXYa1miZYq0CoqDRpeBY63 Yn8f9xhgJymj1Pi+IPkJIO90OZ1bGkArGzpNZkz36DYOlmTFAW1VUYu/X5gfo1NH deyG9QEFE09oOsiUplOVpewA+kf79t/iAUbEEICsyhjwIlJf6GSDJiP9HUsIkXc= =3zuV -----END PGP SIGNATURE----- --BKRKvtTohn0DwtoqwV9ngs4UhXAwgRBNw--