qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL 0/6] linux-user patches for 2.4 softfreeze
@ 2015-06-15 12:20 riku.voipio
  2015-06-15 12:20 ` [Qemu-devel] [PULL 1/6] linux-user: Allocate thunk size dynamically riku.voipio
                   ` (6 more replies)
  0 siblings, 7 replies; 15+ messages in thread
From: riku.voipio @ 2015-06-15 12:20 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell, Riku Voipio

From: Riku Voipio <riku.voipio@linaro.org>

The following changes since commit 0a2df857a7038c75379cc575de5d4be4c0ac629e:

  Merge remote-tracking branch 'remotes/stefanha/tags/net-pull-request' into staging (2015-06-12 15:39:05 +0100)

are available in the git repository at:

  git://git.linaro.org/people/riku.voipio/qemu.git tags/pull-linux-user-20150615

for you to fetch changes up to d2897da1f1e97d684f80ff62d473c31b79bc643a:

  linux-user: fix the breakpoint inheritance in spawned threads (2015-06-15 11:36:59 +0300)

----------------------------------------------------------------
linux-user patches for 2.4 softfreeze

----------------------------------------------------------------

Alexander Graf (1):
  linux-user: Allocate thunk size dynamically

Laurent Vivier (1):
  linux-user: ioctl() command type is int

Peter Maydell (2):
  linux-user: Fix length handling in host_to_target_cmsg
  linux-user: use __get_user and __put_user in cmsg conversions

Thierry Bultel (1):
  linux-user: fix the breakpoint inheritance in spawned threads

Yongbok Kim (1):
  linux-user: Use abi_ulong for TARGET_ELF_PAGESTART

 include/exec/user/thunk.h |   4 +-
 linux-user/elfload.c      |   3 +-
 linux-user/main.c         |   4 +-
 linux-user/syscall.c      | 110 +++++++++++++++++++++++++++++++++++-----------
 thunk.c                   |  16 +++++--
 5 files changed, 103 insertions(+), 34 deletions(-)

-- 
2.1.4

^ permalink raw reply	[flat|nested] 15+ messages in thread
* [Qemu-devel] [PATCH] linux-user: ioctl() command type is int
@ 2015-05-21 22:18 Laurent Vivier
  2015-05-23 13:17 ` [Qemu-devel] [PATCH v2] " Laurent Vivier
  0 siblings, 1 reply; 15+ messages in thread
From: Laurent Vivier @ 2015-05-21 22:18 UTC (permalink / raw)
  To: Riku Voipio; +Cc: Ed Swierk, qemu-devel, Laurent Vivier

When executing a 64bit target chroot on 64bit host,
the ioctl() command can mismatch.

It seems the previous commit doesn't solve the problem in
my case:

	9c6bf9c7 linux-user: Fix ioctl cmd type mismatch on 64-bit targets

For example, a ppc64 chroot on an x86_64 host:

bash-4.3# ls
Unsupported ioctl: cmd=0x80087467
Unsupported ioctl: cmd=0x802c7415

The origin of the problem is in syscall.c:do_ioctl().

	static abi_long do_ioctl(int fd, abi_long cmd, abi_long arg)

In this case (ppc64) abi_long is long (on the x86_64), and

    cmd = 0x0000000080087467

then
	if (ie->target_cmd == cmd)

target_cmd is int, so target_cmd = 0x80087467
and to compare an int with a long, the sign is extended to 64bit,
so the comparison is:

	if (0xffffffff80087467 == 0x0000000080087467)

which doesn't match whereas it should.

This patch uses abi_int in the case of the target command type
instead of abi_long (and for consistency, update IOCTLEntry).

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 linux-user/syscall.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 1622ad6..68801cf 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -3293,8 +3293,8 @@ typedef abi_long do_ioctl_fn(const IOCTLEntry *ie, uint8_t *buf_temp,
                              int fd, abi_long cmd, abi_long arg);
 
 struct IOCTLEntry {
-    int target_cmd;
-    unsigned int host_cmd;
+    abi_int target_cmd;
+    int host_cmd;
     const char *name;
     int access;
     do_ioctl_fn *do_ioctl;
@@ -3849,7 +3849,7 @@ static IOCTLEntry ioctl_entries[] = {
 
 /* ??? Implement proper locking for ioctls.  */
 /* do_ioctl() Must return target values and target errnos. */
-static abi_long do_ioctl(int fd, abi_long cmd, abi_long arg)
+static abi_long do_ioctl(int fd, abi_int cmd, abi_long arg)
 {
     const IOCTLEntry *ie;
     const argtype *arg_type;
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2015-06-16  6:57 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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).