qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] 8be656: linux-user: Allocate thunk size dynam


From: GitHub
Subject: [Qemu-commits] [qemu/qemu] 8be656: linux-user: Allocate thunk size dynamically
Date: Tue, 16 Jun 2015 03:00:07 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 8be656b87c6bb1b9f8af3ff78094413d71e4443a
      
https://github.com/qemu/qemu/commit/8be656b87c6bb1b9f8af3ff78094413d71e4443a
  Author: Alexander Graf <address@hidden>
  Date:   2015-06-15 (Mon, 15 Jun 2015)

  Changed paths:
    M include/exec/user/thunk.h
    M linux-user/syscall.c
    M thunk.c

  Log Message:
  -----------
  linux-user: Allocate thunk size dynamically

We store all struct types in an array of static size without ever
checking whether we overrun it. Of course some day someone (like me
in another, ancient ALSA enabling patch set) will run into the limit
without realizing it.

So let's make the allocation dynamic. We already know the number of
structs that we want to allocate, so we only need to pass the variable
into the respective piece of code.

Also, to ensure we don't accidently overwrite random memory, add some
asserts to sanity check whether a thunk is actually part of our array.

Signed-off-by: Alexander Graf <address@hidden>
Signed-off-by: Riku Voipio <address@hidden>


  Commit: 79cb1f1d698da5e1e183863aa3c8a91b2e750664
      
https://github.com/qemu/qemu/commit/79cb1f1d698da5e1e183863aa3c8a91b2e750664
  Author: Yongbok Kim <address@hidden>
  Date:   2015-06-15 (Mon, 15 Jun 2015)

  Changed paths:
    M linux-user/elfload.c

  Log Message:
  -----------
  linux-user: Use abi_ulong for TARGET_ELF_PAGESTART

TARGET_ELF_PAGESTART is required to use abi_ulong to correctly handle
addresses for different target bits width.
This patch fixes a problem when running a 64-bit user mode application
on 32-bit host machines.

Signed-off-by: Yongbok Kim <address@hidden>
Reviewed-by: Peter Maydell <address@hidden>
Signed-off-by: Riku Voipio <address@hidden>


  Commit: c2aeb2586bd258ad76fcfe308f883075e73ff1d2
      
https://github.com/qemu/qemu/commit/c2aeb2586bd258ad76fcfe308f883075e73ff1d2
  Author: Peter Maydell <address@hidden>
  Date:   2015-06-16 (Tue, 16 Jun 2015)

  Changed paths:
    M linux-user/syscall.c

  Log Message:
  -----------
  linux-user: Fix length handling in host_to_target_cmsg

The previous code for handling payload length when converting
cmsg structures from host to target had a number of problems:
 * we required the msg->msg_controllen to declare the buffer
   to have enough space for final trailing padding (we were
   checking against CMSG_SPACE), whereas the kernel does not
   require this, and common userspace code assumes this. (In
   particular, glibc's "try to talk to nscd" code that it will
   run on startup will receive a cmsg with a 4 byte payload and
   only allocate 4 bytes for it, which was causing us to do
   the wrong thing on architectures that need 8-alignment.)
 * we weren't correctly handling the fact that the SO_TIMESTAMP
   payload may be larger for the target than the host
 * we weren't marking the messages with MSG_CTRUNC when we did
   need to truncate a message that wasn't truncated by the host,
   but were instead logging a QEMU message; since truncation is
   always the result of a guest giving us an insufficiently
   sized buffer, we should report it to the guest as the kernel
   does and don't log anything

Rewrite the parts of the function that deal with length to
fix these issues, and add a comment in target_to_host_cmsg
to explain why the overflow logging it does is a QEMU bug,
not a guest issue.

Signed-off-by: Peter Maydell <address@hidden>
Signed-off-by: Riku Voipio <address@hidden>


  Commit: 876e23cb2e545148a0ee4effda5c63c861855941
      
https://github.com/qemu/qemu/commit/876e23cb2e545148a0ee4effda5c63c861855941
  Author: Peter Maydell <address@hidden>
  Date:   2015-06-16 (Tue, 16 Jun 2015)

  Changed paths:
    M linux-user/syscall.c

  Log Message:
  -----------
  linux-user: use __get_user and __put_user in cmsg conversions

The target payloads in cmsg conversions may not have the alignment
required by the host. Using the get_user and put_user functions is
the easiest way to handle this and also do the byte-swapping we
require.

(Note that prior to this commit target_to_host_cmsg was incorrectly
using __put_user() rather than __get_user() for the SCM_CREDENTIALS
conversion, which meant it wasn't getting the benefit of the
misalignment handling.)

Signed-off-by: Peter Maydell <address@hidden>
Signed-off-by: Riku Voipio <address@hidden>


  Commit: 1d085f6cae51b1a0fb92ad03ce8bf038e29c9750
      
https://github.com/qemu/qemu/commit/1d085f6cae51b1a0fb92ad03ce8bf038e29c9750
  Author: Thierry Bultel <address@hidden>
  Date:   2015-06-16 (Tue, 16 Jun 2015)

  Changed paths:
    M linux-user/main.c

  Log Message:
  -----------
  linux-user: fix the breakpoint inheritance in spawned threads

When a thread is spawned, cpu_copy re-initializes
the bp & wp lists of current thread, instead of the ones
of the new thread.
The effect is that breakpoints are no longer hit.

Signed-off-by: Thierry Bultel <address@hidden>
Signed-off-by: Riku Voipio <address@hidden>


  Commit: 45c874ebbae661238bfa3c0534480ebe2940b112
      
https://github.com/qemu/qemu/commit/45c874ebbae661238bfa3c0534480ebe2940b112
  Author: Laurent Vivier <address@hidden>
  Date:   2015-06-16 (Tue, 16 Jun 2015)

  Changed paths:
    M linux-user/syscall.c

  Log Message:
  -----------
  linux-user: ioctl() command type is int

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 int in the case of the target command type
instead of abi_long.

Signed-off-by: Laurent Vivier <address@hidden>
Signed-off-by: Riku Voipio <address@hidden>


  Commit: 4316536bf424d2e7f9cfa7d0dd561adb0986cc81
      
https://github.com/qemu/qemu/commit/4316536bf424d2e7f9cfa7d0dd561adb0986cc81
  Author: Peter Maydell <address@hidden>
  Date:   2015-06-16 (Tue, 16 Jun 2015)

  Changed paths:
    M include/exec/user/thunk.h
    M linux-user/elfload.c
    M linux-user/main.c
    M linux-user/syscall.c
    M thunk.c

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/riku/tags/pull-linux-user-20150616' 
into staging

linux-user patches for 2.4 softfreeze
second spin with ioctl patch refreshed

# gpg: Signature made Tue Jun 16 08:03:14 2015 BST using RSA key ID DE3C9BC0
# gpg: Good signature from "Riku Voipio <address@hidden>"
# gpg:                 aka "Riku Voipio <address@hidden>"

* remotes/riku/tags/pull-linux-user-20150616:
  linux-user: ioctl() command type is int
  linux-user: fix the breakpoint inheritance in spawned threads
  linux-user: use __get_user and __put_user in cmsg conversions
  linux-user: Fix length handling in host_to_target_cmsg
  linux-user: Use abi_ulong for TARGET_ELF_PAGESTART
  linux-user: Allocate thunk size dynamically

Signed-off-by: Peter Maydell <address@hidden>


Compare: https://github.com/qemu/qemu/compare/1dfe73b94de5...4316536bf424

reply via email to

[Prev in Thread] Current Thread [Next in Thread]