linux/arch/powerpc
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
..
boot xz: remove XZ_EXTERN and extern from functions 2024-09-01 20:43:27 -07:00
configs ALong with the usual shower of singleton patches, notable patch series in 2024-09-21 07:29:05 -07:00
crypto crypto: powerpc/p10-aes-gcm - Disable CRYPTO_AES_GCM_P10 2024-09-21 17:14:59 +08:00
include ALong with the usual shower of singleton patches, notable patch series in 2024-09-21 07:29:05 -07:00
kernel fs/xattr: add *at family syscalls 2024-11-06 12:59:44 -05:00
kexec powerpc updates for 6.11 2024-07-19 21:00:33 -07:00
kvm struct fd layout change (and conversion to accessor helpers) 2024-09-23 09:35:36 -07:00
lib powerpc/vdso32: Fix use of crtsavres for PPC64 2024-09-20 19:06:19 +10:00
math-emu
mm ALong with the usual shower of singleton patches, notable patch series in 2024-09-21 07:29:05 -07:00
net powerpc updates for 6.11 2024-07-19 21:00:33 -07:00
perf powerpc/perf: Set cpumode flags using sample address 2024-06-17 22:47:16 +10:00
platforms struct fd layout change (and conversion to accessor helpers) 2024-09-23 09:35:36 -07:00
purgatory Makefile: remove redundant tool coverage variables 2024-05-14 23:35:48 +09:00
sysdev powerpc: Switch back to struct platform_driver::remove() 2024-09-10 11:27:40 +10:00
tools powerpc/tools: Pass -mabi=elfv2 to gcc-check-mprofile-kernel.sh 2023-10-20 17:46:33 +11:00
xmon powerpc/xmon: Fix tmpstr length check in scanhex 2024-08-27 17:10:55 +10:00
Kbuild powerpc: Fix fatal warnings flag for LLVM's integrated assembler 2024-04-08 16:06:41 +10:00
Kconfig dma-mapping updates for linux 6.12 2024-09-19 11:12:49 +02:00
Kconfig.debug powerpc/64s: Remove the "fast endian switch" syscall 2024-09-05 22:30:05 +10:00
Makefile powerpc: Remove 40x from Kconfig and defconfig 2024-06-28 22:28:47 +10:00
Makefile.postlink kbuild: remove ARCH_POSTLINK from module builds 2023-10-28 21:10:08 +09:00