Skip to content
Snippets Groups Projects
Commit 938c1cec authored by Jason Hiser's avatar Jason Hiser
Browse files

Merge branch 'plop_non_exe_nonces_for_unpinned_IBTs' into 'master'

Support unpinned ibts

See merge request allzp/zipr_scfi_plugin!5
parents 81fadaa4 0ab915a0
No related branches found
No related tags found
No related merge requests found
...@@ -833,8 +833,10 @@ bool NonceRelocs_t::WillPluginPlop(libIRDB::Instruction_t* insn) ...@@ -833,8 +833,10 @@ bool NonceRelocs_t::WillPluginPlop(libIRDB::Instruction_t* insn)
if(FindExeNonceRelocation(insn)) if(FindExeNonceRelocation(insn))
return true; return true;
bool will_plop=(get_cfi_space(insn) > 0 && insn->GetIndirectBranchTargetAddress()==NULL); bool isPinnedIBT = (insn->GetIndirectBranchTargetAddress() != NULL)
&& (insn->GetIndirectBranchTargetAddress()->GetVirtualOffset() != 0);
bool will_plop=(get_cfi_space(insn) > 0 && !isPinnedIBT);
if (m_verbose) if (m_verbose)
{ {
...@@ -855,7 +857,12 @@ size_t NonceRelocs_t::DollopEntryOpeningSize(DollopEntry_t* entry) ...@@ -855,7 +857,12 @@ size_t NonceRelocs_t::DollopEntryOpeningSize(DollopEntry_t* entry)
if(!m_on) if(!m_on)
return 0; return 0;
if(entry->Instruction()->GetIndirectBranchTargetAddress()==NULL) bool isPinnedIBT = (entry->Instruction()->GetIndirectBranchTargetAddress() != NULL)
&& (entry->Instruction()->GetIndirectBranchTargetAddress()->GetVirtualOffset() != 0);
// For now, need to put non-exe nonces on unpinned targets, even those with exe nonce relocs.
// Will change after cfi updates are pushed.
if(!isPinnedIBT)
return get_cfi_space(entry->Instruction()); return get_cfi_space(entry->Instruction());
return 0; return 0;
...@@ -1013,7 +1020,13 @@ RangeAddress_t NonceRelocs_t::PlopDollopEntry(Zipr_SDK::DollopEntry_t *de, ...@@ -1013,7 +1020,13 @@ RangeAddress_t NonceRelocs_t::PlopDollopEntry(Zipr_SDK::DollopEntry_t *de,
} }
// put down nonces and instruction // put down nonces and instruction
if(get_cfi_space(insn) > 0 && insn->GetIndirectBranchTargetAddress()==NULL)
bool isPinnedIBT = (insn->GetIndirectBranchTargetAddress() != NULL)
&& (insn->GetIndirectBranchTargetAddress()->GetVirtualOffset() != 0);
// For now, need to put non-exe nonces on unpinned targets, even those with exe nonce relocs.
// Will change after cfi updates are pushed.
if(get_cfi_space(insn) > 0 && !isPinnedIBT)
{ {
unsigned int cfi_space=get_cfi_space(insn); unsigned int cfi_space=get_cfi_space(insn);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment