BPF List
 help / color / mirror / Atom feed
* [PATCH] selftests/bpf: Fix flaky file_reader test
@ 2026-06-03 14:39 Mykyta Yatsenko
  2026-06-03 14:53 ` Mykyta Yatsenko
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Mykyta Yatsenko @ 2026-06-03 14:39 UTC (permalink / raw)
  To: bpf, ast, andrii, daniel, kernel-team, eddyz87, memxor
  Cc: Mykyta Yatsenko, Shung-Hsi Yu

From: Mykyta Yatsenko <yatsenko@meta.com>

file_reader/on_open_expect_fault test expects page fault
when reading pages from the test harness executable.
It is not guaranteed that those are paged out, even
after madvise(MADV_PAGEOUT).
Relax the condition in the test to succeed with both
0 and -EFAULT returned.

Fixes: 784cdf931543 ("selftests/bpf: add file dynptr tests")
Reported-by: Shung-Hsi Yu <shung-hsi.yu@suse.com>
Closes: https://lore.kernel.org/all/ah6g7JSYOWGp2oAG@u94a/
Signed-off-by: Mykyta Yatsenko <yatsenko@meta.com>
---
 tools/testing/selftests/bpf/progs/file_reader.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/bpf/progs/file_reader.c b/tools/testing/selftests/bpf/progs/file_reader.c
index 462712ff3b8a..aa2c05cce2b3 100644
--- a/tools/testing/selftests/bpf/progs/file_reader.c
+++ b/tools/testing/selftests/bpf/progs/file_reader.c
@@ -50,7 +50,7 @@ int on_open_expect_fault(void *c)
 		goto out;
 
 	local_err = bpf_dynptr_read(tmp_buf, user_buf_sz, &dynptr, user_buf_sz, 0);
-	if (local_err == -EFAULT) { /* Expect page fault */
+	if (local_err == -EFAULT || local_err == 0) { /* Expect page fault or success */
 		local_err = 0;
 		run_success = 1;
 	}

---
base-commit: 245da8192c073820390f7fa1cc1e834b32119bce
change-id: 20260603-file_reader_flake-bf0753be6b2e

Best regards,
--  
Mykyta Yatsenko <yatsenko@meta.com>


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

* Re: [PATCH] selftests/bpf: Fix flaky file_reader test
  2026-06-03 14:39 [PATCH] selftests/bpf: Fix flaky file_reader test Mykyta Yatsenko
@ 2026-06-03 14:53 ` Mykyta Yatsenko
  2026-06-05 19:35 ` Ihor Solodrai
  2026-06-05 21:20 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Mykyta Yatsenko @ 2026-06-03 14:53 UTC (permalink / raw)
  To: bpf, ast, andrii, daniel, kernel-team, eddyz87, memxor
  Cc: Mykyta Yatsenko, Shung-Hsi Yu

I forgot to add bpf-next tag to the subject, apologies.


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

* Re: [PATCH] selftests/bpf: Fix flaky file_reader test
  2026-06-03 14:39 [PATCH] selftests/bpf: Fix flaky file_reader test Mykyta Yatsenko
  2026-06-03 14:53 ` Mykyta Yatsenko
@ 2026-06-05 19:35 ` Ihor Solodrai
  2026-06-05 21:20 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Ihor Solodrai @ 2026-06-05 19:35 UTC (permalink / raw)
  To: Mykyta Yatsenko, bpf, ast, andrii, daniel, kernel-team, eddyz87,
	memxor
  Cc: Mykyta Yatsenko, Shung-Hsi Yu

On 6/3/26 7:39 AM, Mykyta Yatsenko wrote:
> From: Mykyta Yatsenko <yatsenko@meta.com>
> 
> file_reader/on_open_expect_fault test expects page fault
> when reading pages from the test harness executable.
> It is not guaranteed that those are paged out, even
> after madvise(MADV_PAGEOUT).
> Relax the condition in the test to succeed with both
> 0 and -EFAULT returned.
> 
> Fixes: 784cdf931543 ("selftests/bpf: add file dynptr tests")
> Reported-by: Shung-Hsi Yu <shung-hsi.yu@suse.com>
> Closes: https://lore.kernel.org/all/ah6g7JSYOWGp2oAG@u94a/
> Signed-off-by: Mykyta Yatsenko <yatsenko@meta.com>

Hi Mykyta,

I tried the patch on libbpf/libbpf CI, the test was consistently
failing there. It works [1], thanks!

Tested-by: Ihor Solodrai <ihor.solodrai@linux.dev>

[1] https://github.com/libbpf/libbpf/actions/runs/27032965962

> ---
>  tools/testing/selftests/bpf/progs/file_reader.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/bpf/progs/file_reader.c b/tools/testing/selftests/bpf/progs/file_reader.c
> index 462712ff3b8a..aa2c05cce2b3 100644
> --- a/tools/testing/selftests/bpf/progs/file_reader.c
> +++ b/tools/testing/selftests/bpf/progs/file_reader.c
> @@ -50,7 +50,7 @@ int on_open_expect_fault(void *c)
>  		goto out;
>  
>  	local_err = bpf_dynptr_read(tmp_buf, user_buf_sz, &dynptr, user_buf_sz, 0);
> -	if (local_err == -EFAULT) { /* Expect page fault */
> +	if (local_err == -EFAULT || local_err == 0) { /* Expect page fault or success */
>  		local_err = 0;
>  		run_success = 1;
>  	}
> 
> ---
> base-commit: 245da8192c073820390f7fa1cc1e834b32119bce
> change-id: 20260603-file_reader_flake-bf0753be6b2e
> 
> Best regards,
> --  
> Mykyta Yatsenko <yatsenko@meta.com>
> 


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

* Re: [PATCH] selftests/bpf: Fix flaky file_reader test
  2026-06-03 14:39 [PATCH] selftests/bpf: Fix flaky file_reader test Mykyta Yatsenko
  2026-06-03 14:53 ` Mykyta Yatsenko
  2026-06-05 19:35 ` Ihor Solodrai
@ 2026-06-05 21:20 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-06-05 21:20 UTC (permalink / raw)
  To: Mykyta Yatsenko
  Cc: bpf, ast, andrii, daniel, kernel-team, eddyz87, memxor, yatsenko,
	shung-hsi.yu

Hello:

This patch was applied to bpf/bpf-next.git (master)
by Alexei Starovoitov <ast@kernel.org>:

On Wed, 03 Jun 2026 07:39:15 -0700 you wrote:
> From: Mykyta Yatsenko <yatsenko@meta.com>
> 
> file_reader/on_open_expect_fault test expects page fault
> when reading pages from the test harness executable.
> It is not guaranteed that those are paged out, even
> after madvise(MADV_PAGEOUT).
> Relax the condition in the test to succeed with both
> 0 and -EFAULT returned.
> 
> [...]

Here is the summary with links:
  - selftests/bpf: Fix flaky file_reader test
    https://git.kernel.org/bpf/bpf-next/c/aa22d619ba22

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2026-06-05 21:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-03 14:39 [PATCH] selftests/bpf: Fix flaky file_reader test Mykyta Yatsenko
2026-06-03 14:53 ` Mykyta Yatsenko
2026-06-05 19:35 ` Ihor Solodrai
2026-06-05 21:20 ` patchwork-bot+netdevbpf

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