LibAFL
LibAFL copied to clipboard
Print warnings on any weakly override function
LibAFL uses several weak function definitions, which are supposed to take over if a library is not linked/available.
When running a debug build it would be great if LibAFL would warn about any overriden functions. This increases debugability if the linker misbehaves. I propose to add a println for every call of weak function. Because this would be noisy, we can limit it to print only once.
This issue is inspired by https://github.com/AFLplusplus/LibAFL/issues/1231 which was extremely hard to debug. Generally I think a weak function being called, indicates a somewhat special build.
This is open for discussion. Generally, I think LibAFL should support users in getting a correctly linked binary. Linkers are weird and we somehow have to deal with it...
Is there a automated way to display the name of weakly defined function?
Adding another example to this issue: The weakly defined LLVMFuzzerTestOneInput in libafl_targets was executing instead of the one in my harness. This was fixed by forcing linking of my target static lib using whole-archive (thanks for the tip tokatoka).
Finding it to be a linking error wasn't intuitive though; at first it just looked like I was getting no coverage.
For better debugability, perhaps select weakly defined functions could throw out a warning if they are ever executed, instead of being defined as no-ops in libafl_targets.
The more I'm exposed to weak functions the more I want to never touch linkers again :D
Is there a automated way to display the name of weakly defined function?
What do you mean with that?
What do you mean with that?
Nevermind I thought you want the warnings to appear on compile time. Now I understand what you mean