Skip to content

Commit

Permalink
bcc: Fix vmlinux kfunc load
Browse files Browse the repository at this point in the history
The bpf_attr::attach_btf_obj_fd is set to -1
when loading prog for vmlinux kfunc/kretfunc,
which results in EINVAL. Set it to 0 instead.

Closes iovisor#4607.

Signed-off-by: Hengqi Chen <[email protected]>
  • Loading branch information
chenhengqi authored and yonghong-song committed May 13, 2023
1 parent 699799b commit 7d350d9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/cc/libbpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,7 @@ int bcc_prog_load_xattr(enum bpf_prog_type prog_type, const char *prog_name,
return ret;
}

opts->attach_btf_obj_fd = fd;
opts->attach_btf_obj_fd = fd == -1 ? 0 : fd;
opts->attach_btf_id = ret;
opts->expected_attach_type = expected_attach_type;
}
Expand Down

0 comments on commit 7d350d9

Please sign in to comment.