From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42520) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WVh77-0004QI-9J for qemu-devel@nongnu.org; Thu, 03 Apr 2014 08:51:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WVh71-0000xt-SK for qemu-devel@nongnu.org; Thu, 03 Apr 2014 08:51:25 -0400 Received: from afflict.kos.to ([92.243.29.197]:33279) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WVh71-0000xT-LA for qemu-devel@nongnu.org; Thu, 03 Apr 2014 08:51:19 -0400 From: riku.voipio@linaro.org Date: Thu, 3 Apr 2014 15:51:16 +0300 Message-Id: In-Reply-To: References: Subject: [Qemu-devel] [PULL for-2.0] linux-user: pass correct host flags to accept4() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, Petar Jovanovic From: Petar Jovanovic Flags NONBLOCK and CLOEXEC can have different values on the host and the guest, so set correct host values before calling accept4(). This fixes several issues with accept4 system call and user-mode of QEMU. Signed-off-by: Petar Jovanovic Reviewed-by: Peter Maydell Signed-off-by: Riku Voipio --- linux-user/syscall.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 2eac6d5..9864813 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -2062,9 +2062,12 @@ static abi_long do_accept4(int fd, abi_ulong target_addr, socklen_t addrlen; void *addr; abi_long ret; + int host_flags; + + host_flags = target_to_host_bitmask(flags, fcntl_flags_tbl); if (target_addr == 0) { - return get_errno(accept4(fd, NULL, NULL, flags)); + return get_errno(accept4(fd, NULL, NULL, host_flags)); } /* linux returns EINVAL if addrlen pointer is invalid */ @@ -2080,7 +2083,7 @@ static abi_long do_accept4(int fd, abi_ulong target_addr, addr = alloca(addrlen); - ret = get_errno(accept4(fd, addr, &addrlen, flags)); + ret = get_errno(accept4(fd, addr, &addrlen, host_flags)); if (!is_error(ret)) { host_to_target_sockaddr(target_addr, addr, addrlen); if (put_user_u32(addrlen, target_addrlen_addr)) -- 1.8.5.3