[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2] linux-user: ioctl() command type is int
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v2] linux-user: ioctl() command type is int |
Date: |
Mon, 15 Jun 2015 16:46:01 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 |
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
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [PULL 0/6] linux-user patches for 2.4 softfreeze, riku . voipio, 2015/06/15
- [Qemu-devel] [PULL 2/6] linux-user: Use abi_ulong for TARGET_ELF_PAGESTART, riku . voipio, 2015/06/15
- [Qemu-devel] [PULL 5/6] linux-user: use __get_user and __put_user in cmsg conversions, riku . voipio, 2015/06/15
- [Qemu-devel] [PULL 6/6] linux-user: fix the breakpoint inheritance in spawned threads, riku . voipio, 2015/06/15
- [Qemu-devel] [PULL 1/6] linux-user: Allocate thunk size dynamically, riku . voipio, 2015/06/15
- [Qemu-devel] [PULL 3/6] linux-user: ioctl() command type is int, riku . voipio, 2015/06/15
- [Qemu-devel] [PULL 4/6] linux-user: Fix length handling in host_to_target_cmsg, riku . voipio, 2015/06/15
- Re: [Qemu-devel] [PULL 0/6] linux-user patches for 2.4 softfreeze, Peter Maydell, 2015/06/15