diff options
author | kib <kib@FreeBSD.org> | 2012-02-21 01:05:12 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2012-02-21 01:05:12 +0000 |
commit | 80ae8fe82cdaa69f78dc90fa27bc9e79863de0ea (patch) | |
tree | d0d078391c4959fc08545db4ab619daadd9cf1d9 /sys/kern/vfs_syscalls.c | |
parent | 31a24bc1664a822f3d06595f42063719e6902ff1 (diff) | |
download | FreeBSD-src-80ae8fe82cdaa69f78dc90fa27bc9e79863de0ea.zip FreeBSD-src-80ae8fe82cdaa69f78dc90fa27bc9e79863de0ea.tar.gz |
Fix found places where uio_resid is truncated to int.
Add the sysctl debug.iosize_max_clamp, enabled by default. Setting the
sysctl to zero allows to perform the SSIZE_MAX-sized i/o requests from
the usermode.
Discussed with: bde, das (previous versions)
MFC after: 1 month
Diffstat (limited to 'sys/kern/vfs_syscalls.c')
-rw-r--r-- | sys/kern/vfs_syscalls.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index e460570..9b7cbe4 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -2692,7 +2692,7 @@ kern_readlinkat(struct thread *td, int fd, char *path, enum uio_seg pathseg, struct nameidata nd; int vfslocked; - if (count > INT_MAX) + if (count > IOSIZE_MAX) return (EINVAL); NDINIT_AT(&nd, LOOKUP, NOFOLLOW | LOCKSHARED | LOCKLEAF | MPSAFE | @@ -4153,7 +4153,8 @@ kern_getdirentries(struct thread *td, int fd, char *buf, u_int count, int error, eofflag; AUDIT_ARG_FD(fd); - if (count > INT_MAX) + auio.uio_resid = count; + if (auio.uio_resid > IOSIZE_MAX) return (EINVAL); if ((error = getvnode(td->td_proc->p_fd, fd, CAP_READ | CAP_SEEK, &fp)) != 0) @@ -4177,7 +4178,6 @@ unionread: auio.uio_rw = UIO_READ; auio.uio_segflg = UIO_USERSPACE; auio.uio_td = td; - auio.uio_resid = count; vn_lock(vp, LK_SHARED | LK_RETRY); AUDIT_ARG_VNODE1(vp); loff = auio.uio_offset = fp->f_offset; |