From: sashiko-bot@kernel.org
To: "Kiryl Shutsemau" <kirill@shutemov.name>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH v8 15/15] Documentation/userfaultfd: document RWP working set tracking
Date: Fri, 03 Jul 2026 14:42:36 +0000 [thread overview]
Message-ID: <20260703144237.239221F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260703133615.1039465-16-kirill@shutemov.name>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Documentation incorrectly claims UFFDIO_API returns the supported features bitmask on EINVAL
--
commit b47603d883cc00fed0a038162bec7702caba77c6
Author: Kiryl Shutsemau (Meta) <kas@kernel.org>
Documentation/userfaultfd: document RWP working set tracking
This commit adds documentation for the new UFFDIO_REGISTER_MODE_RWP feature,
covering sync and async fault models, UFFDIO_RWPROTECT semantics,
UFFD_FEATURE_RWP_ASYNC, and UFFDIO_SET_MODE runtime mode flips.
> diff --git a/Documentation/admin-guide/mm/userfaultfd.rst b/Documentation/admin-guide/mm/userfaultfd.rst
> index 1e533639fd509..69836e39aa0b6 100644
> --- a/Documentation/admin-guide/mm/userfaultfd.rst
> +++ b/Documentation/admin-guide/mm/userfaultfd.rst
[ ... ]
> @@ -307,6 +307,253 @@ transparent to the guest, we want that same address range to act as if it was
[ ... ]
> +**Feature availability:**
> +
> +RWP is built on top of two kernel primitives: a spare PTE bit owned by
> +userfaultfd (``CONFIG_HAVE_ARCH_USERFAULTFD_WP``) and architecture support
> +for present-but-inaccessible PTEs (``CONFIG_ARCH_HAS_PTE_PROTNONE``). When both
> +are available on a 64-bit kernel, the build selects
> +``CONFIG_USERFAULTFD_RWP=y`` and the ``VM_UFFD_RWP`` VMA flag becomes
> +available.
> +
> +``UFFD_FEATURE_RWP`` and ``UFFD_FEATURE_RWP_ASYNC`` are unavailable when
> +the running kernel or architecture does not support them — for example
> +32-bit kernels (where ``VM_UFFD_RWP`` is unavailable), kernels built
> +without ``CONFIG_USERFAULTFD_RWP``, and architectures whose ptes cannot
> +carry the uffd bit at runtime (e.g. riscv without the ``SVRSW60T59B``
> +extension). Requesting an unsupported feature in
> +``uffdio_api.features`` makes ``UFFDIO_API`` fail with ``EINVAL`` and
> +leaves the userfaultfd context uninitialized; the bitmask returned in
> +``uffdio_api.features`` then advertises the features the kernel does
> +support. The recommended probe sequence is therefore to open a
[Severity: Medium]
Does UFFDIO_API actually return the supported features bitmask on EINVAL?
Userspace programs written according to the Feature availability section
will expect the uffdio_api.features out-parameter to contain the supported
feature mask after a failure (EINVAL). Because the kernel actually returns
0, such programs will incorrectly conclude that the kernel supports no
features at all if they rely on the error path to discover capabilities.
> +throwaway userfaultfd, call ``UFFDIO_API`` once with ``features = 0``,
> +inspect the returned bitmask, close that fd, then open the real one
> +and call ``UFFDIO_API`` again with only the supported features set.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260703133615.1039465-1-kirill@shutemov.name?part=15
next prev parent reply other threads:[~2026-07-03 14:42 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-03 13:35 [PATCH v8 00/15] userfaultfd: working set tracking for VM guest memory Kiryl Shutsemau
2026-07-03 13:36 ` [PATCH v8 01/15] mm: decouple protnone helpers from CONFIG_NUMA_BALANCING Kiryl Shutsemau
2026-07-03 13:36 ` [PATCH v8 02/15] mm: rename uffd-wp PTE bit macros to uffd Kiryl Shutsemau
2026-07-03 13:36 ` [PATCH v8 03/15] mm: rename uffd-wp PTE accessors " Kiryl Shutsemau
2026-07-03 14:00 ` sashiko-bot
2026-07-03 13:36 ` [PATCH v8 04/15] userfaultfd: test uffd VMA flags through the vma_flags_t API Kiryl Shutsemau
2026-07-03 13:36 ` [PATCH v8 05/15] mm: add VM_UFFD_RWP VMA flag Kiryl Shutsemau
2026-07-03 14:08 ` sashiko-bot
2026-07-03 13:36 ` [PATCH v8 06/15] mm: add MM_CP_UFFD_RWP change_protection() flag Kiryl Shutsemau
2026-07-03 14:10 ` sashiko-bot
2026-07-03 13:36 ` [PATCH v8 07/15] mm: preserve RWP marker across PTE rewrites Kiryl Shutsemau
2026-07-03 14:13 ` sashiko-bot
2026-07-03 13:36 ` [PATCH v8 08/15] mm: handle VM_UFFD_RWP in khugepaged, rmap, and GUP Kiryl Shutsemau
2026-07-03 14:26 ` sashiko-bot
2026-07-03 13:36 ` [PATCH v8 09/15] userfaultfd: add UFFDIO_REGISTER_MODE_RWP and UFFDIO_RWPROTECT plumbing Kiryl Shutsemau
2026-07-03 14:33 ` sashiko-bot
2026-07-03 13:36 ` [PATCH v8 10/15] mm/userfaultfd: add RWP fault delivery and expose UFFDIO_REGISTER_MODE_RWP Kiryl Shutsemau
2026-07-03 13:36 ` [PATCH v8 11/15] mm/pagemap: add PAGE_IS_ACCESSED for RWP tracking Kiryl Shutsemau
2026-07-03 13:36 ` [PATCH v8 12/15] userfaultfd: add UFFD_FEATURE_RWP_ASYNC for async fault resolution Kiryl Shutsemau
2026-07-03 13:36 ` [PATCH v8 13/15] userfaultfd: add UFFDIO_SET_MODE for runtime sync/async toggle Kiryl Shutsemau
2026-07-03 14:46 ` sashiko-bot
2026-07-03 13:36 ` [PATCH v8 14/15] selftests/mm: add userfaultfd RWP tests Kiryl Shutsemau
2026-07-03 14:36 ` sashiko-bot
2026-07-03 13:36 ` [PATCH v8 15/15] Documentation/userfaultfd: document RWP working set tracking Kiryl Shutsemau
2026-07-03 14:42 ` sashiko-bot [this message]
2026-07-03 16:43 ` Addressing Sashiko AI review Kiryl Shutsemau
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=20260703144237.239221F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=kirill@shutemov.name \
--cc=kvm@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox