On Thu, May 14, 2026 at 05:29:31PM -0700, SeongJae Park wrote:
> On Fri,  8 May 2026 16:55:16 +0100 "Kiryl Shutsemau (Meta)" <[email protected]> 
> wrote:
> 
> > Preparatory patch for userfaultfd read-write protection (RWP). RWP
> > extends userfaultfd protection from plain write-protection (WP) to
> > full read-write protection: accesses to an RWP-protected range --
> > reads as well as writes -- trap through userfaultfd.
> > 
> > RWP marks ranges by combining PAGE_NONE with the uffd PTE bit, so
> > the flag is only meaningful when both primitives exist. A new
> > CONFIG_USERFAULTFD_RWP Kconfig symbol auto-selects when CONFIG_64BIT,
> > CONFIG_ARCH_HAS_PTE_PROTNONE, and CONFIG_HAVE_ARCH_USERFAULTFD_WP
> > are all set; call sites that gate on the flag depend on the symbol.
> > Elsewhere VM_UFFD_RWP aliases VM_NONE and every downstream check
> > folds to dead code.
> > 
> > Nothing sets the flag yet.
> > 
> > Signed-off-by: Kiryl Shutsemau <[email protected]>
> > Assisted-by: Claude:claude-opus-4-6
> 
> A silly but loud thought.  Would it make more sense to put Signed-off-by: 
> after
> Assisted-by: ?

I am not sure. I see it both ways in git log. And I don't have strong
opinion on the order here. Keeping as is.

> > ---
> >  Documentation/filesystems/proc.rst |  1 +
> >  fs/proc/task_mmu.c                 |  3 +++
> >  include/linux/mm.h                 | 28 +++++++++++++++++----------
> >  include/linux/userfaultfd_k.h      | 31 +++++++++++++++++++++++++-----
> >  include/trace/events/mmflags.h     |  7 +++++++
> >  mm/Kconfig                         |  9 +++++++++
> >  6 files changed, 64 insertions(+), 15 deletions(-)
> > 
> > diff --git a/Documentation/filesystems/proc.rst 
> > b/Documentation/filesystems/proc.rst
> > index db6167befb7b..db28207c5290 100644
> > --- a/Documentation/filesystems/proc.rst
> > +++ b/Documentation/filesystems/proc.rst
> > @@ -607,6 +607,7 @@ encoded manner. The codes are the following:
> >      um    userfaultfd missing tracking
> >      uw    userfaultfd wr-protect tracking
> >      ui    userfaultfd minor fault
> > +    ur    userfaultfd read-write-protect tracking
> 
> Yet another silly but loud thought.  My first feeling on this was that this
> reads like 'u'serfaultfd 'r'ead-protect.  And was further thinking 'uf' for
> just 'u'seffaultfd 'f'ault or 'up' for 'u'serfault-'p'rotect might make sense.
> But ended up thinking this is too trivial and ain't really matter.

I will keep it. It's "u" + the first distinguishing letter of the mode
name. r distinguishes RWP from WP cleanly.

> [...]
> > diff --git a/mm/Kconfig b/mm/Kconfig
> > index e8bf1e9e6ad9..ccf534a8cbc9 100644
> > --- a/mm/Kconfig
> > +++ b/mm/Kconfig
> > @@ -1347,6 +1347,15 @@ config HAVE_ARCH_USERFAULTFD_MINOR
> >     help
> >       Arch has userfaultfd minor fault support
> >  
> > +config USERFAULTFD_RWP
> > +   def_bool y
> > +   depends on 64BIT && ARCH_HAS_PTE_PROTNONE && HAVE_ARCH_USERFAULTFD_WP
> > +   help
> > +     Userfaultfd read-write protection (UFFDIO_RWPROTECT) delivers a
> 
> Seems UFFDIO_RWPROTECT will be introduced later.  Would it make more sense to
> add this config together with the patch?


Okay, I will move later in the patchset.

> > +     userfaultfd notification on every access -- read or write -- to a
> > +     protected range, letting userspace observe the working set of a
> > +     process.
> > +
> >  menuconfig USERFAULTFD
> >     bool "Enable userfaultfd() system call"
> >     depends on MMU
> > -- 
> > 2.51.2
> > 
> > 
> 
> None of my comments is a blocker.
> 
> Reviewed-by: SeongJae Park <[email protected]>

Thanks!

-- 
  Kiryl Shutsemau / Kirill A. Shutemov

Reply via email to