1. 26 6月, 2016 2 次提交
    • P
      linux-user: Use safe_syscall wrapper for fcntl · 435da5e7
      Peter Maydell 提交于
      Use the safe_syscall wrapper for fcntl. This is straightforward now
      that we always use 'struct fcntl64' on the host, as we don't need
      to select whether to call the host's fcntl64 or fcntl syscall
      (a detail that the libc previously hid for us).
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: NLaurent Vivier <laurent@vivier.eu>
      Signed-off-by: NRiku Voipio <riku.voipio@linaro.org>
      435da5e7
    • P
      linux-user: Use __get_user() and __put_user() to handle structs in do_fcntl() · 213d3e9e
      Peter Maydell 提交于
      Use the __get_user() and __put_user() to handle reading and writing the
      guest structures in do_ioctl(). This has two benefits:
       * avoids possible errors due to misaligned guest pointers
       * correctly sign extends signed fields (like l_start in struct flock)
         which might be different sizes between guest and host
      
      To do this we abstract out into copy_from/to_user functions. We
      also standardize on always using host flock64 and the F_GETLK64
      etc flock commands, as this means we always have 64 bit offsets
      whether the host is 64-bit or 32-bit and we don't need to support
      conversion to both host struct flock and struct flock64.
      
      In passing we fix errors in converting l_type from the host to
      the target (where we were doing a byteswap of the host value
      before trying to do the convert-bitmasks operation rather than
      otherwise, and inexplicably shifting left by 1); these were
      accidentally left over when the original simple "just shift by 1"
      arm<->x86 conversion of commit 43f238d7 was changed to the more
      general scheme of using target_to_host_bitmask() functions in 2ba7f730.
      
      [RV: fixed ifdef guard for eabi functions]
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: NLaurent Vivier <laurent@vivier.eu>
      Signed-off-by: NRiku Voipio <riku.voipio@linaro.org>
      213d3e9e
  2. 24 6月, 2016 1 次提交
    • P
      linux-user: Avoid possible misalignment in host_to_target_siginfo() · 55d72a7e
      Peter Maydell 提交于
      host_to_target_siginfo() is implemented by a combination of
      host_to_target_siginfo_noswap() followed by tswap_siginfo().
      The first of these two functions assumes that the target_siginfo_t
      it is writing to is correctly aligned, but the pointer passed
      into host_to_target_siginfo() is directly from the guest and
      might be misaligned. Use a local variable to avoid this problem.
      (tswap_siginfo() does now correctly handle a misaligned destination.)
      
      We have to add a memset() to host_to_target_siginfo_noswap()
      to avoid some false positive "may be used uninitialized" warnings
      from gcc about subfields of the _sifields union if it chooses to
      inline both tswap_siginfo() and host_to_target_siginfo_noswap()
      into host_to_target_siginfo().
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: NLaurent Vivier <laurent@vivier.eu>
      Signed-off-by: NPeter Maydell <riku.voipio@linaro.org>
      55d72a7e
  3. 23 6月, 2016 14 次提交
  4. 22 6月, 2016 14 次提交
  5. 21 6月, 2016 9 次提交