summaryrefslogtreecommitdiffstats
path: root/linux-user/syscall.c
diff options
context:
space:
mode:
authorStefan Hajnoczi2022-11-03 15:55:05 +0100
committerStefan Hajnoczi2022-11-03 15:55:05 +0100
commitece5f8374d0416a339f0c0a9399faa2c42d4ad6f (patch)
treeeb63a019c322a1decb46608d390bbb5490c5fcf3 /linux-user/syscall.c
parentMerge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging (diff)
parentlinux-user: always translate cmsg when recvmsg (diff)
downloadqemu-ece5f8374d0416a339f0c0a9399faa2c42d4ad6f.tar.gz
qemu-ece5f8374d0416a339f0c0a9399faa2c42d4ad6f.tar.xz
qemu-ece5f8374d0416a339f0c0a9399faa2c42d4ad6f.zip
Merge tag 'linux-user-for-7.2-pull-request' of https://gitlab.com/laurent_vivier/qemu into staging
linux-user pull request 20221103 Fix recvmsg Fix hppa exception handler Add close_range Add strace for timer_settime64 # -----BEGIN PGP SIGNATURE----- # # iQJGBAABCAAwFiEEzS913cjjpNwuT1Fz8ww4vT8vvjwFAmNjgI0SHGxhdXJlbnRA # dml2aWVyLmV1AAoJEPMMOL0/L7485noP/jx8c5ytN+K5JbTLIdGYAbTJLm82Pnl5 # PP6mzaiII+gqBsmsTmmZhJ92xWjyX9kZmwCY7jD5XYXHQ2jFg3fU96ktYum7q8BU # XaPP4Cd6TfDE4q8H34PD/4byTGEkHP6o7EhAkIVAKsRQcQgZnsc3tvZetXxncltZ # UypPqAjvTy3s3uJFRmI4z9sYiAvjEflgk8doci/i5dOSgEBUmcCw/tFUx2GFrHiR # TdX8BRGaGEt+TPyKAo6sVBgTs1KiU4RzOqrPoxZO8aEClwPCRTLqNw/IONtHmx9f # EevuwDS7ZdoMdXi7YANDVy17JkmPBU3g8DFSWYGYObRpdmexmD66aW4kCeUYL0BC # y5aqxRWEi/7Kjvb6QlO3sJnAMfXaOQcCNn1++Tk1V8/O7f3k/xakya700fiMRIaQ # vyrW+g0TrCWEOgWl1Nyd0yDayX0wCM8CV/5SoO21QHjjzG+zmPxvroDpfVHcwbAl # V+wzVBj6AE5QBZKXUSE4b5DalcASF3pbUTorB5Xv/HDdsM1cRGZLBo7KECXqLKaa # L5VLgDdrZdSJz60f4P7Ldyhv0grb3C38JNqYg8fi8gWdj6dEc5M4coX84lA3JE7v # +Vf3Ys+lGC+DCSp2Qsh5FJvgsRn740ROToLJcXu3jxYPlquEsZpS1hpC+WOTRXOU # l2tnZIV9/SyH # =UZJY # -----END PGP SIGNATURE----- # gpg: Signature made Thu 03 Nov 2022 04:49:17 EDT # gpg: using RSA key CD2F75DDC8E3A4DC2E4F5173F30C38BD3F2FBE3C # gpg: issuer "laurent@vivier.eu" # gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>" [full] # gpg: aka "Laurent Vivier <laurent@vivier.eu>" [full] # gpg: aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>" [full] # Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F 5173 F30C 38BD 3F2F BE3C * tag 'linux-user-for-7.2-pull-request' of https://gitlab.com/laurent_vivier/qemu: linux-user: always translate cmsg when recvmsg linux-user: Add strace output for timer_settime64() syscall linux-user: Add close_range() syscall linux-user/hppa: Detect glibc ABORT_INSTRUCTION and EXCP_BREAK handler Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'linux-user/syscall.c')
-rw-r--r--linux-user/syscall.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 8402c1399d..24b25759be 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -364,6 +364,13 @@ _syscall3(int,sys_syslog,int,type,char*,bufp,int,len)
#ifdef __NR_exit_group
_syscall1(int,exit_group,int,error_code)
#endif
+#if defined(__NR_close_range) && defined(TARGET_NR_close_range)
+#define __NR_sys_close_range __NR_close_range
+_syscall3(int,sys_close_range,int,first,int,last,int,flags)
+#ifndef CLOSE_RANGE_CLOEXEC
+#define CLOSE_RANGE_CLOEXEC (1U << 2)
+#endif
+#endif
#if defined(__NR_futex)
_syscall6(int,sys_futex,int *,uaddr,int,op,int,val,
const struct timespec *,timeout,int *,uaddr2,int,val3)
@@ -3346,7 +3353,8 @@ static abi_long do_sendrecvmsg_locked(int fd, struct target_msghdr *msgp,
if (fd_trans_host_to_target_data(fd)) {
ret = fd_trans_host_to_target_data(fd)(msg.msg_iov->iov_base,
MIN(msg.msg_iov->iov_len, len));
- } else {
+ }
+ if (!is_error(ret)) {
ret = host_to_target_cmsg(msgp, &msg);
}
if (!is_error(ret)) {
@@ -8756,6 +8764,18 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
case TARGET_NR_close:
fd_trans_unregister(arg1);
return get_errno(close(arg1));
+#if defined(__NR_close_range) && defined(TARGET_NR_close_range)
+ case TARGET_NR_close_range:
+ ret = get_errno(sys_close_range(arg1, arg2, arg3));
+ if (ret == 0 && !(arg3 & CLOSE_RANGE_CLOEXEC)) {
+ abi_long fd, maxfd;
+ maxfd = MIN(arg2, target_fd_max);
+ for (fd = arg1; fd < maxfd; fd++) {
+ fd_trans_unregister(fd);
+ }
+ }
+ return ret;
+#endif
case TARGET_NR_brk:
return do_brk(arg1);