[RFC PATCH 2/3] add statmnt(2) syscall
Christian Brauner
brauner at kernel.org
Tue Sep 26 14:36:59 UTC 2023
> With an opaque, pointer-carrying struct, copying out the data is not
> possible in a generic fashion. Only the parts that the application
> knows about can be copied out. So I think it's desirable to have a
> fairly exact allocation.
This could easily be added if we added size parameters like I originally
suggested for the variable sized mnt_root and mnt_point records into
struct statmount.
If the user specified that they want to retrieve the mnt_root and
mnt_mountpoint in @mask and the size for the relevant field is zero then
we fill in the required size for the relevant field. If they aren't zero
we just try to copy in the data in the relevant pointer field.
I prefer this interface as it allows for both strategies:
* users that don't care about exact allocation size can just pass a
guesstimated buffer usually PATH_MAX/2 or sm
* users that care about exact allocation size can query the kernel
More information about the Linux-security-module-archive
mailing list