linux/arch/microblaze/kernel
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
..
cpu microblaze: Remove early printk call from cpuinfo-static.c 2024-04-24 10:27:31 +02:00
syscalls fs/xattr: add *at family syscalls 2024-11-06 12:59:44 -05:00
.gitignore .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
asm-offsets.c microblaze: Add custom break vector handler for mb manager 2022-09-26 14:13:28 +02:00
dma.c dma-mapping: merge <linux/dma-noncoherent.h> into <linux/dma-map-ops.h> 2020-10-06 07:07:06 +02:00
entry.S microblaze: Add support for error injection 2022-09-26 14:13:29 +02:00
exceptions.c exit: Add and use make_task_dead. 2021-12-13 12:04:45 -06:00
ftrace.c ftrace: Cleanup ftrace_dyn_arch_init() 2021-10-08 19:41:39 -04:00
head.S microblaze: Remove noMMU code 2020-11-26 16:39:35 +01:00
hw_exception_handler.S microblaze: Remove noMMU code 2020-11-26 16:39:35 +01:00
irq.c irqchip/xilinx: Switch to GENERIC_IRQ_MULTI_HANDLER 2022-03-04 14:32:57 +00:00
kgdb.c microblaze: fix typos in comments 2022-05-02 08:36:10 +02:00
Makefile microblaze: Remove gcc flag for non existing early_printk.c file 2024-04-24 10:27:31 +02:00
mcount.S microblaze: ftrace: Remove check of obsolete variable function_trace_stop 2014-07-18 13:57:08 -04:00
microblaze_ksyms.c microblaze: use generic strncpy/strnlen from_user 2021-07-27 23:01:13 +02:00
misc.S microblaze: Add sync to tlb operations 2020-02-25 12:33:19 +01:00
module.c microblaze: Remove support for gcc < 4 2021-02-11 18:54:08 +01:00
process.c arch/idle: Change arch_cpu_idle() behavior: always exit with IRQs disabled 2023-01-13 11:48:15 +01:00
prom.c of/flattree: Replace all non-returning strlcpy with strscpy 2023-06-14 12:04:06 -07:00
ptrace.c ptrace: Create ptrace_report_syscall_{entry,exit} in ptrace.h 2022-03-10 13:35:08 -06:00
reset.c microblaze: Explicitly include correct DT includes 2023-07-17 08:22:42 +02:00
setup.c microblaze: Remove noMMU code 2020-11-26 16:39:35 +01:00
signal.c microblaze: allow pte_offset_map() to fail 2023-06-19 16:19:06 -07:00
stacktrace.c microblaze: add loglvl to microblaze_unwind() 2020-06-09 09:39:11 -07:00
sys_microblaze.c syscalls: mmap(): use unsigned offset type consistently 2024-06-25 15:57:38 +02:00
syscall_table.S microblaze: syscalls: switch to generic syscalltbl.sh 2021-03-02 13:21:22 +01:00
timer.c pwm: Add support for Xilinx AXI Timer 2022-04-22 18:30:44 +02:00
traps.c arch: include linux/cpu.h for trap_init() prototype 2023-11-23 11:32:31 +01:00
unwind.c microblaze: Remove noMMU code 2020-11-26 16:39:35 +01:00
vmlinux.lds.S objtool/idle: Validate __cpuidle code as noinstr 2023-01-13 11:48:15 +01:00