mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 04:38:03 +00:00
6140be90ec
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> |
||
---|---|---|
.. | ||
syscalls | ||
.gitignore | ||
adi_64.c | ||
apc.c | ||
asm-offsets.c | ||
audit.c | ||
auxio_32.c | ||
auxio_64.c | ||
btext.c | ||
central.c | ||
cherrs.S | ||
chmc.c | ||
compat_audit.c | ||
cpu.c | ||
cpumap.c | ||
cpumap.h | ||
devices.c | ||
ds.c | ||
dtlb_miss.S | ||
dtlb_prot.S | ||
ebus.c | ||
entry.h | ||
entry.S | ||
etrap_32.S | ||
etrap_64.S | ||
fpu_traps.S | ||
ftrace.c | ||
getsetcc.S | ||
head_32.S | ||
head_64.S | ||
helpers.S | ||
hvapi.c | ||
hvcalls.S | ||
hvtramp.S | ||
idprom.c | ||
iommu_common.h | ||
iommu-common.c | ||
iommu.c | ||
ioport.c | ||
irq_32.c | ||
irq_64.c | ||
irq.h | ||
itlb_miss.S | ||
ivec.S | ||
jump_label.c | ||
kernel.h | ||
kgdb_32.c | ||
kgdb_64.c | ||
kprobes.c | ||
kstack.h | ||
ktlb.S | ||
ldc.c | ||
led.c | ||
leon_kernel.c | ||
leon_pci_grpci1.c | ||
leon_pci_grpci2.c | ||
leon_pci.c | ||
leon_pmc.c | ||
leon_smp.c | ||
Makefile | ||
mdesc.c | ||
misctrap.S | ||
module.c | ||
nmi.c | ||
of_device_32.c | ||
of_device_64.c | ||
of_device_common.c | ||
of_device_common.h | ||
pci_common.c | ||
pci_fire.c | ||
pci_impl.h | ||
pci_msi.c | ||
pci_psycho.c | ||
pci_sabre.c | ||
pci_schizo.c | ||
pci_sun4v_asm.S | ||
pci_sun4v.c | ||
pci_sun4v.h | ||
pci.c | ||
pcic.c | ||
pcr.c | ||
perf_event.c | ||
pmc.c | ||
power.c | ||
process_32.c | ||
process_64.c | ||
process.c | ||
prom_32.c | ||
prom_64.c | ||
prom_common.c | ||
prom_irqtrans.c | ||
prom.h | ||
psycho_common.c | ||
psycho_common.h | ||
ptrace_32.c | ||
ptrace_64.c | ||
reboot.c | ||
rtrap_32.S | ||
rtrap_64.S | ||
sbus.c | ||
setup_32.c | ||
setup_64.c | ||
signal32.c | ||
signal_32.c | ||
signal_64.c | ||
sigutil_32.c | ||
sigutil_64.c | ||
sigutil.h | ||
smp_32.c | ||
smp_64.c | ||
sparc_ksyms.c | ||
spiterrs.S | ||
sstate.c | ||
stacktrace.c | ||
starfire.c | ||
sun4d_irq.c | ||
sun4d_smp.c | ||
sun4m_irq.c | ||
sun4m_smp.c | ||
sun4v_ivec.S | ||
sun4v_mcd.S | ||
sun4v_tlb_miss.S | ||
sys32.S | ||
sys_sparc32.c | ||
sys_sparc_32.c | ||
sys_sparc_64.c | ||
syscalls.S | ||
sysfs.c | ||
systbls_32.S | ||
systbls_64.S | ||
systbls.h | ||
termios.c | ||
time_32.c | ||
time_64.c | ||
trampoline_32.S | ||
trampoline_64.S | ||
traps_32.c | ||
traps_64.c | ||
tsb.S | ||
ttable_32.S | ||
ttable_64.S | ||
una_asm_32.S | ||
una_asm_64.S | ||
unaligned_32.c | ||
unaligned_64.c | ||
uprobes.c | ||
urtt_fill.S | ||
utrap.S | ||
vdso.c | ||
vio.c | ||
viohs.c | ||
visemul.c | ||
vmlinux.lds.S | ||
windows.c | ||
winfixup.S | ||
wof.S | ||
wuf.S |