foniod / redbpf

Rust library for building and running BPF/eBPF modules
Apache License 2.0
1.71k stars 136 forks source link

Only set BTF key/value id if size is nonzero (fixes #327) #328

Closed GermanCoding closed 2 years ago

GermanCoding commented 2 years ago

This is more of a workaround rather than an actual fix, but my kernel (5.13.0-40-generic #45~20.04.1-Ubuntu SMP) doesn't seem to like it when we supply BTF ids while the actual size of the map keys/values is zero. This seems to be what causes the invalid argument OS error in #327, hence this will fix #327. Couldn't see any obvious negative effects.

rhdxmr commented 2 years ago

Looks good to me. Some tests failed but the failures are not caused by this PR. So I'm merging this.