[Top][All Lists]

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

[Qemu-devel] [PATCH 0/2] linux-user: Fix length handling in cmsg convers

From: Peter Maydell
Subject: [Qemu-devel] [PATCH 0/2] linux-user: Fix length handling in cmsg conversions
Date: Tue, 26 May 2015 19:46:30 +0100

This patchset fixes some problems in conversions of cmsg structures
in target_to_host_cmsg() (used in send/recvmsg handling). Specifically:

     * 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.
     * 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
     * we weren't handling the possibility of the host having a
       more restrictive alignment requirement for payload structs

The major visible issue I wanted to fix is that 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 allocates 4 bytes for it, which was causing
us to do the wrong thing on architectures that need 8-alignment
(we dropped the cmsg and printed a diagnostic message).

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

 linux-user/syscall.c | 89 ++++++++++++++++++++++++++++++++++++++++++----------
 1 file changed, 72 insertions(+), 17 deletions(-)


reply via email to

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