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

Martin Cermak mcermak@redhat.com
Wed Apr 22 15:08:37 CEST 2026


On  Wed  2026-04-22  14:17 , Petr Vorel wrote:
> 
> 
> > 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).

My goal is to make at least part of these userfaultfd tests
compatible with Valgrind.  I've experimented with clone() and it
seems like Valgrind has limited support for it.  That said,
adding another set of userfaultfd tests using fork() or clone()
instead of threads might help.  Some of such new tests will be
"incompatible" with valgrind, but it might be a test coverage
improvement.

m.



More information about the ltp mailing list