Re: [PATCH v2 1/1] userfaultfd/sysctl: add vm.unprivileged_userfaultfd

From: Xiaoming Ni
Date: Thu May 28 2020 - 04:50:55 EST

On 2020/5/27 22:21, Peter Xu wrote:
On Wed, May 27, 2020 at 02:54:13PM +0800, Xiaoming Ni wrote:

On Tue, Mar 19, 2019 at 11:07:22AM +0800, Peter Xu wrote:
Add a global sysctl knob "vm.unprivileged_userfaultfd" to control
whether userfaultfd is allowed by unprivileged users. When this is
set to zero, only privileged users (root user, or users with the
CAP_SYS_PTRACE capability) will be able to use the userfaultfd


Hi, Xiaoming,

I am a bit confused about this patch, can you help to answer it.

Why the sysctl interface of fs/userfaultfd.c belongs to vm_table instead of
fs_table ?

Because I think it makes more sense to put the new key into where it suites
better, irrelevant to which directory the variable is declared. To me,
unprivileged_userfaultfd is definitely more suitable for vm rather than fs,
because userfaultfd is really about memory management rather than file system.


Thank you for your answer
Since userfaultfd and vm are more closely related, will there be consideration to move fs/userfaultfd.c to the mm directory in the future?

Xiaoming Ni