From nobody Mon Oct 11 17:10:21 2021 X-Original-To: dev-commits-src-main@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 793BA17E01AE; Mon, 11 Oct 2021 17:10:22 +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 4HSlfk1KJLz4Z8p; Mon, 11 Oct 2021 17:10:22 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 CD63B24A56; Mon, 11 Oct 2021 17:10:21 +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 19BHALhC045382; Mon, 11 Oct 2021 17:10:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19BHALMP045380; Mon, 11 Oct 2021 17:10:21 GMT (envelope-from git) Date: Mon, 11 Oct 2021 17:10:21 GMT Message-Id: <202110111710.19BHALMP045380@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 98dae405de7f - main - O_PATH: allow vfs_extattr syscalls List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 98dae405de7f8b3506dd94dcd3e9f51d3fb15962 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=98dae405de7f8b3506dd94dcd3e9f51d3fb15962 commit 98dae405de7f8b3506dd94dcd3e9f51d3fb15962 Author: Greg V AuthorDate: 2021-10-10 12:45:31 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-11 17:09:49 +0000 O_PATH: allow vfs_extattr syscalls These calls do operate on vnodes only, not file contents. This is useful for e.g. the xdg-document-portal fuse filesystem. Reviewed by: kib, markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D32438 --- lib/libc/sys/extattr_get_file.2 | 7 ++++++- sys/kern/vfs_extattr.c | 8 ++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/libc/sys/extattr_get_file.2 b/lib/libc/sys/extattr_get_file.2 index 5134c8d8ac0f..c38b27e17423 100644 --- a/lib/libc/sys/extattr_get_file.2 +++ b/lib/libc/sys/extattr_get_file.2 @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 7, 2020 +.Dd October 11, 2021 .Dt EXTATTR 2 .Os .Sh NAME @@ -149,6 +149,11 @@ functions take a file descriptor, while the functions take a path. Both arguments describe a file associated with the extended attribute that should be manipulated. +The +.Qq Li _fd +functions can be used with file descriptors opened with the +.Dv O_PATH +flag. .Pp The following arguments are common to all the system calls described here: .Bl -tag -width attrnamespace diff --git a/sys/kern/vfs_extattr.c b/sys/kern/vfs_extattr.c index adb882288f6c..43b000c78110 100644 --- a/sys/kern/vfs_extattr.c +++ b/sys/kern/vfs_extattr.c @@ -242,7 +242,7 @@ sys_extattr_set_fd(struct thread *td, struct extattr_set_fd_args *uap) return (error); AUDIT_ARG_TEXT(attrname); - error = getvnode(td, uap->fd, + error = getvnode_path(td, uap->fd, cap_rights_init_one(&rights, CAP_EXTATTR_SET), &fp); if (error) return (error); @@ -409,7 +409,7 @@ sys_extattr_get_fd(struct thread *td, struct extattr_get_fd_args *uap) return (error); AUDIT_ARG_TEXT(attrname); - error = getvnode(td, uap->fd, + error = getvnode_path(td, uap->fd, cap_rights_init_one(&rights, CAP_EXTATTR_GET), &fp); if (error) return (error); @@ -544,7 +544,7 @@ sys_extattr_delete_fd(struct thread *td, struct extattr_delete_fd_args *uap) return (error); AUDIT_ARG_TEXT(attrname); - error = getvnode(td, uap->fd, + error = getvnode_path(td, uap->fd, cap_rights_init_one(&rights, CAP_EXTATTR_DELETE), &fp); if (error) return (error); @@ -690,7 +690,7 @@ sys_extattr_list_fd(struct thread *td, struct extattr_list_fd_args *uap) AUDIT_ARG_FD(uap->fd); AUDIT_ARG_VALUE(uap->attrnamespace); - error = getvnode(td, uap->fd, + error = getvnode_path(td, uap->fd, cap_rights_init_one(&rights, CAP_EXTATTR_LIST), &fp); if (error) return (error);