Re: [LTP] [PATCH v4] userfaultfd: Add test using UFFDIO_POISON

Andrea Cervesato via ltp
2026-02-20T15:47:56Z

On Fri Feb 20, 2026 at 4:43 PM CET, Ricardo Branco wrote:
>
>
> On 2/20/26 4:32 PM, Andrea Cervesato wrote:
> >> +
> >> + sa.sa_handler = sigbus_handler;
> >> + sigemptyset(&sa.sa_mask);
> >> + SAFE_SIGACTION(SIGBUS, &sa, NULL);
> >> +
> >> + set_pages();
> > This is done every cycle of -i > 1, but memory is never released and
> > done once in cleanup().
> I'm moving sigaction to setup but set_pages() is called in run() on the
> rest of the tests.

But all other tests also have a reset_pages() at the end of run()

>
> >> +
> >> + uffd = SAFE_USERFAULTFD(O_CLOEXEC | O_NONBLOCK, false);
> > Maybe this one should be closed inside run(), or even remove it from
> > static variables and passed to the thread, so we keep it inside run().
>
> But then we'd also have to fix the other tests.

No problem, feel free to leave it then, i didn't see the big picture.

> >> +
> >> +static struct tst_test test = {
> >> + .test_all = run,
> >> + .cleanup = cleanup,
> >> +};
> > You ar missing the runtest entry.
>
> There's no runtest function.  For now I'm using the other tests as template.
>
> Best,
> R
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com