mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-19 21:13:45 +00:00
ignoring ifuncs on fixed map LTO
This commit is contained in:
@ -219,18 +219,27 @@ bool AFLLTOPass::runOnModule(Module &M) {
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (map_addr)
|
std::vector<std::string> module_block_list;
|
||||||
|
|
||||||
|
if (map_addr) {
|
||||||
|
|
||||||
for (GlobalIFunc &IF : M.ifuncs()) {
|
for (GlobalIFunc &IF : M.ifuncs()) {
|
||||||
|
|
||||||
// No clue how to follow these up and find the resolver function.
|
StringRef ifunc_name = IF.getName();
|
||||||
// If we would know that resolver function name we could just skip
|
Constant *r = IF.getResolver();
|
||||||
// instrumenting it and everything would be fine :-(
|
StringRef r_name = cast<Function>(r->getOperand(0))->getName();
|
||||||
// StringRef ifunc_name = IF.getName();
|
if (!be_quiet)
|
||||||
// Constant *r = IF.getResolver();
|
fprintf(stderr, "Found an ifunc with name %s that points to resolver function %s, we cannot instrument this, putting it into a block list.\n",
|
||||||
FATAL(
|
ifunc_name.str().c_str(), r_name.str().c_str());
|
||||||
"Target uses ifunc attribute for %s, fixed map cannot be used, "
|
|
||||||
"remove AFL_LLVM_MAP_ADDR",
|
module_block_list.push_back(r_name.str());
|
||||||
IF.getName().str().c_str());
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// next up: ctors run before __afl_init()
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -250,6 +259,24 @@ bool AFLLTOPass::runOnModule(Module &M) {
|
|||||||
if (F.size() < function_minimum_size) continue;
|
if (F.size() < function_minimum_size) continue;
|
||||||
if (isIgnoreFunction(&F)) continue;
|
if (isIgnoreFunction(&F)) continue;
|
||||||
|
|
||||||
|
if (module_block_list.size()) {
|
||||||
|
|
||||||
|
for (auto bname : module_block_list) {
|
||||||
|
|
||||||
|
std::string fname = F.getName().str();
|
||||||
|
|
||||||
|
if (fname.compare(bname) == 0) {
|
||||||
|
|
||||||
|
if (!be_quiet)
|
||||||
|
WARNF("Skipping instrumentation of ifunc resolver function %s",
|
||||||
|
fname.c_str());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// the instrument file list check
|
// the instrument file list check
|
||||||
AttributeList Attrs = F.getAttributes();
|
AttributeList Attrs = F.getAttributes();
|
||||||
if (Attrs.hasAttribute(-1, StringRef("skipinstrument"))) {
|
if (Attrs.hasAttribute(-1, StringRef("skipinstrument"))) {
|
||||||
|
Reference in New Issue
Block a user