[LTP] userfaultfd: Add tests for UFFDIO_RWPROTECT and UFFDIO_SET_MODE

linuxtestproject.agent@gmail.com linuxtestproject.agent@gmail.com
Sat Oct 24 19:55:56 CEST 2026


Hi Ricardo,

On Sat, 24 Oct 2026 18:21:45 +0200, Ricardo Branco wrote:
> userfaultfd: Add tests for UFFDIO_RWPROTECT and UFFDIO_SET_MODE

> diff --git a/include/lapi/userfaultfd.h b/include/lapi/userfaultfd.h
> -	uffd = SAFE_USERFAULTFD(O_CLOEXEC | O_NONBLOCK, false);
> +	uffd = SAFE_USERFAULTFD(O_CLOEXEC | O_NONBLOCK, true);

Medium: On Linux 5.2-5.10, without CAP_SYS_PTRACE and with
vm.unprivileged_userfaultfd=0, the retry adds the unsupported
UFFD_USER_MODE_ONLY flag and returns EINVAL, producing TBROK instead of
TCONF. This also regresses existing callers such as userfaultfd05 on
Linux 5.10. Handle EINVAL from the unsupported retry flag as TCONF while
retaining the fallback for kernels that support it.

Verdict - Needs revision

---
Note:

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