Skip to content

Commit 820fac6

Browse files
ThinkerYzu1qmonnet
authored andcommitted
bpftool: Change pid_iter.bpf.c to comply with the change of bpf_link_fops.
To support epoll, a new instance of file_operations, bpf_link_fops_poll, has been added for links that support epoll. The pid_iter.bpf.c checks f_ops for links and other BPF objects. The check should fail for struct_ops links without this patch. Acked-by: Quentin Monnet <[email protected]> Signed-off-by: Kui-Feng Lee <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin KaFai Lau <[email protected]>
1 parent 3432403 commit 820fac6

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/skeleton/pid_iter.bpf.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ enum bpf_link_type___local {
2929
};
3030

3131
extern const void bpf_link_fops __ksym;
32+
extern const void bpf_link_fops_poll __ksym __weak;
3233
extern const void bpf_map_fops __ksym;
3334
extern const void bpf_prog_fops __ksym;
3435
extern const void btf_fops __ksym;
@@ -84,7 +85,11 @@ int iter(struct bpf_iter__task_file *ctx)
8485
fops = &btf_fops;
8586
break;
8687
case BPF_OBJ_LINK:
87-
fops = &bpf_link_fops;
88+
if (&bpf_link_fops_poll &&
89+
file->f_op == &bpf_link_fops_poll)
90+
fops = &bpf_link_fops_poll;
91+
else
92+
fops = &bpf_link_fops;
8893
break;
8994
default:
9095
return 0;

0 commit comments

Comments
 (0)