diff --git a/unpin.cpp b/unpin.cpp index 02620f1da29b3978d7ad1d1bec74970307801685..a9cacb64bba364b4843d44b00d1815bec99b0647 100644 --- a/unpin.cpp +++ b/unpin.cpp @@ -160,8 +160,8 @@ void Unpin_t::DoUnpinForFixedCalls() if(should_cfi_pin(wrt_insn)) continue; - - if(wrt_insn->GetIndirectBranchTargetAddress()) + // leave this for debugging I guess? + if(wrt_insn->GetIndirectBranchTargetAddress() && wrt_insn->GetIndirectBranchTargetAddress()->GetVirtualOffset()!=0) { cout<<"Unpin::Found "<<reloc->GetType()<<" relocation for pinned insn at "<<hex<< wrt_insn->GetIndirectBranchTargetAddress()->GetVirtualOffset()<<endl; @@ -171,6 +171,14 @@ void Unpin_t::DoUnpinForFixedCalls() cout<<"Unpin::Warn: unpin found non-IBTA to unpin. probably it's unpinned twice. continuing anyhow."<<endl; } + PlacementQueue_t* pq=zo->GetPlacementQueue(); + assert(pq); + + // create a new dollop for the unpinned IBT + // and add it to the placement queue. + Dollop_t *newDoll=zo->GetDollopManager()->AddNewDollops(wrt_insn); + pq->insert(std::pair<Dollop_t*,RangeAddress_t>(newDoll, 0)); + unpins++; insn_unpins++; if(m_max_unpins != -1 && unpins>=m_max_unpins) @@ -215,9 +223,9 @@ void Unpin_t::DoUnpinForScoops() // safe cast and check. assert(insn); - - if(insn->GetIndirectBranchTargetAddress()) - { + // leave this for debugging I guess? + if(insn->GetIndirectBranchTargetAddress() && insn->GetIndirectBranchTargetAddress()->GetVirtualOffset()!=0) + { cout<<"Unpin::Found data_to_insn_ptr relocation for pinned insn:" <<hex<<insn->GetBaseID()<<":" <<insn->getDisassembly()<<" at " <<hex<< insn->GetIndirectBranchTargetAddress()->GetVirtualOffset()<<endl; @@ -238,7 +246,15 @@ void Unpin_t::DoUnpinForScoops() missed_unpins++; } else - { + { + PlacementQueue_t* pq=zo->GetPlacementQueue(); + assert(pq); + + // create a new dollop for the unpinned IBT + // and add it to the placement queue. + Dollop_t *newDoll=zo->GetDollopManager()->AddNewDollops(insn); + pq->insert(std::pair<Dollop_t*,RangeAddress_t>(newDoll, 0)); + unpins++; scoop_unpins++; if(m_max_unpins != -1 && unpins>=m_max_unpins)