* Re: [PATCH v4 13/14] selftests/mm: add userfaultfd RWP tests
[not found] <20260525113737.1942478-14-kas@kernel.org>
@ 2026-05-25 12:39 ` sashiko-bot
2026-05-25 15:43 ` Kiryl Shutsemau
0 siblings, 1 reply; 2+ messages in thread
From: sashiko-bot @ 2026-05-25 12:39 UTC (permalink / raw)
Cc: kvm
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Hardcoding _UFFDIO_SET_MODE in the unconditionally checked expected_ioctls breaks the userfaultfd selftests on older kernels.
--
commit 2e7d7c5845ff822166d0f5b0dd880bef4b890a15
Author: Kiryl Shutsemau (Meta) <kas@kernel.org>
selftests/mm: add userfaultfd RWP tests
This commit adds coverage for UFFDIO_REGISTER_MODE_RWP and UFFDIO_RWPROTECT.
It introduces multiple test cases for sync and async modes, mprotect
interactions, GUP paths, and fork behaviors.
> diff --git a/tools/testing/selftests/mm/uffd-unit-tests.c b/tools/testing/selftests/mm/uffd-unit-tests.c
> index a6c14109e8188..bd6f35ddaa4d0 100644
> --- a/tools/testing/selftests/mm/uffd-unit-tests.c
> +++ b/tools/testing/selftests/mm/uffd-unit-tests.c
> @@ -109,6 +111,11 @@ static void uffd_test_skip(const char *message)
>
> static void test_uffd_api(bool use_dev)
> {
> + const uint64_t expected_ioctls =
> + BIT_ULL(_UFFDIO_REGISTER) |
> + BIT_ULL(_UFFDIO_UNREGISTER) |
> + BIT_ULL(_UFFDIO_API) |
> + BIT_ULL(_UFFDIO_SET_MODE);
> struct uffdio_api uffdio_api;
> int uffd;
[ ... ]
> @@ -148,6 +155,15 @@ static void test_uffd_api(bool use_dev)
> goto out;
> }
>
> + /* Verify returned fd-level ioctls bitmask */
> + if ((uffdio_api.ioctls & expected_ioctls) != expected_ioctls) {
> + uffd_test_fail("UFFDIO_API missing expected ioctls: "
[Severity: Medium]
Will this unconditional check cause the baseline test_uffd_api to fail on
older kernels that do not support UFFDIO_SET_MODE? Since the selftests are
usually expected to gracefully skip unsupported tests, it seems hardcoding
this bit into expected_ioctls might break backward compatibility for the
test suite.
> + "got=0x%"PRIx64", expected=0x%"PRIx64,
> + (uint64_t)uffdio_api.ioctls,
> + expected_ioctls);
> + goto out;
> + }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260525113737.1942478-1-kas@kernel.org?part=13
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v4 13/14] selftests/mm: add userfaultfd RWP tests
2026-05-25 12:39 ` [PATCH v4 13/14] selftests/mm: add userfaultfd RWP tests sashiko-bot
@ 2026-05-25 15:43 ` Kiryl Shutsemau
0 siblings, 0 replies; 2+ messages in thread
From: Kiryl Shutsemau @ 2026-05-25 15:43 UTC (permalink / raw)
To: sashiko-reviews
Cc: kvm, akpm, rppt, peterx, david, ljs, surenb, vbabka, Liam.Howlett,
ziy, corbet, skhan, seanjc, pbonzini, jthoughton, aarcange, sj,
usama.arif, linux-mm, linux-kernel, linux-doc, linux-kselftest,
kernel-team
On Mon, May 25, 2026 at 12:39:03PM +0000, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Medium] Hardcoding _UFFDIO_SET_MODE in the unconditionally checked
> expected_ioctls breaks the userfaultfd selftests on older kernels.
Will be fixed in v5 -- dropped _UFFDIO_SET_MODE from expected_ioctls in
test_uffd_api(). The dedicated RWP tests already exercise the ioctl
directly and err if it's not supported, so SET_MODE coverage isn't lost.
> --
> Sashiko AI review · https://sashiko.dev/#/patchset/20260525113737.1942478-1-kas@kernel.org?part=13
--
Kiryl Shutsemau / Kirill A. Shutemov
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-05-25 15:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20260525113737.1942478-14-kas@kernel.org>
2026-05-25 12:39 ` [PATCH v4 13/14] selftests/mm: add userfaultfd RWP tests sashiko-bot
2026-05-25 15:43 ` Kiryl Shutsemau
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox