aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg V <greg@unrelenting.technology>2021-10-10 12:45:31 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2021-10-11 17:09:49 +0000
commit98dae405de7f8b3506dd94dcd3e9f51d3fb15962 (patch)
tree670e245eb7f36566c84264f3f7b293e5c3324532
parent8da27052535b816096dd28debe5bbbad3dcf4ea4 (diff)
downloadsrc-98dae405de7f8b3506dd94dcd3e9f51d3fb15962.tar.gz
src-98dae405de7f8b3506dd94dcd3e9f51d3fb15962.zip
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
-rw-r--r--lib/libc/sys/extattr_get_file.27
-rw-r--r--sys/kern/vfs_extattr.c8
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);