* [PATCH bpf-next] selftests/bpf: fix veristat's singular file-or-prog filter
@ 2022-11-11 18:12 Andrii Nakryiko
2022-11-11 19:35 ` sdf
2022-11-11 22:10 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Andrii Nakryiko @ 2022-11-11 18:12 UTC (permalink / raw)
To: bpf, ast, daniel; +Cc: andrii, kernel-team
Fix the bug of filtering out filename too early, before we know the
program name, if using unified file-or-prog filter (i.e., -f
<any-glob>). Because we try to filter BPF object file early without
opening and parsing it, if any_glob (file-or-prog) filter is used we
have to accept any filename just to get program name, which might match
any_glob.
Fixes: 10b1b3f3e56a ("selftests/bpf: consolidate and improve file/prog filtering in veristat")
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
---
tools/testing/selftests/bpf/veristat.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/bpf/veristat.c b/tools/testing/selftests/bpf/veristat.c
index 9e3811ab4866..f961b49b8ef4 100644
--- a/tools/testing/selftests/bpf/veristat.c
+++ b/tools/testing/selftests/bpf/veristat.c
@@ -367,7 +367,13 @@ static bool should_process_file_prog(const char *filename, const char *prog_name
if (f->any_glob) {
if (glob_matches(filename, f->any_glob))
return true;
- if (prog_name && glob_matches(prog_name, f->any_glob))
+ /* If we don't know program name yet, any_glob filter
+ * has to assume that current BPF object file might be
+ * relevant; we'll check again later on after opening
+ * BPF object file, at which point program name will
+ * be known finally.
+ */
+ if (!prog_name || glob_matches(prog_name, f->any_glob))
return true;
} else {
if (f->file_glob && !glob_matches(filename, f->file_glob))
--
2.30.2
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH bpf-next] selftests/bpf: fix veristat's singular file-or-prog filter
2022-11-11 18:12 [PATCH bpf-next] selftests/bpf: fix veristat's singular file-or-prog filter Andrii Nakryiko
@ 2022-11-11 19:35 ` sdf
2022-11-11 22:10 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: sdf @ 2022-11-11 19:35 UTC (permalink / raw)
To: Andrii Nakryiko; +Cc: bpf, ast, daniel, kernel-team
On 11/11, Andrii Nakryiko wrote:
> Fix the bug of filtering out filename too early, before we know the
> program name, if using unified file-or-prog filter (i.e., -f
> <any-glob>). Because we try to filter BPF object file early without
> opening and parsing it, if any_glob (file-or-prog) filter is used we
> have to accept any filename just to get program name, which might match
> any_glob.
> Fixes: 10b1b3f3e56a ("selftests/bpf: consolidate and improve file/prog
> filtering in veristat")
> Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Stanislav Fomichev <sdf@google.com>
> ---
> tools/testing/selftests/bpf/veristat.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
> diff --git a/tools/testing/selftests/bpf/veristat.c
> b/tools/testing/selftests/bpf/veristat.c
> index 9e3811ab4866..f961b49b8ef4 100644
> --- a/tools/testing/selftests/bpf/veristat.c
> +++ b/tools/testing/selftests/bpf/veristat.c
> @@ -367,7 +367,13 @@ static bool should_process_file_prog(const char
> *filename, const char *prog_name
> if (f->any_glob) {
> if (glob_matches(filename, f->any_glob))
> return true;
> - if (prog_name && glob_matches(prog_name, f->any_glob))
> + /* If we don't know program name yet, any_glob filter
> + * has to assume that current BPF object file might be
> + * relevant; we'll check again later on after opening
> + * BPF object file, at which point program name will
> + * be known finally.
> + */
> + if (!prog_name || glob_matches(prog_name, f->any_glob))
> return true;
> } else {
> if (f->file_glob && !glob_matches(filename, f->file_glob))
> --
> 2.30.2
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH bpf-next] selftests/bpf: fix veristat's singular file-or-prog filter
2022-11-11 18:12 [PATCH bpf-next] selftests/bpf: fix veristat's singular file-or-prog filter Andrii Nakryiko
2022-11-11 19:35 ` sdf
@ 2022-11-11 22:10 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-11-11 22:10 UTC (permalink / raw)
To: Andrii Nakryiko; +Cc: bpf, ast, daniel, kernel-team
Hello:
This patch was applied to bpf/bpf-next.git (master)
by Martin KaFai Lau <martin.lau@kernel.org>:
On Fri, 11 Nov 2022 10:12:42 -0800 you wrote:
> Fix the bug of filtering out filename too early, before we know the
> program name, if using unified file-or-prog filter (i.e., -f
> <any-glob>). Because we try to filter BPF object file early without
> opening and parsing it, if any_glob (file-or-prog) filter is used we
> have to accept any filename just to get program name, which might match
> any_glob.
>
> [...]
Here is the summary with links:
- [bpf-next] selftests/bpf: fix veristat's singular file-or-prog filter
https://git.kernel.org/bpf/bpf-next/c/eb6af4ceda2d
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] 3+ messages in thread
end of thread, other threads:[~2022-11-11 22:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-11 18:12 [PATCH bpf-next] selftests/bpf: fix veristat's singular file-or-prog filter Andrii Nakryiko
2022-11-11 19:35 ` sdf
2022-11-11 22:10 ` 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