mirror of
https://github.com/torvalds/linux.git
synced 2024-11-21 19:41:42 +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> |
||
---|---|---|
.. | ||
bitops | ||
vdso | ||
access_ok.h | ||
agp.h | ||
archrandom.h | ||
asm-offsets.h | ||
asm-prototypes.h | ||
atomic64.h | ||
atomic.h | ||
audit_change_attr.h | ||
audit_dir_write.h | ||
audit_read.h | ||
audit_signal.h | ||
audit_write.h | ||
barrier.h | ||
bitops.h | ||
bitsperlong.h | ||
bug.h | ||
cache.h | ||
cacheflush.h | ||
cfi.h | ||
checksum.h | ||
cmpxchg-local.h | ||
cmpxchg.h | ||
codetag.lds.h | ||
compat.h | ||
current.h | ||
delay.h | ||
device.h | ||
div64.h | ||
dma-mapping.h | ||
dma.h | ||
early_ioremap.h | ||
emergency-restart.h | ||
error-injection.h | ||
exec.h | ||
extable.h | ||
fixmap.h | ||
flat.h | ||
ftrace.h | ||
futex.h | ||
getorder.h | ||
hardirq.h | ||
hugetlb.h | ||
hw_irq.h | ||
hyperv-tlfs.h | ||
int-ll64.h | ||
io.h | ||
ioctl.h | ||
iomap.h | ||
irq_regs.h | ||
irq_work.h | ||
irq.h | ||
irqflags.h | ||
Kbuild | ||
kdebug.h | ||
kmap_size.h | ||
kprobes.h | ||
kvm_para.h | ||
kvm_types.h | ||
linkage.h | ||
local64.h | ||
local.h | ||
logic_io.h | ||
mcs_spinlock.h | ||
memory_model.h | ||
mm_hooks.h | ||
mmiowb_types.h | ||
mmiowb.h | ||
mmu_context.h | ||
mmu.h | ||
mmzone.h | ||
module.h | ||
module.lds.h | ||
mshyperv.h | ||
msi.h | ||
nommu_context.h | ||
numa.h | ||
param.h | ||
parport.h | ||
pci_iomap.h | ||
pci.h | ||
percpu.h | ||
pgalloc.h | ||
pgtable_uffd.h | ||
pgtable-nop4d.h | ||
pgtable-nopmd.h | ||
pgtable-nopud.h | ||
preempt.h | ||
qrwlock_types.h | ||
qrwlock.h | ||
qspinlock_types.h | ||
qspinlock.h | ||
resource.h | ||
runtime-const.h | ||
rwonce.h | ||
seccomp.h | ||
sections.h | ||
serial.h | ||
set_memory.h | ||
shmparam.h | ||
signal.h | ||
simd.h | ||
softirq_stack.h | ||
spinlock_types.h | ||
spinlock.h | ||
statfs.h | ||
string.h | ||
switch_to.h | ||
syscall.h | ||
syscalls.h | ||
timex.h | ||
tlb.h | ||
tlbflush.h | ||
topology.h | ||
trace_clock.h | ||
uaccess.h | ||
unaligned.h | ||
user.h | ||
vermagic.h | ||
vga.h | ||
video.h | ||
vmlinux.lds.h | ||
word-at-a-time.h | ||
xor.h |