Skip to contentSkip to conversation

linux-user: fix accept4 flags

GIT PULL Applied [email protected] 2 participants 3 messages Apr 3, 2014

lore
Share & tools
lore
#0 lore raw

From: Riku Voipio <[email protected]>

The following changes since commit 63678e17cf399ff81b93417fe7bee8d6ef6b6b1b:

configure: add option to disable -fstack-protector flags (2014-03-31 20:16:02 +0100)

are available in the git repository at:

git://git.linaro.org/people/riku.voipio/qemu.git for-2.0

for you to fetch changes up to d25295d4efc53bf8521adf967445b8d087fe8d39:

linux-user: pass correct host flags to accept4() (2014-04-01 09:17:19 +0300)

Petar Jovanovic (1):
linux-user: pass correct host flags to accept4()

 linux-user/syscall.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
Signature · 1 line
1.8.5.3
#1 lore raw

[Qemu-devel] [PULL for-2.0] linux-user: pass correct host flags to accept4()

From: Petar Jovanovic <[email protected]>

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.

---
 linux-user/syscall.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
linux-user/syscall.c +5 -2
index 2eac6d5..9864813 100644
@@ -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))
Signature · 1 line
1.8.5.3
#2 lore raw
In reply to [email protected]
Quoted 12 lines · On 3 April 2014 13:51, <[email protected]> wrote:

From: Riku Voipio <[email protected]>

The following changes since commit 63678e17cf399ff81b93417fe7bee8d6ef6b6b1b:

configure: add option to disable -fstack-protector flags (2014-03-31 20:16:02 +0100)

are available in the git repository at:

git://git.linaro.org/people/riku.voipio/qemu.git for-2.0

for you to fetch changes up to d25295d4efc53bf8521adf967445b8d087fe8d39:

Quoted 7 lines

linux-user: pass correct host flags to accept4() (2014-04-01 09:17:19 +0300)

Petar Jovanovic (1):
linux-user: pass correct host flags to accept4()

 linux-user/syscall.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Applied, thanks.

-- PMM