[LTP] userfaultfd: Add helper for checking UFFD feature support

linuxtestproject.agent@gmail.com linuxtestproject.agent@gmail.com
Thu May 7 16:22:02 CEST 2026


Hi Ricardo,

--- [PATCH 1/3] ---

On Thu, 7 May 2026 14:28:53 +0200, Ricardo Branco wrote:
> [PATCH 1/3] userfaultfd: Add helper for checking UFFD feature support

> +	uffd = SAFE_USERFAULTFD(O_CLOEXEC | O_NONBLOCK, false);
> +
> +	uffdio_api.api = UFFD_API;
> +	SAFE_IOCTL(uffd, UFFDIO_API, &uffdio_api);

If SAFE_IOCTL calls tst_brk(TBROK) here, the local `uffd` is not
closed before the test runner takes over; the cleanup functions only
track the global `uffd`. Close it before the SAFE_IOCTL call, or
restructure to guarantee SAFE_CLOSE on all exit paths.

--- [PATCH 2/3] ---

On Thu, 7 May 2026 14:28:54 +0200, Ricardo Branco wrote:
> [PATCH 2/3] userfaultfd: Use two-step handshake to probe features

> Fixes: 1840ee23d172b5ab04cca7c2acfa48755b041911

This commit is not reachable in the local git history (grafted shallow
clone). Please verify the Fixes: tag resolves correctly against the
upstream LTP tree.

Pre-existing issues noticed in the surrounding code (not introduced
by this patch):

- testcases/kernel/syscalls/userfaultfd/userfaultfd06.c:142 — no
  .min_kver set; UFFD_FEATURE_POISON requires Linux 6.6.

---
Note:

Our agent completed the review of the patch.

The agent can sometimes produce false positives although often its
findings are genuine. If you find issues with the review, please
comment this email or ignore the suggestions.

Regards,
LTP AI Reviewer


More information about the ltp mailing list