All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] userfaultfd.2: Add UFFD_USER_MODE_ONLY flag
@ 2021-01-26  1:44 Lokesh Gidra
  2021-01-26 17:50   ` Lokesh Gidra
  0 siblings, 1 reply; 3+ messages in thread
From: Lokesh Gidra @ 2021-01-26  1:44 UTC (permalink / raw)
  To: linux-man
  Cc: Daniel Colascione, linux-kernel, kaleshsingh, calin, surenb,
	jeffv, kernel-team, Peter Xu, Andrea Arcangeli, Andrew Morton,
	linux-mm, Lokesh Gidra

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] userfaultfd.2: Add UFFD_USER_MODE_ONLY flag
  2021-01-26  1:44 [PATCH v1] userfaultfd.2: Add UFFD_USER_MODE_ONLY flag Lokesh Gidra
@ 2021-01-26 17:50   ` Lokesh Gidra
  0 siblings, 0 replies; 3+ messages in thread
From: Lokesh Gidra @ 2021-01-26 17:50 UTC (permalink / raw)
  To: linux-man
  Cc: Daniel Colascione, linux-kernel, Kalesh Singh, Calin Juravle,
	Suren Baghdasaryan, Jeffrey Vander Stoep, Cc: Android Kernel,
	Peter Xu, Andrea Arcangeli, Andrew Morton,
	open list:MEMORY MANAGEMENT

On Mon, Jan 25, 2021 at 5:44 PM Lokesh Gidra <lokeshgidra@google.com> wrote:
>
> 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
> --

Adding the right linux-mm mailing list. Mistakenly used
linux-mm@kvack.kernel.org earlier.

> 2.30.0.280.ga3ce27912f-goog
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] userfaultfd.2: Add UFFD_USER_MODE_ONLY flag
@ 2021-01-26 17:50   ` Lokesh Gidra
  0 siblings, 0 replies; 3+ messages in thread
From: Lokesh Gidra @ 2021-01-26 17:50 UTC (permalink / raw)
  To: linux-man
  Cc: Daniel Colascione, linux-kernel, Kalesh Singh, Calin Juravle,
	Suren Baghdasaryan, Jeffrey Vander Stoep, Cc: Android Kernel,
	Peter Xu, Andrea Arcangeli, Andrew Morton,
	open list:MEMORY MANAGEMENT

On Mon, Jan 25, 2021 at 5:44 PM Lokesh Gidra <lokeshgidra@google.com> wrote:
>
> 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
> --

Adding the right linux-mm mailing list. Mistakenly used
linux-mm@kvack.kernel.org earlier.

> 2.30.0.280.ga3ce27912f-goog
>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-01-26 18:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-26  1:44 [PATCH v1] userfaultfd.2: Add UFFD_USER_MODE_ONLY flag Lokesh Gidra
2021-01-26 17:50 ` Lokesh Gidra
2021-01-26 17:50   ` Lokesh Gidra

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.