[LTP] Make userfaultfd0{1, 3, 4} LTP tests valgrind compatible
linuxtestproject.agent@gmail.com
linuxtestproject.agent@gmail.com
Tue Apr 21 19:06:46 CEST 2026
Hi Martin,
On Tue, 21 Apr 2026, Martin Cermak wrote:
> Make userfaultfd0{1, 3, 4} LTP tests valgrind compatible
The commit message is missing a Signed-off-by: tag.
> -static void *handle_thread(void)
> +static void *pagefault_handler(void)
Since this is no longer a thread entry point, change the return type to
void and drop the return NULL.
> /*\
> * Force a pagefault event and handle it using :manpage:`userfaultfd(2)`
> * from a different thread.
> */
The handler now runs in a forked child, not a thread. Update the doc
comment in all three files.
[...]
> + pid = SAFE_FORK();
> + if (pid == 0) {
> + pagefault_handler();
userfaultfd03.c: extra leading tab on the `if` line.
[...]
> + SAFE_WAITPID(pid, NULL, 0);
> reset_pages();
In the original code the thread closed uffd for the whole process (threads
share the fd table). With fork, the child closes only its own copy; the
parent's uffd is never closed. Add SAFE_CLOSE(uffd) before reset_pages()
in all three tests.
Also, tst_safe_pthread.h is no longer used in userfaultfd03.c and
userfaultfd04.c after this change; remove the include.
---
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