RFC: what to do about KASSERT() in allocuio()?
- Reply: Konstantin Belousov : "Re: RFC: what to do about KASSERT() in allocuio()?"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 14 May 2026 00:30:46 UTC
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.
So, what do others think? rick