bpf_obj_get_info_by_fd
doesn't allow passing structs smaller than sizeof(struct bpf_*_info)
#4160
Milestone
bpf_obj_get_info_by_fd
doesn't allow passing structs smaller than sizeof(struct bpf_*_info)
#4160
Describe the bug
Calling bpf_obj_get_info_by_fd with an info_len that is smaller than the corresponding
struct bpf_map_info
, etc. will cause an error. This is a problem when running a program which was built / linked against an older version of the runtime against a new version where the size of that struct has increased.The reason for this are checks like the following:
ebpf-for-windows/libs/execution_context/ebpf_maps.c
Lines 2823 to 2831 in 95267a5
I think this is also a divergence from upstream libbpf behaviour.
OS information
No response
Steps taken to reproduce bug
You can "simulate" the behaviour like so:
Expected behavior
The call to
bpf_obj_get_info_by_fd
should succeed and fill in all information up to the smallerinfo_size
.Actual outcome
Return an error.
Additional details
This is the same behaviour as I implemented for the
bpf()
wrapper:ebpf-for-windows/libs/api/bpf_syscall.cpp
Lines 15 to 73 in 95267a5
The text was updated successfully, but these errors were encountered: