Linux Test Project
 help / color / mirror / Atom feed
* [LTP] [PATCH] userfaultfd: Use two-step handshake to probe features
@ 2026-04-11  9:24 Ricardo Branco
  2026-04-11  9:46 ` [LTP] " acervesato
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Ricardo Branco @ 2026-04-11  9:24 UTC (permalink / raw)
  To: ltp

userfaultfd05 and userfaultfd06 assume that
UFFD_FEATURE_PAGEFAULT_FLAG_WP and UFFD_FEATURE_POISON are available
when setting up userfaultfd.

On kernels where either feature is unavailable at runtime,
UFFDIO_API fails with EINVAL and the tests end up as TBROK instead of
being skipped.

Fix this by using the required two-step handshake and skip with TCONF
if the required feature bit is absent.

Also remove userfaultfd05's needs_kconfigs check, since runtime
feature probing is sufficient here.

Link: https://github.com/linux-test-project/ltp/issues/1289

Signed-off-by: Ricardo Branco <rbranco@suse.de>
---
 testcases/kernel/syscalls/userfaultfd/userfaultfd05.c | 11 +++++++----
 testcases/kernel/syscalls/userfaultfd/userfaultfd06.c | 10 +++++++---
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/testcases/kernel/syscalls/userfaultfd/userfaultfd05.c b/testcases/kernel/syscalls/userfaultfd/userfaultfd05.c
index e25a227cf..5412f12e1 100644
--- a/testcases/kernel/syscalls/userfaultfd/userfaultfd05.c
+++ b/testcases/kernel/syscalls/userfaultfd/userfaultfd05.c
@@ -89,7 +89,14 @@ static void run(void)
 	set_pages();
 
 	uffd = SAFE_USERFAULTFD(O_CLOEXEC | O_NONBLOCK, false);
+	uffdio_api.api = UFFD_API;
+	uffdio_api.features = 0;
+	SAFE_IOCTL(uffd, UFFDIO_API, &uffdio_api);
+	if (!(uffdio_api.features & UFFD_FEATURE_PAGEFAULT_FLAG_WP))
+		tst_brk(TCONF, "UFFD_FEATURE_PAGEFAULT_FLAG_WP not supported");
+	SAFE_CLOSE(uffd);
 
+	uffd = SAFE_USERFAULTFD(O_CLOEXEC | O_NONBLOCK, false);
 	uffdio_api.api = UFFD_API;
 	uffdio_api.features = UFFD_FEATURE_PAGEFAULT_FLAG_WP;
 
@@ -124,8 +131,4 @@ static void run(void)
 static struct tst_test test = {
 	.test_all = run,
 	.min_kver = "5.7",
-	.needs_kconfigs = (const char *[]) {
-		"CONFIG_HAVE_ARCH_USERFAULTFD_WP=y",
-		NULL
-	}
 };
diff --git a/testcases/kernel/syscalls/userfaultfd/userfaultfd06.c b/testcases/kernel/syscalls/userfaultfd/userfaultfd06.c
index 5b1252c35..7ad682f5a 100644
--- a/testcases/kernel/syscalls/userfaultfd/userfaultfd06.c
+++ b/testcases/kernel/syscalls/userfaultfd/userfaultfd06.c
@@ -100,15 +100,19 @@ static void run(void)
 	set_pages();
 
 	uffd = SAFE_USERFAULTFD(O_CLOEXEC | O_NONBLOCK, false);
+	uffdio_api.api = UFFD_API;
+	uffdio_api.features = 0;
+	SAFE_IOCTL(uffd, UFFDIO_API, &uffdio_api);
+	if (!(uffdio_api.features & UFFD_FEATURE_POISON))
+		tst_brk(TCONF, "UFFD_FEATURE_POISON not supported");
+	SAFE_CLOSE(uffd);
 
+	uffd = SAFE_USERFAULTFD(O_CLOEXEC | O_NONBLOCK, false);
 	uffdio_api.api = UFFD_API;
 	uffdio_api.features = UFFD_FEATURE_POISON;
 
 	SAFE_IOCTL(uffd, UFFDIO_API, &uffdio_api);
 
-	if (!(uffdio_api.features & UFFD_FEATURE_POISON))
-		tst_brk(TCONF, "UFFD_FEATURE_POISON not supported");
-
 	uffdio_register.range.start = (unsigned long) page;
 	uffdio_register.range.len = page_size;
 	uffdio_register.mode = UFFDIO_REGISTER_MODE_MISSING;
-- 
2.53.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [LTP] userfaultfd: Use two-step handshake to probe features
  2026-04-11  9:24 [LTP] [PATCH] userfaultfd: Use two-step handshake to probe features Ricardo Branco
@ 2026-04-11  9:46 ` acervesato
  2026-04-11 10:39 ` acervesato
  2026-04-15  8:06 ` [LTP] [PATCH v2] " Ricardo Branco
  2 siblings, 0 replies; 11+ messages in thread
