qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Laurent Vivier <laurent@vivier.eu>,
	peter.maydell@linaro.org, riku.voipio@linaro.org
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2] linux-user: ioctl() command type is int
Date: Mon, 15 Jun 2015 16:46:01 -0600	[thread overview]
Message-ID: <557F55A9.6@redhat.com> (raw)
In-Reply-To: <1434407728-7260-1-git-send-email-laurent@vivier.eu>

[-- Attachment #1: Type: text/plain, Size: 1295 bytes --]

On 06/15/2015 04:35 PM, Laurent Vivier wrote:
> When executing a 64bit target chroot on 64bit host,
> the ioctl() command can mismatch.
> 

> 
> The origin of the problem is in syscall.c:do_ioctl().
> 
> 	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.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

  reply	other threads:[~2015-06-15 22:46 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-15 12:20 [Qemu-devel] [PULL 0/6] linux-user patches for 2.4 softfreeze riku.voipio
2015-06-15 12:20 ` [Qemu-devel] [PULL 1/6] linux-user: Allocate thunk size dynamically riku.voipio
2015-06-15 12:20 ` [Qemu-devel] [PULL 2/6] linux-user: Use abi_ulong for TARGET_ELF_PAGESTART riku.voipio
2015-06-15 12:20 ` [Qemu-devel] [PULL 3/6] linux-user: ioctl() command type is int riku.voipio
2015-06-15 12:20 ` [Qemu-devel] [PULL 4/6] linux-user: Fix length handling in host_to_target_cmsg riku.voipio
2015-06-15 12:20 ` [Qemu-devel] [PULL 5/6] linux-user: use __get_user and __put_user in cmsg conversions riku.voipio
2015-06-15 12:20 ` [Qemu-devel] [PULL 6/6] linux-user: fix the breakpoint inheritance in spawned threads riku.voipio
2015-06-15 15:14 ` [Qemu-devel] [PULL 0/6] linux-user patches for 2.4 softfreeze Peter Maydell
2015-06-15 15:26   ` Laurent Vivier
2015-06-15 22:35   ` [Qemu-devel] [PATCH v2] linux-user: ioctl() command type is int Laurent Vivier
2015-06-15 22:46     ` Eric Blake [this message]
2015-06-16  6:57     ` Riku Voipio
  -- strict thread matches above, loose matches on Subject: below --
2015-05-21 22:18 [Qemu-devel] [PATCH] " Laurent Vivier
2015-05-23 13:17 ` [Qemu-devel] [PATCH v2] " Laurent Vivier
2015-05-23 21:07   ` Peter Maydell
2015-06-12 13:06   ` Riku Voipio

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=557F55A9.6@redhat.com \
    --to=eblake@redhat.com \
    --cc=laurent@vivier.eu \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=riku.voipio@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).