[LTP] [Valgrind-developers] [PATCH] Make userfaultfd0{1, 3, 4} LTP tests valgrind compatible

Petr Vorel pvorel@suse.cz
Wed Apr 22 14:17:42 CEST 2026



> On 4/22/26 7:37 AM, Petr Vorel wrote:
> > > However, some of the testcases can be easily changed to use forked
> > > processes instead of threads.  That's what this patch does.  When
> > > client program forks, Valgrind forks too, and that allows for the needed
> > > parallelism to handle the page fault.
> > You understand process vs. threads more than me. But shouldn't mmap() use
> > MAP_SHARED instead of MAP_PRIVATE for those which aren't using /dev/userfaultfd?

> The documentation for userfaultfd mentions threads.  I'm afraid we'll
> lose vital coverage if we move to forked processes.

+1, at least some tests would keep threads (not all userfaultfd tests would be
converted, but yes, that's why I suggested to use MAP_SHARED, which could be
similar to threads (yes, the difference between processes and threads in Linux
kernel is not that huge as both are created in clone(), it's mostly about what
is shared).

> Perhaps we should cover both?

What do you mean by "both"?

Run test with both processes and threads e.g. via .test_variants?
Because combine MAP_SHARED | MAP_PRIVATE is not possible (mutually exclusive).

> Also checkout UFFD_FEATURE_EVENT_FORK and the BUGS section for this in
> userfaultfd(2).
+1

> I have like 3 patches for userfaultfd that I'm afraid I'd have to rebase
> then.\ Best,

Yeah, that's life of an open source development.

Kind regards,
Petr

> Ricardo


More information about the ltp mailing list