From nobody Mon Apr 24 16:16:32 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 4Q4qy902NSz472n4; Mon, 24 Apr 2023 16:16:33 +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 4Q4qy86QYTz48vm; Mon, 24 Apr 2023 16:16:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1682352992; 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=lZNehjY+dEreUnx/fDpmHLVeGP9/jvM0eTiCxlHB37E=; b=UX6DaW7AmID5O517tDVYMT1PHljASRvpVLuU9tvskf8Mw8CTlAxM4KqIHGTlWiAdFAWwiM TKp5TnkWdeJWxXrA4Bi5T1XrzHs7NgptExsLOaBshWmbZGjSuMAf7hR4i6m9z1DJBMD2q1 c+8QsnVQMnAepWusGIXMjxgRDmNU35JzyOJy2XucTaDM2jtLprlAC1N7rA7X6G/rNZILZL NmZK/MuEaVxFOI+oDlbmnashEx9FS6PyqJxXGGyBawTA2MY9wwqfo9Hv0A3kJGg9o7ONws 0Q4j+5kzwitC/ay5HtaUD9uQgTuiTTDp08xEMs7CB9kMLl8Qp116frPcGk8J+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1682352992; 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=lZNehjY+dEreUnx/fDpmHLVeGP9/jvM0eTiCxlHB37E=; b=iKFRFXXF2PrqO1x7cjoAiu96FtMH1Dx7nxljOOtZfkbydC41MoTyhgEWJEryrKDJzaDeMX QfsMwuyzQaM5AGbbmvz87kLnfj69zZev9fuu3CJatJSTV/H2yRIcH4Sa0vNZK44h/+FISL ZWiViH/trO0WhEFwAwgKqgaij1d9QqX6SHMFn34wqtoX3KM9eCFQJOzysg5E1Ft/XZwaF9 UCM56aNnMAAKVxIobddq8lEMpDYTLJz3SBuyIqLMZey3ftDJGjJ2q3f0DloJWZ8wZfRsoa UWLJ1Hd5A3fvDya0j6CttonIWlXWDO1ZQF5cMtRbrMc4Pu/AOjJuUJ7kLRT/Uw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1682352992; a=rsa-sha256; cv=none; b=gqeLmaC9GPkNhywNygeQgd80eGQkUSo9ujX3F7DrHChySPNDN4Zgk2eqXj+ndPH/xGjbx6 iEdegmtbpoziGnmEnQ8jlP7BpA3WPQLztG17QRx6uwDtA8dzsN8PpmIgTzwk5bOEO3njoC a4GAdH46Vy4xi7YByP01ZDUD2+XRCrI0OzgN7naSYkn/QsnE/xC8FODLbXoBFmv6A7gRbi 7Rn4owehHSqE4TC6ONuaGyMmpSNlMod3QY93Srruv12iechBrktr/6yTS5BNjztgVMuT1E /c3Qkz6vCuNYwqmnoxkNpZYSjC/CXmLxJy82hAQIk328S+IubJqtGOHP52YviQ== 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 4Q4qy85LVczX2W; Mon, 24 Apr 2023 16:16:32 +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 33OGGWHh033604; Mon, 24 Apr 2023 16:16:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 33OGGWwY033603; Mon, 24 Apr 2023 16:16:32 GMT (envelope-from git) Date: Mon, 24 Apr 2023 16:16:32 GMT Message-Id: <202304241616.33OGGWwY033603@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 84b812d5b330 - stable/13 - 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 84b812d5b330f6f20477da4f6577c3c84655b0a5 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=84b812d5b330f6f20477da4f6577c3c84655b0a5 commit 84b812d5b330f6f20477da4f6577c3c84655b0a5 Author: Mateusz Guzik AuthorDate: 2023-04-20 08:36:53 +0000 Commit: Mateusz Guzik CommitDate: 2023-04-24 16:16:03 +0000 zfs: fix up EINVAL from getdirentries on .zfs PR: 270909 (cherry picked from commit 9c4e270822a3592bf122f9a8e4e815b4602329f1) --- 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 5bd2e1510ddb..6e49fff9a110 100644 --- a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_ctldir.c +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_ctldir.c @@ -675,6 +675,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) {