-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
bugSomething isn't workingSomething isn't workingon my TODO list :)on my TODO list :)on my TODO list :)
Description
IMPORTANT
- You have verified that the issue to be present in the current
devbranch.
- ye
- Please supply the command line options and relevant environment variables,
e.g., a copy-paste of the contents ofout/default/fuzzer_setup..
- not even starting the fuzzer, N/A
Describe the bug
If a function contains a std::string/std::list parameter (or template class referencing those types), the function is not instrumented.
To Reproduce
Steps to reproduce the behavior:
- Build AFL++. The system compiler should use libstdc++ by default (which is the case on most linux distros).
- Create the following file:
#include <cstdio>
#include <string>
#ifdef I_WANNA_DIE
typedef std::string Param;
#else
typedef int Param;
#endif
int g;
void func(Param p) {
if (g) { // this probably should create coverage...
printf("foo");
}
}- Compile it with
./AFLplusplus/afl-clang-fast++ path/to/file.cppto see AFL++ would instrument this. - Run
./AFLplusplus/afl-clang-fast++ path/to/file.cpp -DI_WANNA_DIE=1and it no longer instruments it.
$ ./AFLplusplus/afl-clang-fast++ what-the-fuck.cpp -o /dev/null -c
afl-cc++4.09a by Michal Zalewski, Laszlo Szekeres, Marc Heuse - mode: LLVM-PCGUARD
SanitizerCoveragePCGUARD++4.09a
[+] Instrumented 3 locations with no collisions (non-hardened mode) of which are 0 handled and 0 unhandled selects.
$ ./AFLplusplus/afl-clang-fast++ -DI_WANNA_DIE=1 what-the-fuck.cpp -o /dev/null -c
afl-cc++4.09a by Michal Zalewski, Laszlo Szekeres, Marc Heuse - mode: LLVM-PCGUARD
SanitizerCoveragePCGUARD++4.09a
[!] WARNING: No instrumentation targets found.
Expected behavior
It probably should instrument the function.
Additional context
The function isIgnoreFunction in instrumentation/afl-llvm-common.cc contains the following code which seems to filter all these functions out because std::string is mangled as St7__cxx1112basic_string... with libstdc++ (the __cxx is the relevant substring).
static constexpr const char *ignoreSubstringList[] = {
"__asan", "__msan", "__ubsan", "__lsan", "__san", "__sanitize",
"__cxx", "DebugCounter", "DwarfDebug", "DebugLoc"
};
for (auto const &ignoreListFunc : ignoreSubstringList) {
// hexcoder: F->getName().contains() not avaiilable in llvm 3.8.0
if (StringRef::npos != F->getName().find(ignoreListFunc)) { return true; }
}
TLDR: Filtering based on whether function name contains __cxx is skipping everything that referenced std::string/list in the mangled name.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingon my TODO list :)on my TODO list :)on my TODO list :)