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-11-06 12:59:44 -05:00
2020-03-25 11:50:48 +01:00
2024-04-22 15:33:06 +02:00
2023-08-28 13:30:57 -05:00
2023-11-23 11:32:31 +01:00
2021-10-01 16:52:48 -04:00
2023-08-28 13:30:57 -05:00
2023-08-28 13:30:57 -05:00
2024-02-16 16:49:58 +01:00
2023-08-28 13:30:57 -05:00
2017-11-02 11:10:55 +01:00
2024-04-22 16:51:57 +02:00
2021-10-01 16:52:48 -04:00
2020-06-09 09:39:13 -07:00
2023-10-06 13:25:17 -07:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2024-03-06 13:07:39 -08:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2018-03-18 07:38:45 -07:00
2023-08-22 18:12:25 +09:00
2017-11-02 11:10:55 +01:00
2018-03-18 07:38:48 -07:00
2017-11-02 11:10:55 +01:00
2021-10-08 19:41:39 -04:00
2017-11-02 11:10:55 +01:00
2024-07-11 15:58:18 +02:00
2023-08-22 18:12:25 +09:00
2019-05-21 10:50:45 +02:00
2018-01-22 08:17:15 -08:00
2018-01-22 08:17:15 -08:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2018-12-06 06:56:40 -08:00
2020-09-03 18:12:15 +02:00
2021-08-09 17:13:06 +02:00
2023-08-28 13:30:57 -05:00
2024-03-08 21:20:23 +01:00
2024-05-08 19:42:15 +02:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2019-01-06 09:46:51 +09:00
2024-04-22 15:33:06 +02:00
2024-03-08 21:20:23 +01:00
2020-08-23 17:36:59 -05:00
2024-02-16 16:50:25 +01:00
2017-11-02 11:10:55 +01:00
2020-06-09 09:39:13 -07:00
2024-02-16 16:50:25 +01:00
2022-01-20 08:52:52 +02:00
2024-05-08 19:42:16 +02:00
2024-03-08 21:21:00 +01:00
2024-03-08 21:21:00 +01:00
2023-08-28 13:30:57 -05:00
2023-01-13 11:48:15 +01:00
2024-03-08 21:20:23 +01:00
2023-12-10 17:21:33 -08:00
2021-09-15 13:42:33 -07:00
2017-11-02 11:10:55 +01:00
2024-05-14 00:31:44 -07:00
2024-02-16 16:50:25 +01:00
2023-08-28 13:30:57 -05:00
2024-05-08 19:42:15 +02:00
2023-08-28 13:30:57 -05:00
2017-11-02 11:10:55 +01:00
2023-08-28 13:30:57 -05:00
2023-08-28 13:30:57 -05:00
2024-02-16 16:50:25 +01:00
2024-05-08 19:42:15 +02:00
2023-08-28 13:30:57 -05:00
2024-01-19 08:08:53 -06:00
2024-02-16 16:50:25 +01:00
2017-11-02 11:10:55 +01:00
2024-04-22 15:33:06 +02:00
2017-11-02 11:10:55 +01:00
2024-02-16 16:50:25 +01:00
2023-04-04 10:43:52 -05:00
2020-08-23 17:36:59 -05:00
2024-02-16 16:50:25 +01:00
2023-08-28 13:30:57 -05:00
2023-08-28 13:30:57 -05:00
2023-01-13 11:48:15 +01:00
2023-09-01 09:38:00 -07:00
2020-08-20 13:12:58 +02:00
2020-08-23 17:36:59 -05:00
2024-04-22 15:33:07 +02:00
2019-05-30 11:26:32 -07:00
2024-02-16 16:50:25 +01:00
2017-11-02 11:10:55 +01:00
2024-02-16 16:50:25 +01:00
2017-11-02 11:10:55 +01:00
2022-11-15 14:30:41 -08:00
2022-11-15 14:30:41 -08:00
2018-11-18 13:35:21 -08:00
2021-02-18 16:15:11 -08:00
2022-06-29 17:04:09 -07:00
2023-08-28 13:30:57 -05:00
2024-03-08 21:20:23 +01:00
2024-04-22 15:33:07 +02:00
2023-08-02 15:01:50 -07:00
2024-02-16 16:50:25 +01:00
2024-02-16 16:50:25 +01:00
2019-01-03 18:57:57 -08:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2023-03-24 11:01:28 +01:00
2024-04-22 15:33:07 +02:00
2016-08-07 23:55:43 -04:00
2017-11-02 11:10:55 +01:00
2021-07-01 11:06:04 -07:00
2019-05-21 10:50:45 +02:00
2017-11-02 11:10:55 +01:00
2018-11-18 13:35:21 -08:00
2022-09-29 19:21:10 -07:00
2020-08-07 11:33:26 -07:00
2022-09-29 19:21:10 -07:00
2017-11-02 11:10:55 +01:00
2019-06-19 17:09:52 +02:00
2017-11-02 11:10:55 +01:00
2024-06-25 15:57:25 +02:00
2020-06-02 18:41:48 -07:00
2024-09-09 16:39:13 -07:00
2024-09-09 16:39:13 -07:00
2020-06-23 10:49:54 +02:00
2022-03-22 15:57:10 -07:00
2021-05-02 00:43:34 +09:00
2021-05-02 00:43:34 +09:00
2018-03-20 12:05:17 -04:00
2022-09-09 10:44:34 +02:00
2023-08-28 13:30:57 -05:00
2024-04-22 15:33:06 +02:00
2017-11-02 11:10:55 +01:00
2020-06-09 09:39:13 -07:00
2023-11-23 11:32:31 +01:00
2024-04-22 15:33:06 +02:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2018-03-18 07:38:45 -07:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2021-07-23 13:08:57 -05:00
2017-11-02 11:10:55 +01:00
2024-04-22 15:33:06 +02:00
2018-03-18 07:38:48 -07:00
2017-11-02 11:10:55 +01:00
2020-08-06 16:13:13 +02:00
2024-07-03 15:16:54 +02:00
2020-06-22 15:43:16 -07:00
2017-11-02 11:10:55 +01:00
2023-01-13 11:48:15 +01:00
2021-11-19 09:15:58 -06:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00