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

Ricardo Branco
2026-02-20T15:43:31Z

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.

>> +
>> + 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.
>> +
>> +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