From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Cc: Riku Voipio <riku.voipio@iki.fi>, patches@linaro.org
Subject: [Qemu-devel] [PATCH 0/2] linux-user: Fix length handling in cmsg conversions
Date: Tue, 26 May 2015 19:46:30 +0100 [thread overview]
Message-ID: <1432665992-32622-1-git-send-email-peter.maydell@linaro.org> (raw)
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
next reply other threads:[~2015-05-26 18:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-26 18:46 Peter Maydell [this message]
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
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=1432665992-32622-1-git-send-email-peter.maydell@linaro.org \
--to=peter.maydell@linaro.org \
--cc=patches@linaro.org \
--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).