mbox series

[v3,0/4] querying mount attributes

Message ID 20230928130147.564503-1-mszeredi@redhat.com (mailing list archive)
Headers show
Series querying mount attributes | expand

Message

Miklos Szeredi Sept. 28, 2023, 1:01 p.m. UTC
Implement mount querying syscalls agreed on at LSF/MM 2023.

Features:

 - statx-like want/got mask

 - allows returning ascii strings (fs type, root, mount point)

 - returned buffer is relocatable (no pointers)


Still missing:

 - man pages

 - kselftest

 - syscalls on non-x86 archs


Please find the test utility at the end of this mail.

  Usage: statmnt [-l] (mnt_id|path)


Git tree:

  git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs.git#statmount-v3


Changes v1..v3:

 - rename statmnt(2) -> statmount(2)

 - rename listmnt(2) -> listmount(2)

 - make ABI 32bit compatible by passing 64bit args in a struct (tested on
   i386 and x32)

 - only accept new 64bit mount IDs

 - fix compile on !CONFIG_PROC_FS

 - call security_sb_statfs() in both syscalls

 - make lookup_mnt_in_ns() static

 - add LISTMOUNT_UNREACHABLE flag to listmnt() to explicitly ask for
   listing unreachable mounts

 - remove .sb_opts

 - remove subtype from .fs_type

 - return the number of bytes used (including strings) in .size

 - rename .mountpoint -> .mnt_point

 - point strings by an offset against char[] VLA at the end of the struct.
   E.g. printf("fs_type: %s\n", st->str + st->fs_type);

 - don't save string lengths

 - extend spare space in struct statmnt (complete size is now 512 bytes)


---
Miklos Szeredi (4):
  add unique mount ID
  namespace: extract show_path() helper
  add statmount(2) syscall
  add listmount(2) syscall

 arch/x86/entry/syscalls/syscall_32.tbl |   2 +
 arch/x86/entry/syscalls/syscall_64.tbl |   2 +
 fs/internal.h                          |   2 +
 fs/mount.h                             |   3 +-
 fs/namespace.c                         | 365 +++++++++++++++++++++++++
 fs/proc_namespace.c                    |  10 +-
 fs/stat.c                              |   9 +-
 fs/statfs.c                            |   1 +
 include/linux/syscalls.h               |   8 +
 include/uapi/asm-generic/unistd.h      |   8 +-
 include/uapi/linux/mount.h             |  59 ++++
 include/uapi/linux/stat.h              |   1 +
 12 files changed, 459 insertions(+), 11 deletions(-)