From: acervesato @ 2026-04-11  9:46 UTC (permalink / raw)
  To: Ricardo Branco; +Cc: ltp

Hi Ricardo,

our agent completed the review of the patch.

The agent can sometimes produce false positives although often its
findings are genuine. If you find issues with the review, please
comment this email or ignore the suggestions.

On Sat, 11 Apr 2026 11:24:51 +0200, Ricardo Branco wrote:
> userfaultfd: Use two-step handshake to probe features

> +       if (!(uffdio_api.features & UFFD_FEATURE_PAGEFAULT_FLAG_WP))
> +               tst_brk(TCONF, "UFFD_FEATURE_PAGEFAULT_FLAG_WP not supported");
> +       SAFE_CLOSE(uffd);

tst_brk() longjmps out of run(), so SAFE_CLOSE never executes — close uffd
before calling tst_brk(). userfaultfd05.c also has no .cleanup, so the page
mmap from set_pages() leaks too; add .cleanup = reset_pages to struct tst_test.

[...]

> +       if (!(uffdio_api.features & UFFD_FEATURE_POISON))
> +               tst_brk(TCONF, "UFFD_FEATURE_POISON not supported");
> +       SAFE_CLOSE(uffd);

Same issue: close uffd before calling tst_brk().

Regards,
LTP AI Reviewer

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [LTP] userfaultfd: Use two-step handshake to probe features
  2026-04-11  9:24 [LTP] [PATCH] userfaultfd: Use two-step handshake to probe features Ricardo Branco
  2026-04-11  9:46 ` [LTP] " acervesato
@ 2026-04-11 10:39 ` acervesato
  2026-04-15  8:06 ` [LTP] [PATCH v2] " Ricardo Branco
  2 siblings, 0 replies; 11+ messages in thread
From: acervesato @ 2026-04-11 10:39 UTC (permalink / raw)
  To: Ricardo Branco; +Cc: ltp

Hi Ricardo,

our agent completed the review of the patch.

On Sat, 11 Apr 2026 11:24:51 +0200, Ricardo Branco wrote:
> userfaultfd: Use two-step handshake to probe features

> Fix this by using the required two-step handshake and skip with TCONF
> if the required feature bit is absent.

The patch is fixing a bug (UFFDIO_API EINVAL causing TBROK instead of
TCONF); please add a Fixes: tag pointing to the commit that introduced
the incorrect single-step setup.

> Link: https://github.com/linux-test-project/ltp/issues/1289

[...]

Regards,
LTP AI Reviewer

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [LTP] [PATCH v2] userfaultfd: Use two-step handshake to probe features
  2026-04-11  9:24 [LTP] [PATCH] userfaultfd: Use two-step handshake to probe features Ricardo Branco
  2026-04-11  9:46 ` [LTP] " acervesato
  2026-04-11 10:39 ` acervesato
@ 2026-04-15  8:06 ` Ricardo Branco
  2026-04-15  9:24   ` [LTP] " linuxtestproject.agent
  2026-05-04 15:50   ` [LTP] [PATCH v2] " Cyril Hrubis
  2 siblings, 2 replies; 11+ messages in thread
