[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 4/9] linux-user: Fix sendrecvmsg() with QEMU_GUEST_B
From: |
Alexander Graf |
Subject: |
[Qemu-devel] [PATCH 4/9] linux-user: Fix sendrecvmsg() with QEMU_GUEST_BASE |
Date: |
Sat, 6 Jul 2013 02:36:13 +0200 |
While looking for cmsg entries, we want to compare guest pointers to see
whether we're at the end of the passed in array.
However, what we really do is we compare our in-use host pointer with the
to-be-the-end guest pointer. This comparison is obviously bogus.
Change the comparison to compare guest pointer with guest pointer.
Signed-off-by: Alexander Graf <address@hidden>
---
linux-user/syscall_defs.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index 92c01a9..8b06a19 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -214,7 +214,7 @@ __target_cmsg_nxthdr (struct target_msghdr *__mhdr, struct
target_cmsghdr *__cms
__ptr = (struct target_cmsghdr *)((unsigned char *) __cmsg
+ TARGET_CMSG_ALIGN
(tswapal(__cmsg->cmsg_len)));
- if ((unsigned long)((char *)(__ptr+1) - (char
*)(size_t)tswapal(__mhdr->msg_control))
+ if ((unsigned long)((char *)(h2g(__ptr+1)) - (char
*)(size_t)tswapal(__mhdr->msg_control))
> tswapal(__mhdr->msg_controllen))
/* No more entries. */
return (struct target_cmsghdr *)0;
--
1.6.0.2
- Re: [Qemu-devel] [PATCH 1/9] linux-user: fix segmentation fault passing with h2g(x) != x, (continued)
- [Qemu-devel] [PATCH 2/9] linux-user: Add is_write segfault check for ARM hosts, Alexander Graf, 2013/07/05
- [Qemu-devel] [PATCH 5/9] linux-user: Fix epoll on ARM hosts, Alexander Graf, 2013/07/05
- [Qemu-devel] [PATCH 3/9] linux-user: Don't reset a new thread's CPU, Alexander Graf, 2013/07/05
- [Qemu-devel] [PATCH 8/9] linux-user: Default to 64k guest base, Alexander Graf, 2013/07/05
- [Qemu-devel] [PATCH 4/9] linux-user: Fix sendrecvmsg() with QEMU_GUEST_BASE,
Alexander Graf <=
- [Qemu-devel] [PATCH 9/9] linux-user: Unlock mmap_lock when resuming guest from page_unprotect, Alexander Graf, 2013/07/05
- [Qemu-devel] [PATCH 6/9] linux-user: Add i386 TLS setter, Alexander Graf, 2013/07/05
- [Qemu-devel] [PATCH 7/9] linux-user: Enable NPTL for i386, Alexander Graf, 2013/07/05