diff --git a/linux-user/syscall.c b/linux-user/syscall.c index b363944e74..bcae62d068 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -716,6 +716,12 @@ safe_syscall3(ssize_t, readv, int, fd, const struct iovec *, iov, int, iovcnt) safe_syscall3(ssize_t, writev, int, fd, const struct iovec *, iov, int, iovcnt) safe_syscall3(int, connect, int, fd, const struct sockaddr *, addr, socklen_t, addrlen) +safe_syscall6(ssize_t, sendto, int, fd, const void *, buf, size_t, len, + int, flags, const struct sockaddr *, addr, socklen_t, addrlen) +safe_syscall6(ssize_t, recvfrom, int, fd, void *, buf, size_t, len, + int, flags, struct sockaddr *, addr, socklen_t *, addrlen) +safe_syscall3(ssize_t, sendmsg, int, fd, const struct msghdr *, msg, int, flags) +safe_syscall3(ssize_t, recvmsg, int, fd, struct msghdr *, msg, int, flags) static inline int host_to_target_sock_type(int host_type) { @@ -2910,10 +2916,10 @@ static abi_long do_sendrecvmsg_locked(int fd, struct target_msghdr *msgp, ret = target_to_host_cmsg(&msg, msgp); } if (ret == 0) { - ret = get_errno(sendmsg(fd, &msg, flags)); + ret = get_errno(safe_sendmsg(fd, &msg, flags)); } } else { - ret = get_errno(recvmsg(fd, &msg, flags)); + ret = get_errno(safe_recvmsg(fd, &msg, flags)); if (!is_error(ret)) { len = ret; if (fd_trans_host_to_target_data(fd)) { @@ -3162,9 +3168,9 @@ static abi_long do_sendto(int fd, abi_ulong msg, size_t len, int flags, unlock_user(host_msg, msg, 0); return ret; } - ret = get_errno(sendto(fd, host_msg, len, flags, addr, addrlen)); + ret = get_errno(safe_sendto(fd, host_msg, len, flags, addr, addrlen)); } else { - ret = get_errno(send(fd, host_msg, len, flags)); + ret = get_errno(safe_sendto(fd, host_msg, len, flags, NULL, 0)); } unlock_user(host_msg, msg, 0); return ret; @@ -3193,10 +3199,11 @@ static abi_long do_recvfrom(int fd, abi_ulong msg, size_t len, int flags, goto fail; } addr = alloca(addrlen); - ret = get_errno(recvfrom(fd, host_msg, len, flags, addr, &addrlen)); + ret = get_errno(safe_recvfrom(fd, host_msg, len, flags, + addr, &addrlen)); } else { addr = NULL; /* To keep compiler quiet. */ - ret = get_errno(qemu_recv(fd, host_msg, len, flags)); + ret = get_errno(safe_recvfrom(fd, host_msg, len, flags, NULL, 0)); } if (!is_error(ret)) { if (target_addr) {