Stanislav Fomichev 6644aabbd8 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: b79c9fc9551b ("bpf: implement BPF_PROG_QUERY for BPF_LSM_CGROUP")
Signed-off-by: Stanislav Fomichev <sdf@google.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Hao Luo <haoluo@google.com>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Link: https://lore.kernel.org/bpf/20220804201140.1340684-1-sdf@google.com
2022-08-08 15:53:17 +02:00
..
2022-08-03 09:45:08 -07:00
2022-05-26 17:13:43 -07:00
2022-08-03 16:29:08 -07:00
2022-05-25 16:18:27 -07:00
2021-12-02 17:25:21 +09:00
2022-07-28 12:36:35 +02:00
2022-06-02 08:55:01 -07:00
2022-08-02 19:34:45 -07:00
2022-08-02 13:46:35 -07:00
2022-08-03 09:45:08 -07:00
2022-08-03 16:29:08 -07:00
2022-08-03 16:29:08 -07:00
2022-01-11 13:08:21 -08:00
2022-06-15 19:28:44 -04:00
2021-09-08 15:32:35 -07:00
2022-05-23 17:51:12 -07:00
2022-03-15 10:32:44 +01:00
2022-07-12 15:27:19 -07:00
2021-09-08 15:32:34 -07:00
2022-05-29 10:31:36 -07:00
2022-08-02 19:34:45 -07:00
2021-10-14 13:29:18 +02:00
2022-01-08 12:43:57 -06:00
2022-02-25 09:36:06 +01:00