* [PATCH bpf-next] libbpf: fix return value for PERF_EVENT __arg_ctx type fix up check
@ 2024-02-06 0:22 Andrii Nakryiko
2024-02-06 4:20 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Andrii Nakryiko @ 2024-02-06 0:22 UTC (permalink / raw)
To: bpf, ast, daniel, martin.lau; +Cc: andrii, kernel-team
If PERF_EVENT program has __arg_ctx argument with matching
architecture-specific pt_regs/user_pt_regs/user_regs_struct pointer
type, libbpf should still perform type rewrite for old kernels, but not
emit the warning. Fix copy/paste from kernel code where 0 is meant to
signify "no error" condition. For libbpf we need to return "true" to
proceed with type rewrite (which for PERF_EVENT program will be
a canonical `struct bpf_perf_event_data *` type).
Fixes: 9eea8fafe33e ("libbpf: fix __arg_ctx type enforcement for perf_event programs")
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
---
tools/lib/bpf/libbpf.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index 6932f2c4ddfd..01f407591a92 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -6404,13 +6404,13 @@ static bool need_func_arg_type_fixup(const struct btf *btf, const struct bpf_pro
case BPF_PROG_TYPE_PERF_EVENT:
if (__builtin_types_compatible_p(bpf_user_pt_regs_t, struct pt_regs) &&
btf_is_struct(t) && strcmp(tname, "pt_regs") == 0)
- return 0;
+ return true;
if (__builtin_types_compatible_p(bpf_user_pt_regs_t, struct user_pt_regs) &&
btf_is_struct(t) && strcmp(tname, "user_pt_regs") == 0)
- return 0;
+ return true;
if (__builtin_types_compatible_p(bpf_user_pt_regs_t, struct user_regs_struct) &&
btf_is_struct(t) && strcmp(tname, "user_regs_struct") == 0)
- return 0;
+ return true;
break;
case BPF_PROG_TYPE_RAW_TRACEPOINT:
case BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE:
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH bpf-next] libbpf: fix return value for PERF_EVENT __arg_ctx type fix up check
2024-02-06 0:22 [PATCH bpf-next] libbpf: fix return value for PERF_EVENT __arg_ctx type fix up check Andrii Nakryiko
@ 2024-02-06 4:20 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-02-06 4:20 UTC (permalink / raw)
To: Andrii Nakryiko; +Cc: bpf, ast, daniel, martin.lau, kernel-team
Hello:
This patch was applied to bpf/bpf-next.git (master)
by Alexei Starovoitov <ast@kernel.org>:
On Mon, 5 Feb 2024 16:22:43 -0800 you wrote:
> If PERF_EVENT program has __arg_ctx argument with matching
> architecture-specific pt_regs/user_pt_regs/user_regs_struct pointer
> type, libbpf should still perform type rewrite for old kernels, but not
> emit the warning. Fix copy/paste from kernel code where 0 is meant to
> signify "no error" condition. For libbpf we need to return "true" to
> proceed with type rewrite (which for PERF_EVENT program will be
> a canonical `struct bpf_perf_event_data *` type).
>
> [...]
Here is the summary with links:
- [bpf-next] libbpf: fix return value for PERF_EVENT __arg_ctx type fix up check
https://git.kernel.org/bpf/bpf-next/c/d7bc416aa5cc
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] 2+ messages in thread
end of thread, other threads:[~2024-02-06 4:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-06 0:22 [PATCH bpf-next] libbpf: fix return value for PERF_EVENT __arg_ctx type fix up check Andrii Nakryiko
2024-02-06 4: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