1. 16 6月, 2015 2 次提交
    • P
      linux-user: use __get_user and __put_user in cmsg conversions · 876e23cb
      Peter Maydell 提交于
      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: NPeter Maydell <peter.maydell@linaro.org>
      Signed-off-by: NRiku Voipio <riku.voipio@linaro.org>
      876e23cb
    • P
      linux-user: Fix length handling in host_to_target_cmsg · c2aeb258
      Peter Maydell 提交于
      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: NPeter Maydell <peter.maydell@linaro.org>
      Signed-off-by: NRiku Voipio <riku.voipio@linaro.org>
      c2aeb258
  2. 15 6月, 2015 2 次提交
  3. 12 6月, 2015 36 次提交