On 2024-10-21, Christian Brauner brauner@kernel.org wrote:
On Thu, 10 Oct 2024 07:40:33 +1100, Aleksa Sarai wrote:
This is something that I've been thinking about for a while. We had a discussion at LPC 2020 about this[1] but the proposals suggested there never materialised.
In short, it is quite difficult for userspace to detect the feature capability of syscalls at runtime. This is something a lot of programs want to do, but they are forced to create elaborate scenarios to try to figure out if a feature is supported without causing damage to the system. For the vast majority of cases, each individual feature also needs to be tested individually (because syscall results are all-or-nothing), so testing even a single syscall's feature set can easily inflate the startup time of programs.
[...]
I think the copy_struct_to_user() is useful especially now that we'll gain another user with pidfd_info.
Once we start extending pidfd_info, it might be necessary to add some more helpers to make it easier to figure out what bits to set in the returned request mask.
Applied to the vfs.usercopy branch of the vfs/vfs.git tree. Patches in the vfs.usercopy branch should appear in linux-next soon.
Please report any outstanding bugs that were missed during review in a new review to the original patch series allowing us to drop it.
It's encouraged to provide Acked-bys and Reviewed-bys even though the patch has now been applied. If possible patch trailers will be updated.
Note that commit hashes shown below are subject to change due to rebase, trailer updates or similar. If in doubt, please check the listed branch.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git branch: vfs.usercopy
[01/10] uaccess: add copy_struct_to_user helper https://git.kernel.org/vfs/vfs/c/424a55a4a908 [02/10] sched_getattr: port to copy_struct_to_user https://git.kernel.org/vfs/vfs/c/112cca098a70