Skip to content

Commit

Permalink
linuxulator: Change the use of iovec to l_iovec64 in linuxulator
Browse files Browse the repository at this point in the history
  • Loading branch information
w4123 committed Oct 29, 2024
1 parent ee570af commit 88ea910
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
6 changes: 3 additions & 3 deletions sys/compat/linux/linux_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -1037,7 +1037,7 @@ linux_preadv(struct thread *td, struct linux_preadv_args *uap)
#ifdef COMPAT_LINUX32
error = freebsd32_copyinuio(PTRIN(uap->vec), uap->vlen, &auio);
#else
error = freebsd64_copyinuio(__USER_CAP_ARRAY(((struct iovec64*)uap->vec), uap->vlen), uap->vlen, &auio);
error = linux64_copyinuio(__USER_CAP_ARRAY(((struct l_iovec64*)uap->vec), uap->vlen), uap->vlen, &auio);
#endif
if (error != 0)
return (error);
Expand All @@ -1064,7 +1064,7 @@ linux_pwritev(struct thread *td, struct linux_pwritev_args *uap)
#ifdef COMPAT_LINUX32
error = freebsd32_copyinuio(PTRIN(uap->vec), uap->vlen, &auio);
#else
error = freebsd64_copyinuio(__USER_CAP_ARRAY(((struct iovec64*)uap->vec), uap->vlen), uap->vlen, &auio);
error = linux64_copyinuio(__USER_CAP_ARRAY(((struct l_iovec64*)uap->vec), uap->vlen), uap->vlen, &auio);
#endif
if (error != 0)
return (error);
Expand Down Expand Up @@ -1871,7 +1871,7 @@ linux_writev(struct thread *td, struct linux_writev_args *args)
#ifdef COMPAT_LINUX32
error = freebsd32_copyinuio(PTRIN(args->iovp), args->iovcnt, &auio);
#else
error = freebsd64_copyinuio(__USER_CAP_ARRAY(((struct iovec64*)args->iovp), args->iovcnt), args->iovcnt, &auio);
error = linux64_copyinuio(__USER_CAP_ARRAY(((struct l_iovec64*)args->iovp), args->iovcnt), args->iovcnt, &auio);
#endif
if (error != 0)
return (error);
Expand Down
7 changes: 3 additions & 4 deletions sys/compat/linux/linux_socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -703,8 +703,7 @@ linux_to_bsd_msghdr(struct msghdr *bhdr, const struct l_msghdr *lhdr)

bhdr->msg_name = __USER_CAP(lhdr->msg_name, lhdr->msg_namelen);
bhdr->msg_namelen = lhdr->msg_namelen;
// TODO: May be wrong due to incompatible types
bhdr->msg_iov = __USER_CAP(lhdr->msg_iov, lhdr->msg_iovlen * sizeof(struct iovec));
bhdr->msg_iov = __USER_CAP(lhdr->msg_iov, lhdr->msg_iovlen * sizeof(struct l_iovec64));
bhdr->msg_iovlen = lhdr->msg_iovlen;
// TODO: Check
bhdr->msg_control = __USER_CAP_UNBOUND(lhdr->msg_control);
Expand Down Expand Up @@ -1396,7 +1395,7 @@ linux_sendmsg_common(struct thread *td, l_int s, struct l_msghdr * __capability
error = freebsd32_copyiniov(PTRIN(msg.msg_iov), msg.msg_iovlen,
&iov, EMSGSIZE);
#else
error = copyiniov(msg.msg_iov, msg.msg_iovlen, &iov, EMSGSIZE);
error = linux64_copyiniov((void * __capability)msg.msg_iov, msg.msg_iovlen, &iov, EMSGSIZE);
#endif
if (error != 0)
return (error);
Expand Down Expand Up @@ -1805,7 +1804,7 @@ linux_recvmsg_common(struct thread *td, l_int s, struct l_msghdr * __capability
error = freebsd32_copyiniov(PTRIN(msg->msg_iov), msg->msg_iovlen,
&iov, EMSGSIZE);
#else
error = copyiniov(msg->msg_iov, msg->msg_iovlen, &iov, EMSGSIZE);
error = linux64_copyiniov((void * __capability)msg.msg_iov, msg->msg_iovlen, &iov, EMSGSIZE);
#endif
if (error != 0)
return (error);
Expand Down

0 comments on commit 88ea910

Please sign in to comment.