Christian Göttsche
6140be90ec
fs/xattr: add *at family syscalls
Add the four syscalls setxattrat(), getxattrat(), listxattrat() and
removexattrat(). Those can be used to operate on extended attributes,
especially security related ones, either relative to a pinned directory
or on a file descriptor without read access, avoiding a
/proc/<pid>/fd/<fd> detour, requiring a mounted procfs.
One use case will be setfiles(8) setting SELinux file contexts
("security.selinux") without race conditions and without a file
descriptor opened with read access requiring SELinux read permission.
Use the do_{name}at() pattern from fs/open.c.
Pass the value of the extended attribute, its length, and for
setxattrat(2) the command (XATTR_CREATE or XATTR_REPLACE) via an added
struct xattr_args to not exceed six syscall arguments and not
merging the AT_* and XATTR_* flags.
[AV: fixes by Christian Brauner folded in, the entire thing rebased on
top of {filename,file}_...xattr() primitives, treatment of empty
pathnames regularized. As the result, AT_EMPTY_PATH+NULL handling
is cheap, so f...(2) can use it]
Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Link: https://lore.kernel.org/r/20240426162042.191916-1-cgoettsche@seltendoof.de
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Christian Brauner <brauner@kernel.org>
CC: x86@kernel.org
CC: linux-alpha@vger.kernel.org
CC: linux-kernel@vger.kernel.org
CC: linux-arm-kernel@lists.infradead.org
CC: linux-ia64@vger.kernel.org
CC: linux-m68k@lists.linux-m68k.org
CC: linux-mips@vger.kernel.org
CC: linux-parisc@vger.kernel.org
CC: linuxppc-dev@lists.ozlabs.org
CC: linux-s390@vger.kernel.org
CC: linux-sh@vger.kernel.org
CC: sparclinux@vger.kernel.org
CC: linux-fsdevel@vger.kernel.org
CC: audit@vger.kernel.org
CC: linux-arch@vger.kernel.org
CC: linux-api@vger.kernel.org
CC: linux-security-module@vger.kernel.org
CC: selinux@vger.kernel.org
[brauner: slight tweaks]
Signed-off-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2024-11-06 12:59:44 -05:00
..
2024-02-08 08:41:03 -05:00
2017-12-05 15:02:40 +01:00
2017-11-02 11:19:54 +01:00
2017-11-02 11:19:54 +01:00
2023-03-22 11:06:55 +01:00
2022-10-03 14:02:55 -07:00
2017-11-02 11:19:54 +01:00
2017-11-02 11:19:54 +01:00
2017-11-02 11:19:54 +01:00
2018-10-02 13:38:55 -07:00
2019-12-04 19:44:14 -08:00
2019-03-17 12:56:32 +09:00
2022-09-11 20:25:46 -07:00
2019-07-16 19:23:25 -07:00
2019-12-04 19:44:14 -08:00
2017-11-02 11:19:54 +01:00
2021-12-09 10:49:56 -08:00
2020-02-21 11:22:15 -08:00
2017-11-02 11:19:54 +01:00
2020-10-26 16:48:22 +01:00
2017-11-02 11:19:54 +01:00
2022-02-17 09:09:37 +01:00
2023-09-11 08:13:18 +00:00
2021-11-03 14:09:26 -05:00
2022-02-17 09:09:36 +01:00
2024-09-11 20:44:32 -07:00
2019-04-19 14:07:40 -07:00
2017-11-02 11:19:54 +01:00
2017-11-02 11:19:54 +01:00
2017-11-02 11:19:54 +01:00
2022-06-27 14:44:20 +02:00
2022-05-19 18:25:26 +02:00
2017-11-02 11:19:54 +01:00
2022-12-01 16:22:06 +01:00
2017-11-02 11:19:54 +01:00
2024-11-06 12:59:44 -05:00