Skip to content

userfaultfd: allow to forbid unprivileged users

Peter Xu linux-api linux-fsdevel linux-mm lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest1 patch 9 repliesIn review
  2. v13 patches 24 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/1userfaultfd/sysctl: add vm.unprivileged_userfaultfdDocumentation/sysctl/vm.txt fs/userfaultfd.c include/linux/userfaultfd_k.h +1 more+31 -09 replies

Reviews trailers per patch

The patch has a Reviewed-by or Acked-by.

PatchMike RapoportAndrea Arcangeli
1/1R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/1] userfaultfd: allow to forbid unprivileged users

Hi,

This is the second version of the work. V1 was here:

https://lkml.org/lkml/2019/3/11/207

I removed CC to kvm list since not necessary any more, but added linux-api to the list as suggested by Kirill.

This one greatly simplifies the previous version, dropped the kvm special entry and mimic the sysctl_unprivileged_bpf_disabled knob for userfaultfd as suggested by many. The major differences comparing to the BPF flag are: (1) use PTRACE instead of ADMIN capability, and (2) allow to switch the flag back and forth (BPF does not allow to switch back to "enabled" if "disabled" once).

So the main idea of this simpler version is that we still keep the old way as is by default but we only provide a way for admins when they really want to turn userfaultfd off for unprivileged users.

About procfs vs sysfs: I still used the procfs way because admins can still leverage sysctl.conf with that and also since no one yet explicitly asked for sysfs for a better reason yet (And I just noticed BPF just added another bpf_stats_enabled into sysctl a few weeks ago).

Please have a look, thanks.

Peter Xu (1):
userfaultfd/sysctl: add vm.unprivileged_userfaultfd

 Documentation/sysctl/vm.txt   | 12 ++++++++++++
 fs/userfaultfd.c              |  5 +++++
 include/linux/userfaultfd_k.h |  2 ++
 kernel/sysctl.c               | 12 ++++++++++++
 4 files changed, 31 insertions(+)
Signature · 1 line
2.17.1