From nobody Sat Oct 16 13:02:50 2021 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 E92D7180C55C; Sat, 16 Oct 2021 13:02:51 +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 4HWjwp6sZ3z3Dp0; Sat, 16 Oct 2021 13:02:50 +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 C069E1A370; Sat, 16 Oct 2021 13:02:50 +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 19GD2o3Q037106; Sat, 16 Oct 2021 13:02:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19GD2ocF037105; Sat, 16 Oct 2021 13:02:50 GMT (envelope-from git) Date: Sat, 16 Oct 2021 13:02:50 GMT Message-Id: <202110161302.19GD2ocF037105@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 1625e2db222c - stable/13 - O_PATH: allow vfs_extattr syscalls 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1625e2db222cad581593d4079385707e2e15cdbe Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=1625e2db222cad581593d4079385707e2e15cdbe commit 1625e2db222cad581593d4079385707e2e15cdbe Author: Greg V AuthorDate: 2021-10-10 12:45:31 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-16 13:01:47 +0000 O_PATH: allow vfs_extattr syscalls (cherry picked from commit 98dae405de7f8b3506dd94dcd3e9f51d3fb15962) --- 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);