From nobody Thu May 14 02:44:39 2026 X-Original-To: freebsd-current@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4gGF6X6PSLz6dT9P for ; Thu, 14 May 2026 02:44:52 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4gGF6W72HJz4PV1 for ; Thu, 14 May 2026 02:44:51 +0000 (UTC) (envelope-from kostikbel@gmail.com) Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=gmail.com (policy=none); spf=softfail (mx1.freebsd.org: 2001:470:d5e7:1::1 is neither permitted nor denied by domain of kostikbel@gmail.com) smtp.mailfrom=kostikbel@gmail.com Received: from tom.home (kib@localhost [127.0.0.1] (may be forged)) by kib.kiev.ua (8.18.1/8.18.1) with ESMTP id 64E2iebD067305; Thu, 14 May 2026 05:44:43 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 64E2iebD067305 Received: (from kostik@localhost) by tom.home (8.18.1/8.18.1/Submit) id 64E2idwP067304; Thu, 14 May 2026 05:44:40 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 14 May 2026 05:44:39 +0300 From: Konstantin Belousov To: Rick Macklem Cc: FreeBSD CURRENT Subject: Re: RFC: what to do about KASSERT() in allocuio()? Message-ID: References: List-Id: Discussions about the use of FreeBSD-current List-Archive: https://lists.freebsd.org/archives/freebsd-current List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-current@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=4.0.2 X-Spam-Checker-Version: SpamAssassin 4.0.2 (2025-08-27) on tom.home X-Spamd-Result: default: False [-1.75 / 15.00]; SUBJECT_ENDS_QUESTION(1.00)[]; NEURAL_HAM_MEDIUM(-0.98)[-0.979]; NEURAL_HAM_LONG(-0.95)[-0.954]; NEURAL_HAM_SHORT(-0.82)[-0.819]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : No valid SPF, No valid DKIM,none]; MIME_GOOD(-0.10)[text/plain]; TAGGED_RCPT(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; ARC_NA(0.00)[]; MISSING_XM_UA(0.00)[]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]; FREEMAIL_FROM(0.00)[gmail.com]; MIME_TRACE(0.00)[0:+]; FREEMAIL_TO(0.00)[gmail.com]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; R_SPF_SOFTFAIL(0.00)[~all]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_TLS_LAST(0.00)[]; TO_DN_ALL(0.00)[]; MLMMJ_DEST(0.00)[freebsd-current@freebsd.org]; HAS_XAW(0.00)[] X-Spamd-Bar: - X-Rspamd-Queue-Id: 4gGF6W72HJz4PV1 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?