Re: RFC: what to do about KASSERT() in allocuio()?
- Reply: Rick Macklem : "Re: RFC: what to do about KASSERT() in allocuio()?"
- In reply to: Rick Macklem : "RFC: what to do about KASSERT() in allocuio()?"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 14 May 2026 02:44:39 UTC
On Wed, May 13, 2026 at 05:30:46PM -0700, Rick Macklem wrote:
> Hi,
>
> The following KASSERT() is at the beginning of allocuio():
> KASSERT(iovcnt <= UIO_MAXIOV,
> ("Requested %u iovecs exceed UIO_MAXIOV", iovcnt));
>
> This fails for the NFS server if it is configured for > 1Mbyte I/O
> size, since the number of elements (mbufs) for the VOP_READ()
> exceeds UIO_MAXIOV (1024). This shows up because ZFS
> does a cloneuio() call which calls allocuio().
>
> Since UIO_MAXIOV is used is several places, including setting
> the limit for copyinuio() and freebsd32_copyinuio(), I don't think
> changing the value of UIO_MAXIOV is an appropriate fix.
> (ie. This changes the APIs, etc.)
>
> Now, since all that the above check does it set a sanity limit
> on how big the allocated uio can be, do you think it is
> reasonable to change the above KASSERT() to:
> KASSERT(iovcnt <= 4096,
> ("Requested %u iovecs exceed 4096", iovcnt));
> which would allow a 4Mbyte NFS I/O to work.
>
> Note that copyinuio() and freebsd32_copyinuio() check the
> iov length for < UIO_MAXIOV before calling allocuio(), so
> those interfaces are not broken by this.
I do not quite understand how changing the assert in allocuio() would
change anything? All callers of the function (copyinuio, cloneuio,
and freebsd32_copyinuio) check iovcnt, and I do not see a call to
allocuio() from the NFS server.
Where specifically does the NFS server fail with too long iovec?