summaryrefslogtreecommitdiff
path: root/net/xfrm
diff options
context:
space:
mode:
authorChristian Brauner <brauner@kernel.org>2023-11-19 22:58:49 +0300
committerChristian Brauner <brauner@kernel.org>2023-12-14 13:49:05 +0300
commit68385d77c05b401f748acecc0e0a8eff10489334 (patch)
tree5dd9ba5837922d683e42ccdfdba8b48a8de1a411 /net/xfrm
parent6971beb4ec52ad7b26f5b5eedf19d4963be7df1b (diff)
downloadlinux-68385d77c05b401f748acecc0e0a8eff10489334.tar.xz
statmount: simplify string option retrieval
The previous code was a bit too clever for what we currently support. A few minor changes: * Avoid indirect function calls and use a simple switch statement. We really only have three cases to handle so it's not like it's massively complex. We can switch to something more elaborate should we introduce more complex options. * Defer all copy_to_user() calls until after we've given up namespace semaphore. On kernels with userfaultfd it's possible to abuse copy_from/to_user() calls to indefinitely block on page faults. That's usually a privileged operation but may be made available to unprivileged users. Independent of userfaultfd it's better to not do all the copy_to_user() work while holding namespace semaphore. Instead collect the information and then copy it out after we've given up all locks. * This also folds a change from Arnd to reduce the stack size in prepare_kstatmount() to avoid warning such as: fs/namespace.c:4995:1: error: stack frame size (1536) exceeds limit (1024) in '__se_sys_statmount' [-Werror,-Wframe-larger-than] 4995 | SYSCALL_DEFINE4(statmount, const struct mnt_id_req __user *, req, Reviewed-by: Ian Kent <raven@themaw.net> Link: https://lore.kernel.org/r/20231213090015.518044-1-arnd@kernel.org Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'net/xfrm')
0 files changed, 0 insertions, 0 deletions