From nobody Thu Apr 20 08:38:37 2023 X-Original-To: dev-commits-src-all@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 4Q29zd5cVfz46WSP; Thu, 20 Apr 2023 08:38:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (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-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Q29zd1R6Lz4WTl; Thu, 20 Apr 2023 08:38:37 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1681979917; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=28o3mph+FsZJsx4Ou+nsBxPdat3TRAcjjf0m58IGN7g=; b=O7arsI8Yd7DekndX8TAGm5X1LkXiSMDI2Shxtf4Tio4w5FFE7HNTU87jMOtq7ZNqvBH9nJ 3JLCeDo23+VOT0eHBxxvrcCVmZdLxr3hfXIUMAKSKJs6pPMumr0SbxgAqbLc0VT00SWfvB GdPXTaOq1Bg9UKmIIIgMLhvksTJJ6v7cK/sTvu+vC++B0rQCe+lgoCxMydyapFoc5MfrIZ 7rh7fHw+r25Q801Tl6HDWjnRxSONteJ2go1KIveQCM7/biZqj6m6Wk+P8h6E8O1EFQFIJq dHTf97AJ7rjSBggVKXZguqIyEOXymPu1IDxmaNE/jO6jffHqHdIYfqlDEiaj+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1681979917; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=28o3mph+FsZJsx4Ou+nsBxPdat3TRAcjjf0m58IGN7g=; b=acx6QGgIsk+lrFnHNqJGE7OEDMxb7Hd8K34nMsPjWrkK8Z0NijTCJLHhdE3VsIUnFIsQc1 CYvbuSGY93GeYwkbL2nGt2/EzSkemwFXeaYTLoagxqUhEL+ilT0CYfvCvAjEzysZKYkBTl GMIGJtDcmrRg3w7hmxr8IxhIblWohbypAf97vIDQS+F6OfHWRpTzpL7YgfVzPVmgO/D//z ckVst3pUrN2zw9RZeHMRIh3/twcf2I74LTZb3buEBRoc4ZlIVLAIbckVDEprCHPqjOLnA8 1I5gXLiHiZcMP+DMtMH54xC4JB4Lm9T0qvxbVr8kaiWpcyRBOeFory+FdZqEVA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1681979917; a=rsa-sha256; cv=none; b=dOhPNgfs6PBCeqdHJOhcPd6+jtNP1flXhjgths+ULVOYdSlyB1CW4NVjDDsEbWSGIJs8+D nSrsYS5Dy6bfM/pmavTEGSok0FCPcSG9XM4O5yxWiSIgdU/X7IKjpH4hkK1urROIAI78Qa WLixGoOmdNRf3ANTuaB0IOAmzwBVKH9DZchTSRuUjpCZrXfMTxcVeWFqLSULRuJxlSxWGB /Y81yPIkIMvG0ILOVu2zhGrUWY4Nw4RQEBKZs302kZhEfX+wT6M99NyXHGEAfQmK35Ftbb 6HUEOuzbF7f6niN5Cpe2p66M28hBHt20XJvl7DofLXMbPCpVuSP45WLHeMg5Ow== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Q29zd0W9dzVpv; Thu, 20 Apr 2023 08:38:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 33K8cbUL088626; Thu, 20 Apr 2023 08:38:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 33K8cbmZ088625; Thu, 20 Apr 2023 08:38:37 GMT (envelope-from git) Date: Thu, 20 Apr 2023 08:38:37 GMT Message-Id: <202304200838.33K8cbmZ088625@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 9c4e270822a3 - main - zfs: fix up EINVAL from getdirentries on .zfs List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9c4e270822a3592bf122f9a8e4e815b4602329f1 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=9c4e270822a3592bf122f9a8e4e815b4602329f1 commit 9c4e270822a3592bf122f9a8e4e815b4602329f1 Author: Mateusz Guzik AuthorDate: 2023-04-20 08:36:53 +0000 Commit: Mateusz Guzik CommitDate: 2023-04-20 08:38:28 +0000 zfs: fix up EINVAL from getdirentries on .zfs PR: 270909 --- sys/contrib/openzfs/module/os/freebsd/zfs/zfs_ctldir.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_ctldir.c b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_ctldir.c index 8ba5e0b242a2..420d887b661e 100644 --- a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_ctldir.c +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_ctldir.c @@ -679,6 +679,17 @@ zfsctl_root_readdir(struct vop_readdir_args *ap) ASSERT3S(vp->v_type, ==, VDIR); + /* + * FIXME: this routine only ever emits 3 entries and does not tolerate + * being called with a buffer too small to handle all of them. + * + * The check below facilitates the idiom of repeating calls until the + * count to return is 0. + */ + if (zfs_uio_offset(&uio) == 3 * sizeof(entry)) { + return (0); + } + error = sfs_readdir_common(zfsvfs->z_root, ZFSCTL_INO_ROOT, ap, &uio, &dots_offset); if (error != 0) {