linux-user: implement mount_setattr(2)
PATCH 1/1 linux-user: implement mount_setattr(2)
mount_setattr() was in the syscall tables but had no implementation, so guests always got -ENOSYS. systemd uses it when setting up per-unit credential mounts, which fails the affected units with EXIT_CREDENTIALS.
struct mount_attr is an extensible struct like open_how, so handle it the same way openat2() does: reject sizes smaller than the ver0 struct and require any unknown trailing bytes to be zero. All of its fields are 64-bit, and the MOUNT_ATTR_* and MS_* propagation values are identical on every target, so only the byte order needs fixing up.
--- linux-user/strace.list | 3 +++ linux-user/syscall.c | 44 +++++++++++++++++++++++++++++++++++++++ linux-user/syscall_defs.h | 13 ++++++++++++ 3 files changed, 60 insertions(+)
linux-user/strace.list +3 -0
@@ -1737,3 +1737,6 @@ #ifdef TARGET_NR_fspick { TARGET_NR_fspick, "fspick", "%s(%d,%s,%d)", NULL, NULL }, #endif +#ifdef TARGET_NR_mount_setattr +{ TARGET_NR_mount_setattr, "mount_setattr", "%s(%d,%s,%d,%p,%d)", NULL, NULL }, +#endif
linux-user/syscall.c +44 -0
56 lines not on this page · raw message
linux-user/syscall_defs.h +13 -0
@@ -2770,6 +2770,19 @@ struct target_open_how_ver0 {abi_ullong mode;abi_ullong resolve; }; +/* from kernel's include/uapi/linux/mount.h */ +struct mount_attr_ver0 { +uint64_t attr_set; +uint64_t attr_clr; +uint64_t propagation; +uint64_t userns_fd; +}; +struct target_mount_attr_ver0 { +abi_ullong attr_set; +abi_ullong attr_clr; +abi_ullong propagation; +abi_ullong userns_fd; +};#ifndef RESOLVE_NO_MAGICLINKS #define RESOLVE_NO_MAGICLINKS 0x02#endif
Signature · 1 line
2.54.0
Quoted 10 lines · Matt Turner
mount_setattr()was in the syscall tables but had no implementation, so guests always got-ENOSYS. systemd uses it when setting up per-unit credential mounts, which fails the affected units withEXIT_CREDENTIALS.struct
mount_attris an extensible struct likeopen_how, so handle it the same wayopenat2()does: reject sizes smaller than the ver0 struct and require any unknown trailing bytes to be zero. All of its fields are 64-bit, and the MOUNT_ATTR_* and MS_* propagation values are identical on every target, so only the byte order needs fixing up.
Quoted 6 lines
Signed-off-by Matt Turner <[email protected]>--- linux-user/strace.list | 3 +++ linux-user/syscall.c | 44 +++++++++++++++++++++++++++++++++++++++ linux-user/syscall_defs.h | 13 ++++++++++++ 3 files changed, 60 insertions(+)
I'll queue that patch (and the others) up for after qemu-v11.1 has been released.
Thanks!
Helge