From nobody Thu Apr 28 21:19:47 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 61B281AAC0A5; Thu, 28 Apr 2022 21:19:47 +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 4Kq7mg2GZdz3wKf; Thu, 28 Apr 2022 21:19:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1651180787; 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=qGl4xxQaVwjfPAFLLzFLb09Fe907x5wqc4RaurdbcaU=; b=OOQFN3hbgU5iosFjrbkuVnpU36rJ/+oE4+Nrw7IZ98l7HrUUHBQgBKiE8RCqv3IDTqvZ13 YPq583691NPOMJYJX2sMUAN+Bs4Zro+Dgpovb0jhhQq3t7hphapjna+ISV1m9QeRsg4+2P IiPgNxMJ/M/EbaCq+j0Ym9x5pubdpi6BJhYB/cE32m9GeDFyeGoK6w2RfGhRCbtrJBrV3h ByaFifXynL72+Bpt2DVHfOOFtaB11JXhKM8PQYYsvddUTwsz+LtMyi3IcAAlP4dwVVeB0D eyMBGEIEvvU1t+tOiP2Q6h+msdT7VcLbWiEFxeLpqHygJ2BJsZ6Ji1N9mhl4tA== 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 2993620204; Thu, 28 Apr 2022 21:19:47 +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 23SLJlXQ041477; Thu, 28 Apr 2022 21:19:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 23SLJlF0041476; Thu, 28 Apr 2022 21:19:47 GMT (envelope-from git) Date: Thu, 28 Apr 2022 21:19:47 GMT Message-Id: <202204282119.23SLJlF0041476@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Somers Subject: git: 45825a12f985 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 45825a12f9851213e627cf41398706bacb793f83 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1651180787; 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=qGl4xxQaVwjfPAFLLzFLb09Fe907x5wqc4RaurdbcaU=; b=Txf5nDe4TDB1ucoxAsK5KeD0LaH4xu2McWgdEdwfv9A1qtu7GFOjr45awX7w5aBrdF5Dl/ iIAhURtYZYg6d1cuVUPOjmPYNyAwyBngkfgfB5U/gHDBPgokb5iDE28BzUjd1m6eoyq2AJ aVlxnzkVwFt23FsHwpmw+/2XVZ9OcOD0lJoofrpVy3uTjTsmZwKUIBjtRCbC0xaSMoCww7 K3RmX9rzXPq0ye0zxEddlqswtRQ+UW5RpW4e9KH5i3hHXsWvG+gEjQrIj0qifDFtBhIHPh cvRsOCU152YeCXcJ/Ht0bAbil9sGOUI23R7QHL6gPkkFH/KQnMOfV2QM9lqkaA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1651180787; a=rsa-sha256; cv=none; b=wGeyb8J+yIlKVreOJ+bst/sGurmvRY4BfldVA1+/dETyaxGsOnqiBRIOfq2nAxJczdkoSv v7a4RykVt6gyh4+iNcDIXyTMr61SMR1pjtMejRb2b6u6xc5AZrnz9uFTDmzIYics2QSDTv J8sOSxxnwhXakpo099U+hg+qdONdMvYJTxMoWi1BRefBJEby7wUc4Yep3vAH9l25DAYSEp CMzt9C6XKQsdZteofNRxCiTo2elH2yZ+osJc44Nm8MGaIe8qizhVmHSJMXM/d7t3jNo+N5 epRPOYchuilpDpZLz9hoMC93nVktLhg2aFebchYmC8ukzfL12T/Cn+myCQG1gA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=45825a12f9851213e627cf41398706bacb793f83 commit 45825a12f9851213e627cf41398706bacb793f83 Author: Alan Somers AuthorDate: 2022-04-28 21:13:09 +0000 Commit: Alan Somers CommitDate: 2022-04-28 21:13:09 +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 MFC after: 2 weeks --- 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 4374c854a5be..9ffc8f32c048 100644 --- a/sys/fs/fuse/fuse_vnops.c +++ b/sys/fs/fuse/fuse_vnops.c @@ -1042,7 +1042,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)