summaryrefslogtreecommitdiffstats
path: root/sys/compat
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2009-09-09 20:59:01 +0000
committerkib <kib@FreeBSD.org>2009-09-09 20:59:01 +0000
commit91e6a5b3cc44fe15d5746c5b0f8d4b970182c656 (patch)
treeecdcb4c945cc32ab7a293d1290a48abdaff024e2 /sys/compat
parent2f0e817202fd1926d9261102d1576c28d138e982 (diff)
downloadFreeBSD-src-91e6a5b3cc44fe15d5746c5b0f8d4b970182c656.zip
FreeBSD-src-91e6a5b3cc44fe15d5746c5b0f8d4b970182c656.tar.gz
kern_select(9) copies fd_set in and out of userspace in quantities of
longs. Since 32bit processes longs are 4 bytes, 64bit kernel may copy in or out 4 bytes more then the process expected. Calculate the amount of bytes to copy taking into account size of fd_set for the current process ABI. Diagnosed and tested by: Peter Jeremy <peterjeremy acm org> Reviewed by: jhb MFC after: 1 week
Diffstat (limited to 'sys/compat')
-rw-r--r--sys/compat/freebsd32/freebsd32_misc.c3
-rw-r--r--sys/compat/linux/linux_misc.c2
2 files changed, 3 insertions, 2 deletions
diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c
index 466aab4..71b22aa 100644
--- a/sys/compat/freebsd32/freebsd32_misc.c
+++ b/sys/compat/freebsd32/freebsd32_misc.c
@@ -589,7 +589,8 @@ freebsd32_select(struct thread *td, struct freebsd32_select_args *uap)
* XXX big-endian needs to convert the fd_sets too.
* XXX Do pointers need PTRIN()?
*/
- return (kern_select(td, uap->nd, uap->in, uap->ou, uap->ex, tvp));
+ return (kern_select(td, uap->nd, uap->in, uap->ou, uap->ex, tvp,
+ sizeof(int32_t) * 8));
}
/*
diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c
index 267da07..1d5eaf8 100644
--- a/sys/compat/linux/linux_misc.c
+++ b/sys/compat/linux/linux_misc.c
@@ -522,7 +522,7 @@ linux_select(struct thread *td, struct linux_select_args *args)
tvp = NULL;
error = kern_select(td, args->nfds, args->readfds, args->writefds,
- args->exceptfds, tvp);
+ args->exceptfds, tvp, sizeof(l_int) * 8);
#ifdef DEBUG
if (ldebug(select))
OpenPOWER on IntegriCloud