-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bpf: use proper target btf when exporting attach_btf_obj_id #3413
Conversation
Master branch: 14250fa |
Master branch: 7193084 |
bcf27f7
to
cf6d2f6
Compare
Master branch: 7193084 |
cf6d2f6
to
18d5ab4
Compare
Master branch: 7193084 |
18d5ab4
to
94f29ad
Compare
Master branch: 7193084 |
94f29ad
to
e6b8c9e
Compare
Master branch: 7193084 |
e6b8c9e
to
7b03588
Compare
Master branch: f86d1fb |
7b03588
to
1b749ce
Compare
Master branch: f86d1fb |
1b749ce
to
e22c4a8
Compare
Master branch: f86d1fb |
e22c4a8
to
ecda2bb
Compare
Master branch: d55dfe5 |
ecda2bb
to
a954f78
Compare
Master branch: d25f40f |
a954f78
to
7845287
Compare
Master branch: d25f40f |
7845287
to
98ccf80
Compare
When attaching to program, the program itself might not be attached to anything (and, hence, might not have attach_btf), so we can't unconditionally use 'prog->aux->dst_prog->aux->attach_btf'. Instead, use bpf_prog_get_target_btf to pick proper target btf: * when attached to dst_prog, use dst_prog->aux->btf * when attached to kernel btf, use prog->aux->attach_btf Fixes: b79c9fc ("bpf: implement BPF_PROG_QUERY for BPF_LSM_CGROUP") Acked-by: Hao Luo <haoluo@google.com> Acked-by: Martin KaFai Lau <kafai@fb.com> Signed-off-by: Stanislav Fomichev <sdf@google.com>
Master branch: e19db67 |
Apparently, no existing selftest covers it. Add a new one where we load cgroup/bind4 program and attach fentry to it. Calling bpf_obj_get_info_by_fd on the fentry program should return non-zero btf_id/btf_obj_id instead of crashing the kernel. v3: - move into fexit_bpf2bpf.c (Martin) - assert on skel->links.bind_v4_prog (Andrii) - do no close(-1) unconditionally (Andrii) v2: - use ret instead of err in find_prog_btf_id (Hao) - remove verifier log (Hao) - drop if conditional from ASSERT_OK(bpf_obj_get_info_by_fd(...)) (Hao) Acked-by: Martin KaFai Lau <kafai@fb.com> Signed-off-by: Stanislav Fomichev <sdf@google.com>
98ccf80
to
c3cb3e0
Compare
At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=665474 irrelevant now. Closing PR. |
Pull request for series with
subject: bpf: use proper target btf when exporting attach_btf_obj_id
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=664186