From: Ricardo Branco @ 2026-04-15  8:06 UTC (permalink / raw)
  To: ltp

userfaultfd05 and userfaultfd06 assume that
UFFD_FEATURE_PAGEFAULT_FLAG_WP and UFFD_FEATURE_POISON are available
when setting up userfaultfd.

On kernels where either feature is unavailable at runtime,
UFFDIO_API fails with EINVAL and the tests end up as TBROK instead of
being skipped.

Fix this by using the required two-step handshake and skip with TCONF
if the required feature bit is absent.

Fixes: 1840ee23d172b5ab04cca7c2acfa48755b041911
Link: https://github.com/linux-test-project/ltp/issues/1289

Signed-off-by: Ricardo Branco <rbranco@suse.de>
---
 .../kernel/syscalls/userfaultfd/userfaultfd05.c   | 12 +++++++++++-
 .../kernel/syscalls/userfaultfd/userfaultfd06.c   | 15 +++++++++++----
 2 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/testcases/kernel/syscalls/userfaultfd/userfaultfd05.c b/testcases/kernel/syscalls/userfaultfd/userfaultfd05.c
index e25a227cf..e6386ce76 100644
--- a/testcases/kernel/syscalls/userfaultfd/userfaultfd05.c
+++ b/testcases/kernel/syscalls/userfaultfd/userfaultfd05.c
@@ -82,10 +82,20 @@ static void *handle_thread(void)
 static void run(void)
 {
 	pthread_t thr;
-	struct uffdio_api uffdio_api;
+	struct uffdio_api uffdio_api = {};
 	struct uffdio_register uffdio_register;
 	struct uffdio_writeprotect uffdio_writeprotect;
 
+	/*
+	 * Two-step handshake to check if feature is available
+	 */
+	uffd = SAFE_USERFAULTFD(O_CLOEXEC | O_NONBLOCK, false);
+	uffdio_api.api = UFFD_API;
+	SAFE_IOCTL(uffd, UFFDIO_API, &uffdio_api);
+	if (!(uffdio_api.features & UFFD_FEATURE_PAGEFAULT_FLAG_WP))
+		tst_brk(TCONF, "UFFD_FEATURE_PAGEFAULT_FLAG_WP not supported");
+	SAFE_CLOSE(uffd);
+
 	set_pages();
 
 	uffd = SAFE_USERFAULTFD(O_CLOEXEC | O_NONBLOCK, false);
diff --git a/testcases/kernel/syscalls/userfaultfd/userfaultfd06.c b/testcases/kernel/syscalls/userfaultfd/userfaultfd06.c
index 5b1252c35..e1b3c2f6f 100644
--- a/testcases/kernel/syscalls/userfaultfd/userfaultfd06.c
+++ b/testcases/kernel/syscalls/userfaultfd/userfaultfd06.c
@@ -97,18 +97,25 @@ static void run(void)
 
 	poison_fault_seen = 0;
 	sigbus_seen = 0;
-	set_pages();
 
+	/*
+	 * Two-step handshake to check if feature is available
+	 */
 	uffd = SAFE_USERFAULTFD(O_CLOEXEC | O_NONBLOCK, false);
+	uffdio_api.api = UFFD_API;
+	SAFE_IOCTL(uffd, UFFDIO_API, &uffdio_api);
+	if (!(uffdio_api.features & UFFD_FEATURE_POISON))
+		tst_brk(TCONF, "UFFD_FEATURE_POISON not supported");
+	SAFE_CLOSE(uffd);
 
+	set_pages();
+
+	uffd = SAFE_USERFAULTFD(O_CLOEXEC | O_NONBLOCK, false);
 	uffdio_api.api = UFFD_API;
 	uffdio_api.features = UFFD_FEATURE_POISON;
 
 	SAFE_IOCTL(uffd, UFFDIO_API, &uffdio_api);
 
-	if (!(uffdio_api.features & UFFD_FEATURE_POISON))
-		tst_brk(TCONF, "UFFD_FEATURE_POISON not supported");
-
 	uffdio_register.range.start = (unsigned long) page;
 	uffdio_register.range.len = page_size;
 	uffdio_register.mode = UFFDIO_REGISTER_MODE_MISSING;
-- 
2.53.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [LTP] userfaultfd: Use two-step handshake to probe features
  2026-04-15  8:06 ` [LTP] [PATCH v2] " Ricardo Branco
@ 2026-04-15  9:24   ` linuxtestproject.agent
  2026-05-04 15:50   ` [LTP] [PATCH v2] " Cyril Hrubis
  1 sibling, 0 replies; 11+ messages in thread
From: linuxtestproject.agent @ 2026-04-15  9:24 UTC (permalink / raw)
  To: Ricardo Branco; +Cc: ltp, LTP AI Reviewer

Hi Ricardo,

On Wed, 15 Apr 2026 10:06:15 +0200, Ricardo Branco wrote:
> userfaultfd: Use two-step handshake to probe features

Reviewed-by: LTP AI Reviewer <ltp-ai@noreply.github.com>

---
Note:

Our agent completed the review of the patch. The full review can be
found at: https://patchwork.ozlabs.org/project/ltp/list/?series=499941

The agent can sometimes produce false positives although often its
findings are genuine. If you find issues with the review, please
comment this email or ignore the suggestions.

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [LTP] [PATCH v2] userfaultfd: Use two-step handshake to probe features
  2026-04-15  8:06 ` [LTP] [PATCH v2] " Ricardo Branco
  2026-04-15  9:24   ` [LTP] " linuxtestproject.agent
@ 2026-05-04 15:50   ` Cyril Hrubis
  2026-05-04 15:59     ` Ricardo Branco
  1 sibling, 1 reply; 11+ messages in thread
From: Cyril Hrubis @ 2026-05-04 15:50 UTC (permalink / raw)
  To: Ricardo Branco; +Cc: ltp

Hi!
> +	/*
> +	 * Two-step handshake to check if feature is available
> +	 */

Please no obvious comments like this.

> +	uffd = SAFE_USERFAULTFD(O_CLOEXEC | O_NONBLOCK, false);
> +	uffdio_api.api = UFFD_API;
> +	SAFE_IOCTL(uffd, UFFDIO_API, &uffdio_api);
> +	if (!(uffdio_api.features & UFFD_FEATURE_PAGEFAULT_FLAG_WP))
> +		tst_brk(TCONF, "UFFD_FEATURE_PAGEFAULT_FLAG_WP not supported");
> +	SAFE_CLOSE(uffd);

I do not get why are we adding this code when we do the same just a few
lines below. Shouldn't just this suffice?

diff --git a/testcases/kernel/syscalls/userfaultfd/userfaultfd05.c b/testcases/kernel/syscalls/userfaultfd/userfaultfd05.c
index e25a227cf..b19132d0c 100644
--- a/testcases/kernel/syscalls/userfaultfd/userfaultfd05.c
+++ b/testcases/kernel/syscalls/userfaultfd/userfaultfd05.c
@@ -95,6 +95,9 @@ static void run(void)
 
        SAFE_IOCTL(uffd, UFFDIO_API, &uffdio_api);
 
+       if (!(uffdio_api.features & UFFD_FEATURE_PAGEFAULT_FLAG_WP))
+               tst_brk(TCONF, "UFFD_FEATURE_PAGEFAULT_FLAG_WP not supported");
+
        uffdio_register.range.start = (unsigned long) page;
        uffdio_register.range.len = page_size;
        uffdio_register.mode = UFFDIO_REGISTER_MODE_WP;


> index 5b1252c35..e1b3c2f6f 100644
> --- a/testcases/kernel/syscalls/userfaultfd/userfaultfd06.c
> +++ b/testcases/kernel/syscalls/userfaultfd/userfaultfd06.c
> @@ -97,18 +97,25 @@ static void run(void)
>  
>  	poison_fault_seen = 0;
>  	sigbus_seen = 0;
> -	set_pages();
>  
> +	/*
> +	 * Two-step handshake to check if feature is available
> +	 */
>  	uffd = SAFE_USERFAULTFD(O_CLOEXEC | O_NONBLOCK, false);
> +	uffdio_api.api = UFFD_API;
> +	SAFE_IOCTL(uffd, UFFDIO_API, &uffdio_api);
> +	if (!(uffdio_api.features & UFFD_FEATURE_POISON))
> +		tst_brk(TCONF, "UFFD_FEATURE_POISON not supported");
> +	SAFE_CLOSE(uffd);
>  
> +	set_pages();
> +
> +	uffd = SAFE_USERFAULTFD(O_CLOEXEC | O_NONBLOCK, false);
>  	uffdio_api.api = UFFD_API;
>  	uffdio_api.features = UFFD_FEATURE_POISON;
>
>  	SAFE_IOCTL(uffd, UFFDIO_API, &uffdio_api);
>  
> -	if (!(uffdio_api.features & UFFD_FEATURE_POISON))
> -		tst_brk(TCONF, "UFFD_FEATURE_POISON not supported");
> -

This does not seem to make any sense. The code already checks for the
feature, or do I miss something?

>  	uffdio_register.range.start = (unsigned long) page;
>  	uffdio_register.range.len = page_size;
>  	uffdio_register.mode = UFFDIO_REGISTER_MODE_MISSING;
> -- 
> 2.53.0
> 
> 
> -- 
> Mailing list info: https://lists.linux.it/listinfo/ltp

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [LTP] [PATCH v2] userfaultfd: Use two-step handshake to probe features
  2026-05-04 15:50   ` [LTP] [PATCH v2] " Cyril Hrubis
@ 2026-05-04 15:59     ` Ricardo Branco
  2026-05-04 17:48       ` Cyril Hrubis
  0 siblings, 1 reply; 11+ messages in thread
From: Ricardo Branco @ 2026-05-04 15:59 UTC (permalink / raw)
  To: Cyril Hrubis; +Cc: ltp



On 5/4/26 5:50 PM, Cyril Hrubis wrote:
>> +	uffd = SAFE_USERFAULTFD(O_CLOEXEC | O_NONBLOCK, false);
>> +	uffdio_api.api = UFFD_API;
>> +	SAFE_IOCTL(uffd, UFFDIO_API, &uffdio_api);
>> +	if (!(uffdio_api.features & UFFD_FEATURE_PAGEFAULT_FLAG_WP))
>> +		tst_brk(TCONF, "UFFD_FEATURE_PAGEFAULT_FLAG_WP not supported");
>> +	SAFE_CLOSE(uffd);
> I do not get why are we adding this code when we do the same just a few
> lines below. Shouldn't just this suffice?

That's why the comment is needed because it isn't obvious.

We need to do the 2 step handshake, first with uffdio_api.features set 
to zero,
then again with the desired features.

>> index 5b1252c35..e1b3c2f6f 100644
>> --- a/testcases/kernel/syscalls/userfaultfd/userfaultfd06.c
>> +++ b/testcases/kernel/syscalls/userfaultfd/userfaultfd06.c
>> @@ -97,18 +97,25 @@ static void run(void)
>>   
>>   	poison_fault_seen = 0;
>>   	sigbus_seen = 0;
>> -	set_pages();
>>   
>> +	/*
>> +	 * Two-step handshake to check if feature is available
>> +	 */
>>   	uffd = SAFE_USERFAULTFD(O_CLOEXEC | O_NONBLOCK, false);
>> +	uffdio_api.api = UFFD_API;
>> +	SAFE_IOCTL(uffd, UFFDIO_API, &uffdio_api);
>> +	if (!(uffdio_api.features & UFFD_FEATURE_POISON))
>> +		tst_brk(TCONF, "UFFD_FEATURE_POISON not supported");
>> +	SAFE_CLOSE(uffd);
>>   
>> +	set_pages();
>> +
>> +	uffd = SAFE_USERFAULTFD(O_CLOEXEC | O_NONBLOCK, false);
>>   	uffdio_api.api = UFFD_API;
>>   	uffdio_api.features = UFFD_FEATURE_POISON;
>>
>>   	SAFE_IOCTL(uffd, UFFDIO_API, &uffdio_api);
>>   
>> -	if (!(uffdio_api.features & UFFD_FEATURE_POISON))
>> -		tst_brk(TCONF, "UFFD_FEATURE_POISON not supported");
>> -
> This does not seem to make any sense. The code already checks for the
> feature, or do I miss something?

Context: https://github.com/linux-test-project/ltp/issues/1289

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [LTP] [PATCH v2] userfaultfd: Use two-step handshake to probe features
  2026-05-04 15:59     ` Ricardo Branco
@ 2026-05-04 17:48       ` Cyril Hrubis
  2026-05-05 11:27         ` Ricardo Branco
  0 siblings, 1 reply; 11+ messages in thread
From: Cyril Hrubis @ 2026-05-04 17:48 UTC (permalink / raw)
  To: Ricardo Branco; +Cc: ltp

Hi!
> >> +	uffd = SAFE_USERFAULTFD(O_CLOEXEC | O_NONBLOCK, false);
> >> +	uffdio_api.api = UFFD_API;
> >> +	SAFE_IOCTL(uffd, UFFDIO_API, &uffdio_api);
> >> +	if (!(uffdio_api.features & UFFD_FEATURE_PAGEFAULT_FLAG_WP))
> >> +		tst_brk(TCONF, "UFFD_FEATURE_PAGEFAULT_FLAG_WP not supported");
> >> +	SAFE_CLOSE(uffd);
> > I do not get why are we adding this code when we do the same just a few
> > lines below. Shouldn't just this suffice?
> 
> That's why the comment is needed because it isn't obvious.
> 
> We need to do the 2 step handshake, first with uffdio_api.features set 
> to zero, then again with the desired features.

The obviously the comment is not useful because it does not explain
anything :-).

Looking at the kernel code, it seems to set the output flags
uncoditionally so we can use that.

Or check for EINVAL when we pass unsupported flags.

However I would put this code into a common header and call it only in
the test setup (so that it's not executed on each test iteration).

#define CHECK_UFFD_FLAG(flag) do { \
        ... \
	if (!(uffdio_api.features & (flag))) \
		tst_brk(TCONF, #flag " not supported"); \
	... \
} while (0)


-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [LTP] [PATCH v2] userfaultfd: Use two-step handshake to probe features
  2026-05-04 17:48       ` Cyril Hrubis
@ 2026-05-05 11:27         ` Ricardo Branco
  2026-05-05 12:07           ` Cyril Hrubis
  0 siblings, 1 reply; 11+ messages in thread
From: Ricardo Branco @ 2026-05-05 11:27 UTC (permalink / raw)
  To: Cyril Hrubis; +Cc: ltp



On 5/4/26 7:48 PM, Cyril Hrubis wrote:
> Hi!
>>>> +	uffd = SAFE_USERFAULTFD(O_CLOEXEC | O_NONBLOCK, false);
>>>> +	uffdio_api.api = UFFD_API;
>>>> +	SAFE_IOCTL(uffd, UFFDIO_API, &uffdio_api);
>>>> +	if (!(uffdio_api.features & UFFD_FEATURE_PAGEFAULT_FLAG_WP))
>>>> +		tst_brk(TCONF, "UFFD_FEATURE_PAGEFAULT_FLAG_WP not supported");
>>>> +	SAFE_CLOSE(uffd);
>>> I do not get why are we adding this code when we do the same just a few
>>> lines below. Shouldn't just this suffice?
>> That's why the comment is needed because it isn't obvious.
>>
>> We need to do the 2 step handshake, first with uffdio_api.features set
>> to zero, then again with the desired features.
> The obviously the comment is not useful because it does not explain
> anything :-).
>
> Looking at the kernel code, it seems to set the output flags
> uncoditionally so we can use that.
>
> Or check for EINVAL when we pass unsupported flags.
>
> However I would put this code into a common header and call it only in
> the test setup (so that it's not executed on each test iteration).
>
> #define CHECK_UFFD_FLAG(flag) do { \
>          ... \
> 	if (!(uffdio_api.features & (flag))) \
> 		tst_brk(TCONF, #flag " not supported"); \
> 	... \
> } while (0)
>

Will add this macro.  Let's keep doing the 2 step handshake though.



-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [LTP] [PATCH v2] userfaultfd: Use two-step handshake to probe features
  2026-05-05 11:27         ` Ricardo Branco
@ 2026-05-05 12:07           ` Cyril Hrubis
  2026-05-07  8:32             ` Ricardo Branco
  0 siblings, 1 reply; 11+ messages in thread
From: Cyril Hrubis @ 2026-05-05 12:07 UTC (permalink / raw)
  To: Ricardo Branco; +Cc: ltp

Hi!
> > However I would put this code into a common header and call it only in
> > the test setup (so that it's not executed on each test iteration).
> >
> > #define CHECK_UFFD_FLAG(flag) do { \
> >          ... \
> > 	if (!(uffdio_api.features & (flag))) \
> > 		tst_brk(TCONF, #flag " not supported"); \
> > 	... \
> > } while (0)
> >
> 
> Will add this macro.  Let's keep doing the 2 step handshake though.

Sure, sounds good to me.

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [LTP] [PATCH v2] userfaultfd: Use two-step handshake to probe features
  2026-05-05 12:07           ` Cyril Hrubis
@ 2026-05-07  8:32             ` Ricardo Branco
  0 siblings, 0 replies; 11+ messages in thread
From: Ricardo Branco @ 2026-05-07  8:32 UTC (permalink / raw)
  To: Cyril Hrubis; +Cc: ltp



On 5/5/26 2:07 PM, Cyril Hrubis wrote:
> Hi!
>>> However I would put this code into a common header and call it only in
>>> the test setup (so that it's not executed on each test iteration).
>>>
>>> #define CHECK_UFFD_FLAG(flag) do { \
>>>           ... \
>>> 	if (!(uffdio_api.features & (flag))) \
>>> 		tst_brk(TCONF, #flag " not supported"); \
>>> 	... \
>>> } while (0)
>>>
>> Will add this macro.  Let's keep doing the 2 step handshake though.
> Sure, sounds good to me.
>
Just did it in a 2-part v3.

Cheers,
R

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2026-05-07  8:32 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-11  9:24 [LTP] [PATCH] userfaultfd: Use two-step handshake to probe features Ricardo Branco
2026-04-11  9:46 ` [LTP] " acervesato
2026-04-11 10:39 ` acervesato
2026-04-15  8:06 ` [LTP] [PATCH v2] " Ricardo Branco
2026-04-15  9:24   ` [LTP] " linuxtestproject.agent
2026-05-04 15:50   ` [LTP] [PATCH v2] " Cyril Hrubis
2026-05-04 15:59     ` Ricardo Branco
2026-05-04 17:48       ` Cyril Hrubis
2026-05-05 11:27         ` Ricardo Branco
2026-05-05 12:07           ` Cyril Hrubis
2026-05-07  8:32             ` Ricardo Branco

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox