Skip to content
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

Closed
wants to merge 3 commits into from

Conversation

kernel-patches-bot
Copy link

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

@kernel-patches-bot
Copy link
Author

Master branch: 14250fa
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=664186
version: 1

@kernel-patches-bot
Copy link
Author

Master branch: 7193084
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=664186
version: 1

@kernel-patches-bot
Copy link
Author

Master branch: 7193084
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=664556
version: 2

@kernel-patches-bot
Copy link
Author

Master branch: 7193084
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=664556
version: 2

@kernel-patches-bot
Copy link
Author

Master branch: 7193084
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=665126
version: 2

@kernel-patches-bot
Copy link
Author

Master branch: 7193084
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=665126
version: 2

@kernel-patches-bot
Copy link
Author

Master branch: f86d1fb
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=665126
version: 2

@kernel-patches-bot
Copy link
Author

Master branch: f86d1fb
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=665126
version: 2

@kernel-patches-bot
Copy link
Author

Master branch: f86d1fb
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=665474
version: 3

@kernel-patches-bot
Copy link
Author

Master branch: d55dfe5
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=665474
version: 3

@kernel-patches-bot
Copy link
Author

Master branch: d25f40f
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=665474
version: 3

@kernel-patches-bot
Copy link
Author

Master branch: d25f40f
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=665474
version: 3

Kernel Patches Daemon and others added 2 commits August 8, 2022 06:48
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>
@kernel-patches-bot
Copy link
Author

Master branch: e19db67
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=665474
version: 3

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>
@kernel-patches-bot
Copy link
Author

At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=665474 irrelevant now. Closing PR.

@kernel-patches-bot kernel-patches-bot deleted the series/664186=>bpf-next branch August 8, 2022 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants