From: Lokesh Gidra <lokeshgidra@google.com>
To: linux-man@vger.kernel.org
Cc: Daniel Colascione <dancol@dancol.org>,
linux-kernel@vger.kernel.org, kaleshsingh@google.com,
calin@google.com, surenb@google.com, jeffv@google.com,
kernel-team@android.com, Peter Xu <peterx@redhat.com>,
Andrea Arcangeli <aarcange@redhat.com>,
Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.kernel.org, Lokesh Gidra <lokeshgidra@google.com>
Subject: [PATCH v1] userfaultfd.2: Add UFFD_USER_MODE_ONLY flag
Date: Mon, 25 Jan 2021 17:44:50 -0800 [thread overview]
Message-ID: <20210126014450.1901335-1-lokeshgidra@google.com> (raw)
Add description of UFFD_USER_MODE_ONLY flag to userfaultfd(2) manual
page, which is required after [1]. Also updated the description of
unprivileged_userfaultfd file in proc(5) as per [2].
[1] https://lore.kernel.org/linux-mm/20201215031349.NXimL388W%25akpm@linux-foundation.org/
[2] https://lore.kernel.org/linux-mm/20201215031354.gUsHJUpKo%25akpm@linux-foundation.org/
Signed-off-by: Lokesh Gidra <lokeshgidra@google.com>
---
man2/userfaultfd.2 | 5 +++++
man5/proc.5 | 12 ++++++++++++
2 files changed, 17 insertions(+)
diff --git a/man2/userfaultfd.2 b/man2/userfaultfd.2
index e7dc9f813..792a49d52 100644
--- a/man2/userfaultfd.2
+++ b/man2/userfaultfd.2
@@ -72,6 +72,11 @@ See the description of the
.BR O_NONBLOCK
flag in
.BR open (2).
+.TP
+.BR UFFD_USER_MODE_ONLY " (Since Linux 5.11)"
+Allow handling of user-mode page-faults only. See the description of the
+unprivileged_userfaultfd file in
+.BR proc (5).
.PP
When the last file descriptor referring to a userfaultfd object is closed,
all memory ranges that were registered with the object are unregistered
diff --git a/man5/proc.5 b/man5/proc.5
index f16a29d6e..cb2350c0c 100644
--- a/man5/proc.5
+++ b/man5/proc.5
@@ -5905,6 +5905,18 @@ If this file has the value 0, then only processes that have the
capability may employ
.BR userfaultfd (2).
The default value in this file is 1.
+.IP
+Starting with Linux 5.11,
+.BR userfaultfd (2)
+can be used by all processes, however, if this file has the value 0, then
+.BR UFFD_USER_MODE_ONLY
+flag must be passed to it, which restricts page-fault handling to only
+user-mode faults. This restriction is not applicable for processes with
+.B CAP_SYS_PTRACE
+capability, or if this file has the value 1. Furthermore, the default
+value in this file is changed to 0. For further details see the
+Linux kernel source file
+.I Documentation/admin\-guide/sysctl/vm.rst.
.TP
.IR /proc/sysrq\-trigger " (since Linux 2.4.21)"
Writing a character to this file triggers the same SysRq function as
--
2.30.0.280.ga3ce27912f-goog
next reply other threads:[~2021-01-26 10:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-26 1:44 Lokesh Gidra [this message]
2021-01-26 17:50 ` [PATCH v1] userfaultfd.2: Add UFFD_USER_MODE_ONLY flag Lokesh Gidra
2021-01-26 17:50 ` Lokesh Gidra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210126014450.1901335-1-lokeshgidra@google.com \
--to=lokeshgidra@google.com \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=calin@google.com \
--cc=dancol@dancol.org \
--cc=jeffv@google.com \
--cc=kaleshsingh@google.com \
--cc=kernel-team@android.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-man@vger.kernel.org \
--cc=linux-mm@kvack.kernel.org \
--cc=peterx@redhat.com \
--cc=surenb@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.