]> git.ipfire.org Git - thirdparty/qemu.git/commit
linux-user: Fix accept4(SOCK_NONBLOCK) syscall
authorHelge Deller <deller@gmx.de>
Sat, 8 Jul 2023 05:24:00 +0000 (07:24 +0200)
committerMichael Tokarev <mjt@tls.msk.ru>
Mon, 31 Jul 2023 05:52:38 +0000 (08:52 +0300)
commit43462f77061389368b9ee9d79061fa34ae1292e1
tree7b5b6459f9c53279de84bedb585a113d9fc2c713
parent741df485e8aec3f509a4e26c975e4cdc94239c88
linux-user: Fix accept4(SOCK_NONBLOCK) syscall

The Linux accept4() syscall allows two flags only: SOCK_NONBLOCK and
SOCK_CLOEXEC, and returns -EINVAL if any other bits have been set.

Change the qemu implementation accordingly, which means we can not use
the fcntl_flags_tbl[] translation table which allows too many other
values.

Beside the correction in behaviour, this actually fixes the accept4()
emulation for hppa, mips and alpha targets for which SOCK_NONBLOCK is
different than TARGET_SOCK_NONBLOCK (aka O_NONBLOCK).

The fix can be verified with the testcase of the debian lwt package,
which hangs forever in a read() syscall without this patch.

Signed-off-by: Helge Deller <deller@gmx.de>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
(cherry picked from commit dca4c8384d68bbf5d67f50a5446865d92d61f032)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
linux-user/syscall.c