]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
bpf: Remove attach_type in bpf_tracing_link
authorTao Chen <chen.dylane@linux.dev>
Thu, 10 Jul 2025 03:20:37 +0000 (11:20 +0800)
committerAndrii Nakryiko <andrii@kernel.org>
Fri, 11 Jul 2025 18:01:08 +0000 (11:01 -0700)
Use attach_type in bpf_link, and remove it in bpf_tracing_link.

Signed-off-by: Tao Chen <chen.dylane@linux.dev>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Link: https://lore.kernel.org/bpf/20250710032038.888700-7-chen.dylane@linux.dev
include/linux/bpf.h
kernel/bpf/syscall.c

index a9ee9c14b486aef3d279242792abb84f6e8deca8..bc887831eaa52ab4d001f5c4a07787b5bdbc34ba 100644 (file)
@@ -1784,7 +1784,6 @@ struct bpf_shim_tramp_link {
 
 struct bpf_tracing_link {
        struct bpf_tramp_link link;
-       enum bpf_attach_type attach_type;
        struct bpf_trampoline *trampoline;
        struct bpf_prog *tgt_prog;
 };
index cd7321fe0ba3c5d64330b585d8eb6f4ea9d633e7..1a26d17536beffda60244ec3595fce876e30120e 100644 (file)
@@ -3414,7 +3414,7 @@ static void bpf_tracing_link_show_fdinfo(const struct bpf_link *link,
                   "target_obj_id:\t%u\n"
                   "target_btf_id:\t%u\n"
                   "cookie:\t%llu\n",
-                  tr_link->attach_type,
+                  link->attach_type,
                   target_obj_id,
                   target_btf_id,
                   tr_link->link.cookie);
@@ -3426,7 +3426,7 @@ static int bpf_tracing_link_fill_link_info(const struct bpf_link *link,
        struct bpf_tracing_link *tr_link =
                container_of(link, struct bpf_tracing_link, link.link);
 
-       info->tracing.attach_type = tr_link->attach_type;
+       info->tracing.attach_type = link->attach_type;
        info->tracing.cookie = tr_link->link.cookie;
        bpf_trampoline_unpack_key(tr_link->trampoline->key,
                                  &info->tracing.target_obj_id,
@@ -3516,7 +3516,6 @@ static int bpf_tracing_prog_attach(struct bpf_prog *prog,
        bpf_link_init(&link->link.link, BPF_LINK_TYPE_TRACING,
                      &bpf_tracing_link_lops, prog, attach_type);
 
-       link->attach_type = prog->expected_attach_type;
        link->link.cookie = bpf_cookie;
 
        mutex_lock(&prog->aux->dst_mutex);