git: 2a717d519e04 - main - uio: make *copyinuio take a void *
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 26 Sep 2026 11:06:06 UTC
The branch main has been updated by brooks:
URL: https://cgit.FreeBSD.org/src/commit/?id=2a717d519e04c5af9f70fb0c0cad0e25aba62d0b
commit 2a717d519e04c5af9f70fb0c0cad0e25aba62d0b
Author: Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2026-09-26 11:05:43 +0000
Commit: Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2026-09-26 11:05:43 +0000
uio: make *copyinuio take a void *
This aligns with copyinuio_t and avoids some hypothetical undefined
behavor around calling functions with mismatched types.
Reviewed by: kib
Effort: CHERI upstreaming
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D60024
---
sys/compat/freebsd32/freebsd32_misc.c | 10 ++++++----
sys/compat/freebsd32/freebsd32_util.h | 3 +--
sys/kern/subr_uio.c | 2 +-
sys/sys/uio.h | 2 +-
4 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c
index 7b4b0cdcfa4b..5900c7d03ce1 100644
--- a/sys/compat/freebsd32/freebsd32_misc.c
+++ b/sys/compat/freebsd32/freebsd32_misc.c
@@ -1288,20 +1288,22 @@ freebsd32_pdptrace(struct thread *td, struct freebsd32_pdptrace_args *uap)
}
int
-freebsd32_copyinuio(const struct iovec32 *iovp, u_int iovcnt, struct uio **uiop)
+freebsd32_copyinuio(const void *iovp, u_int iovcnt, struct uio **uiop)
{
struct iovec32 iov32;
+ const struct iovec32 *iovp32;
struct iovec *iov;
struct uio *uio;
int error, i;
+ iovp32 = iovp;
*uiop = NULL;
if (iovcnt > UIO_MAXIOV)
return (EINVAL);
uio = allocuio(iovcnt);
iov = uio->uio_iov;
for (i = 0; i < iovcnt; i++) {
- error = copyin(&iovp[i], &iov32, sizeof(struct iovec32));
+ error = copyin(&iovp32[i], &iov32, sizeof(struct iovec32));
if (error) {
freeuio(uio);
return (error);
@@ -2246,7 +2248,7 @@ freebsd4_freebsd32_sendfile(struct thread *td,
return (kern_sendfile(td, uap->fd, uap->s,
PAIR32TO64(off_t, uap->offset), uap->nbytes,
(struct sf_hdtr *)uap->hdtr, uap->sbytes, uap->flags,
- true, freebsd32_copyin_hdtr, (copyinuio_t *)freebsd32_copyinuio));
+ true, freebsd32_copyin_hdtr, freebsd32_copyinuio));
}
#endif
@@ -2256,7 +2258,7 @@ freebsd32_sendfile(struct thread *td, struct freebsd32_sendfile_args *uap)
return (kern_sendfile(td, uap->fd, uap->s,
PAIR32TO64(off_t, uap->offset), uap->nbytes,
(struct sf_hdtr *)uap->hdtr, uap->sbytes, uap->flags,
- false, freebsd32_copyin_hdtr, (copyinuio_t *)freebsd32_copyinuio));
+ false, freebsd32_copyin_hdtr, freebsd32_copyinuio));
}
static void
diff --git a/sys/compat/freebsd32/freebsd32_util.h b/sys/compat/freebsd32/freebsd32_util.h
index 1ae016814329..1b253b6f124c 100644
--- a/sys/compat/freebsd32/freebsd32_util.h
+++ b/sys/compat/freebsd32/freebsd32_util.h
@@ -114,8 +114,7 @@ int freebsd32_copyout_strings(struct image_params *imgp,
uintptr_t *stack_base);
int freebsd32_copyiniov(struct iovec32 *iovp, u_int iovcnt,
struct iovec **iov, int error);
-int freebsd32_copyinuio(const struct iovec32 *iovp, u_int iovcnt,
- struct uio **uiop);
+int freebsd32_copyinuio(const void *iovp, u_int iovcnt, struct uio **uiop);
void freebsd32_rusage_out(const struct rusage *s, struct rusage32 *s32);
struct image_args;
diff --git a/sys/kern/subr_uio.c b/sys/kern/subr_uio.c
index ea75c6abc539..51001aacf0c9 100644
--- a/sys/kern/subr_uio.c
+++ b/sys/kern/subr_uio.c
@@ -434,7 +434,7 @@ copyiniov(const struct iovec *iovp, u_int iovcnt, struct iovec **iov, int error)
}
int
-copyinuio(const struct iovec *iovp, u_int iovcnt, struct uio **uiop)
+copyinuio(const void *iovp, u_int iovcnt, struct uio **uiop)
{
struct iovec *iov;
struct uio *uio;
diff --git a/sys/sys/uio.h b/sys/sys/uio.h
index 217f65365cb0..0e0d42d04144 100644
--- a/sys/sys/uio.h
+++ b/sys/sys/uio.h
@@ -81,7 +81,7 @@ void freeuio(struct uio *uio);
struct uio *cloneuio(struct uio *uiop);
int copyiniov(const struct iovec *iovp, u_int iovcnt, struct iovec **iov,
int error);
-int copyinuio(const struct iovec *iovp, u_int iovcnt, struct uio **uiop);
+int copyinuio(const void *iovp, u_int iovcnt, struct uio **uiop);
int copyout_map(struct thread *td, vm_offset_t *addr, size_t sz);
int copyout_unmap(struct thread *td, vm_offset_t addr, size_t sz);
void exterr_copyout(struct thread *td);