iovisor / bcc

BCC - Tools for BPF-based Linux IO analysis, networking, monitoring, and more
Apache License 2.0
20.59k stars 3.88k forks source link

clang: fail when the kheaders ownership is wrong (#4928) #4985

Closed jeromemarchand closed 6 months ago

jeromemarchand commented 6 months ago

file_exists_and_ownedby() returns -1 when the file exists but its ownership is unexpected, which is very misleading since anything non zero is interpreted as true and a function with such a name is expected to return a boolean. So currently all this does, is write a warning message, and continues as if nothing is wrong.

Make file_exists_and_ownedby() returns false when the ownership is wrong and have get_proc_kheaders() fails when this happen. Also have all the exists functions return bool to avoid such issues in the future.

jeromemarchand commented 6 months ago

I rebased my PR to pass the checks. Failures look related to an outdated libbpf which have been synced since I submitted the PR.