From nobody Sat Aug 20 01:16:39 2022 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 4M8ggr0sJ4z4YkVh; Sat, 20 Aug 2022 01:16:40 +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 4M8ggr0Hfjz48j2; Sat, 20 Aug 2022 01:16:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1660958200; 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=bPumEFp/k6vZsIpJhaKyKMLyRhJKEnq6v2ivc1ODALM=; b=o4Flmv+LDbP2zisLxICMVoUvOUPCHxPzUZYBGoLDAVXs2wqNgqMKGVcRIe7Eh2BvzQm0+l nVcaAl0zZEuI/fqSz0qOhAXSUIVHrfPLPZX27ye6l47zCf1dGRhltGJQFq2vE1hO6J34dR HKvkp//eyXpaAgVesNJ5OwM7UO/Kq04yXR36RYD0D6OdxMYFflJJyOTF7OFV3O62PSeCqX DjVdhqXS/JztHsWh2Qd3ZNgKuxkiHTAyfJF6v6DJ9XoyFnVWLt8Hep2AauSbn/yBWRohRF nD4yeBS5k13TSIqKdTnbryv6XdN88sC6dnNbfU2y36YePtx3jbHstYmT5ljMOw== 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 4M8ggq6T4qz1CjX; Sat, 20 Aug 2022 01:16:39 +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 27K1Gdme009400; Sat, 20 Aug 2022 01:16:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 27K1GdYE009399; Sat, 20 Aug 2022 01:16:39 GMT (envelope-from git) Date: Sat, 20 Aug 2022 01:16:39 GMT Message-Id: <202208200116.27K1GdYE009399@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alan Somers Subject: git: e2182a594d84 - stable/12 - fusefs: fix FUSE_CREATE with file handles and fuse protocol < 7.9 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: asomers X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: e2182a594d84a84a0ff3edf2a7ad9ee141027a60 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1660958200; 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=bPumEFp/k6vZsIpJhaKyKMLyRhJKEnq6v2ivc1ODALM=; b=ODooYrmpDIdZVhgqLtmYd0V+gYDJbxyWRD3Nb6EAwjKUPVtsenP4dDQt4YEEpaA9kMsdVN gayPn6GkRjNj3XUOkMezNgQhVSuKQumUUuSQueR+2ZQSCHG/WPlm/PwsfLemFaKupsZfBj /RXGyoqxAIHESdDTmJFJubZLKjQq4hKIlAUzfn6zpBNc5zgOEBXnIxrAIxucDSpe+ptzrL VAAidNgHclikA1w9ehtHoJtZLC191IeG18lZC4TA/xf6ejciLGcwDl4J1G59bvbHkUlji7 ckSr7rfqZwgo0tjhp3a4ZaU58HRKf7ug5ZWOPz56SsQ9RDfGLStFpGItplBkkQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1660958200; a=rsa-sha256; cv=none; b=TU/ZTjfw7l5IJ2Rm7IAkq/AuLKAfX4ww7v7kh2hPzEI8MCSViQJ6vzDmxTvg6xJv646y2O FdA7Z7/aB5ufN935Nd+OqEmOHxH1xECRawtcDbzKtWI/OqOJmjBnBTZdtYbWdisUGQVGr0 DPRs9g2gxbsdAxUldQOnoNkqaS0epak8XBCDh97mLVDASS4NLBbS5nXeQYktaxDoLubcja +7wHxxr4/n5hYgQ31jn3brlr5Y7y29GybVM60OyPjWZLus+JvvS4ispY4CnusygOAJFGWn ZDa//uLc/yjD5aJb894wYPnnpCAXsE7I7HmEO9d6KyLi75pH8A9Eh+inLh2X1A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=e2182a594d84a84a0ff3edf2a7ad9ee141027a60 commit e2182a594d84a84a0ff3edf2a7ad9ee141027a60 Author: Alan Somers AuthorDate: 2022-04-28 21:13:09 +0000 Commit: Alan Somers CommitDate: 2022-08-20 01:11:23 +0000 fusefs: fix FUSE_CREATE with file handles and fuse protocol < 7.9 Prior to fuse protocol version 7.9, the fuse_entry_out structure had a smaller size. But fuse_vnop_create did not take that into account when working with servers that use older protocols. The bug does not matter for servers which don't use file handles or open flags (the only fields affected). PR: 263625 Submitted by: Ali Abdallah (cherry picked from commit 45825a12f9851213e627cf41398706bacb793f83) --- sys/fs/fuse/fuse_vnops.c | 6 +++++- tests/sys/fs/fusefs/create.cc | 13 ++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/sys/fs/fuse/fuse_vnops.c b/sys/fs/fuse/fuse_vnops.c index b8d5af589a63..c390c5d7792c 100644 --- a/sys/fs/fuse/fuse_vnops.c +++ b/sys/fs/fuse/fuse_vnops.c @@ -713,7 +713,11 @@ fuse_vnop_create(struct vop_create_args *ap) } if (op == FUSE_CREATE) { - foo = (struct fuse_open_out*)(feo + 1); + if (fuse_libabi_geq(data, 7, 9)) + foo = (struct fuse_open_out*)(feo + 1); + else + foo = (struct fuse_open_out*)((char*)feo + + FUSE_COMPAT_ENTRY_OUT_SIZE); } else { /* Issue a separate FUSE_OPEN */ struct fuse_open_in *foi; diff --git a/tests/sys/fs/fusefs/create.cc b/tests/sys/fs/fusefs/create.cc index 0797a3ff9e34..df3225ed1837 100644 --- a/tests/sys/fs/fusefs/create.cc +++ b/tests/sys/fs/fusefs/create.cc @@ -415,15 +415,18 @@ TEST_F(Create_7_8, ok) expect_create(RELPATH, mode, ReturnImmediate([=](auto in __unused, auto& out) { SET_OUT_HEADER_LEN(out, create_7_8); - out.body.create.entry.attr.mode = mode; - out.body.create.entry.nodeid = ino; - out.body.create.entry.entry_valid = UINT64_MAX; - out.body.create.entry.attr_valid = UINT64_MAX; + out.body.create_7_8.entry.attr.mode = mode; + out.body.create_7_8.entry.nodeid = ino; + out.body.create_7_8.entry.entry_valid = UINT64_MAX; + out.body.create_7_8.entry.attr_valid = UINT64_MAX; + out.body.create_7_8.open.fh = FH; })); + expect_flush(ino, 1, ReturnErrno(0)); + expect_release(ino, FH); fd = open(FULLPATH, O_CREAT | O_EXCL, mode); ASSERT_LE(0, fd) << strerror(errno); - leak(fd); + close(fd); } TEST_F(Create_7_11, ok)