[LTP] [PATCH v3] syscall: Add userfaultfd testcase

Petr Vorel pvorel@suse.cz
Mon Mar 18 18:51:58 CET 2019


Hi Christian, Jan,

> ----- Original Message -----
> > This tests the userfaultfd syscall to handle pagefault events.
> > It does so by registering a userfaultfd object to the address of
> > a memory page. In a second thread it handles the event and writes
> > data in the monitored memory page to indicate success.

> > Signed-off-by: Christian Amann <camann@suse.com>

> Acked-by: Jan Stancek <jstancek@redhat.com>

> Couple small nits below (no need to repost).

> syscall -> syscalls in subject

> > +
> > +static int userfaultfd(int flags)

> If glibc ever provides func, my money would be on this :-).
> But looking at HEAD, we're safe now.
Yes, I'd be for changing the name, see 651895c9f ("getcpu01: Rename getcpu to
avoid conflict with glibc >= 2.29" :)

Reviewed-by: Petr Vorel <pvorel@suse.cz>
Nice work! Would it be possible to fix warnings?

userfaultfd01.c: In function ‘handle_thread’:
userfaultfd01.c:50:9: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  uffd = (int) arg;
         ^
userfaultfd01.c:80:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
In file included from userfaultfd01.c:19:
userfaultfd01.c: In function ‘run’:
userfaultfd01.c:108:19: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
    handle_thread, (void *) uffd);
                   ^
../../../../include/tst_safe_pthread.h:39:70: note: in definition of macro ‘SAFE_PTHREAD_CREATE’
  safe_pthread_create(__FILE__, __LINE__, thread_id, attr, thread_fn, arg)
                                                                      ^~~

Kind regards,
Petr


More information about the ltp mailing list