[LTP] [PATCH v2] syscalls/mount_setattr01: Add basic functional test

Cyril Hrubis chrubis@suse.cz
Thu Apr 21 11:13:57 CEST 2022


Hi!
> > +struct mount_attr {
> > +	uint64_t attr_set;
> > +	uint64_t attr_clr;
> > +	uint64_t propagation;
> > +	uint64_t userns_fd;
> > +};
> Interesting enough: in kernel tools/testing/selftests/mount_setattr/mount_setattr_test.c
> defines it as __u64 (IMHO should be really uint64_t as that test is userspace as
> Cyril pointed out) but real kernel code in fs/namespace.c happily uses "unsigned
> int" :).

You are just confused by the fact that there are two different
structures there is mount_attr and mount_kattr, the mount_setattr()
syscall gets the mount_attr from userspace and then fills in mount_kattr
based on that. See the function build_mount_kattr() in fs/namespace.c

I guess that this is simply done so that there is enough space for flags
to be added in the future without a need to change the structure.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list