qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Cc: patches@linaro.org, Riku Voipio <riku.voipio@iki.fi>,
	Laurent Vivier <laurent@vivier.eu>, pgndev <pgnet.dev@gmail.com>
Subject: [Qemu-devel] [PATCH 0/2] fix incorrect target ioctl numbers
Date: Thu, 12 Oct 2017 16:30:43 +0100	[thread overview]
Message-ID: <1507822245-15748-1-git-send-email-peter.maydell@linaro.org> (raw)

Some of our TARGET_* constant definitions for ioctls were
wrong because the ioctl number is based on the sizeof()
the type passed to the TARGET_IO* macros, and we were
passing a host type rather than a target type.
This was originally reported as a bug where the
FS_IOC_{GET,SET}FLAGS ioctls weren't working for 32-bit
arm guests on x86-64 hosts.

I did a quick audit of all the uses of the TARGET_IO* macros
in syscall_defs.h, and:
 * FS_IOC_GETFLAGS/SETFLAGS are indeed wrong
 * 3 ioctls to do with magtapes are also wrong
 * TARGET_FS_IOC_FIEMAP, TARGET_FICLONERANGE and
   TARGET_SOUND_MIXER_INFO take a host struct which
   is defined such that it's the same size for all archs
 * lots and lots of ioctls use 'int', which is OK as for
   us 'abi_int' is always 32 bits (it might have different
   alignment requirements, but they don't matter for this
   purpose)
 * TARGET_SIOCPGRP takes a pid_t, which is always 'int'

This patchset fixes the bugs in the first two bullet
points, and leaves everything else alone since it doesn't
actually manifest as wrong behaviour.

Patch 1 is tested by the LTP 'setxattrs3' test case.
There's no LTP test case for the magtape ioctls, so that
patch change is untested.


Peter Maydell (2):
  linux-user: Fix target FS_IOC_GETFLAGS and FS_IOC_SETFLAGS numbers
  linux-user: Fix TARGET_MTIOCTOP/MTIOCGET/MTIOCPOS values

 linux-user/syscall_defs.h | 35 ++++++++++++++++++++++++++++++-----
 1 file changed, 30 insertions(+), 5 deletions(-)

-- 
2.7.4

             reply	other threads:[~2017-10-12 15:49 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-12 15:30 Peter Maydell [this message]
2017-10-12 15:30 ` [Qemu-devel] [PATCH 1/2] linux-user: Fix target FS_IOC_GETFLAGS and FS_IOC_SETFLAGS numbers Peter Maydell
2017-10-12 16:34   ` Laurent Vivier
2017-10-16 13:05   ` Riku Voipio
2017-10-12 15:30 ` [Qemu-devel] [PATCH 2/2] linux-user: Fix TARGET_MTIOCTOP/MTIOCGET/MTIOCPOS values Peter Maydell
2017-10-12 16:49   ` Laurent Vivier
2017-10-12 16:53     ` Peter Maydell
2017-10-12 17:08       ` Laurent Vivier
2017-10-16 13:06         ` Riku Voipio
2017-10-16 13:09           ` Laurent Vivier
2017-10-16 13:26             ` Peter Maydell
2017-10-16 13:29               ` Laurent Vivier

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=1507822245-15748-1-git-send-email-peter.maydell@linaro.org \
    --to=peter.maydell@linaro.org \
    --cc=laurent@vivier.eu \
    --cc=patches@linaro.org \
    --cc=pgnet.dev@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=riku.voipio@iki.fi \
    /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).