qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/2] linux-user: Fix length handling in cmsg conversions
@ 2015-05-26 18:46 Peter Maydell
  2015-05-26 18:46 ` [Qemu-devel] [PATCH 1/2] linux-user: Fix length handling in host_to_target_cmsg Peter Maydell
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Peter Maydell @ 2015-05-26 18:46 UTC (permalink / raw)
  To: qemu-devel; +Cc: Riku Voipio, patches

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

-- 
1.9.1

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

end of thread, other threads:[~2015-06-06 10:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-26 18:46 [Qemu-devel] [PATCH 0/2] linux-user: Fix length handling in cmsg conversions Peter Maydell
2015-05-26 18:46 ` [Qemu-devel] [PATCH 1/2] linux-user: Fix length handling in host_to_target_cmsg Peter Maydell
2015-05-26 18:46 ` [Qemu-devel] [PATCH 2/2] linux-user: use __get_user and __put_user in cmsg conversions Peter Maydell
2015-06-05 15:03 ` [Qemu-devel] [PATCH 0/2] linux-user: Fix length handling " Peter Maydell
2015-06-06 10:07   ` 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).