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

Commits on Aug 8, 2022

  1. adding ci files

    Kernel Patches Daemon committed Aug 8, 2022
    Configuration menu
    Copy the full SHA
    c94aee3 View commit details
    Browse the repository at this point in the history
  2. bpf: use proper target btf when exporting attach_btf_obj_id

    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>
    fomichev authored and Kernel Patches Daemon committed Aug 8, 2022
    Configuration menu
    Copy the full SHA
    28985a4 View commit details
    Browse the repository at this point in the history
  3. selftests/bpf: Excercise bpf_obj_get_info_by_fd for bpf2bpf

    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>
    fomichev authored and Kernel Patches Daemon committed Aug 8, 2022
    Configuration menu
    Copy the full SHA
    c3cb3e0 View commit details
    Browse the repository at this point in the history