mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-04 18:29:37 +02:00
GT-3223_emteere cache exec set only if needed. stop gap until memory
manager caches this
This commit is contained in:
parent
dce20f28d5
commit
41efe77e53
1 changed files with 46 additions and 11 deletions
|
@ -19,15 +19,39 @@ import java.math.BigInteger;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
import ghidra.program.model.address.*;
|
||||
import ghidra.program.model.address.Address;
|
||||
import ghidra.program.model.address.AddressIterator;
|
||||
import ghidra.program.model.address.AddressOutOfBoundsException;
|
||||
import ghidra.program.model.address.AddressOverflowException;
|
||||
import ghidra.program.model.address.AddressSet;
|
||||
import ghidra.program.model.address.AddressSetView;
|
||||
import ghidra.program.model.data.DataType;
|
||||
import ghidra.program.model.data.PointerDataType;
|
||||
import ghidra.program.model.lang.*;
|
||||
import ghidra.program.model.listing.*;
|
||||
import ghidra.program.model.mem.*;
|
||||
import ghidra.program.model.lang.InstructionPrototype;
|
||||
import ghidra.program.model.lang.InsufficientBytesException;
|
||||
import ghidra.program.model.lang.Language;
|
||||
import ghidra.program.model.lang.Register;
|
||||
import ghidra.program.model.lang.RegisterValue;
|
||||
import ghidra.program.model.lang.UnknownContextException;
|
||||
import ghidra.program.model.lang.UnknownInstructionException;
|
||||
import ghidra.program.model.listing.ContextChangeException;
|
||||
import ghidra.program.model.listing.Data;
|
||||
import ghidra.program.model.listing.Function;
|
||||
import ghidra.program.model.listing.Instruction;
|
||||
import ghidra.program.model.listing.Program;
|
||||
import ghidra.program.model.listing.ProgramContext;
|
||||
import ghidra.program.model.mem.ByteMemBufferImpl;
|
||||
import ghidra.program.model.mem.DumbMemBufferImpl;
|
||||
import ghidra.program.model.mem.MemBuffer;
|
||||
import ghidra.program.model.mem.Memory;
|
||||
import ghidra.program.model.mem.MemoryAccessException;
|
||||
import ghidra.program.model.mem.MemoryBlock;
|
||||
import ghidra.program.model.pcode.PcodeOp;
|
||||
import ghidra.program.model.symbol.*;
|
||||
import ghidra.program.util.ProgramContextImpl;
|
||||
import ghidra.program.model.symbol.FlowType;
|
||||
import ghidra.program.model.symbol.RefType;
|
||||
import ghidra.program.model.symbol.Reference;
|
||||
import ghidra.program.model.symbol.Symbol;
|
||||
import ghidra.program.model.symbol.SymbolType;
|
||||
|
||||
/**
|
||||
* PseudoDisassembler.java
|
||||
|
@ -80,8 +104,6 @@ public class PseudoDisassembler {
|
|||
this.program = program;
|
||||
|
||||
memory = program.getMemory();
|
||||
|
||||
executeSet = memory.getExecuteSet();
|
||||
|
||||
this.language = program.getLanguage();
|
||||
|
||||
|
@ -89,6 +111,18 @@ public class PseudoDisassembler {
|
|||
|
||||
this.programContext = program.getProgramContext();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return cached addressSet of executable memory blocks
|
||||
*/
|
||||
private AddressSetView getExecuteSet() {
|
||||
if (executeSet != null) {
|
||||
return executeSet;
|
||||
}
|
||||
|
||||
executeSet = memory.getExecuteSet();
|
||||
return executeSet;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the maximum number of instructions to check
|
||||
|
@ -767,8 +801,8 @@ public class PseudoDisassembler {
|
|||
}
|
||||
}
|
||||
// if respecting execute flag on memory, test to make sure we did flow into non-execute memory
|
||||
if (respectExecuteFlag && !executeSet.isEmpty() &&
|
||||
!executeSet.contains(flows[j])) {
|
||||
AddressSetView execSet = getExecuteSet();
|
||||
if (respectExecuteFlag && !execSet.isEmpty() && !execSet.contains(flows[j])) {
|
||||
if (!flows[j].isExternalAddress()) {
|
||||
MemoryBlock block = memory.getBlock(flows[j]);
|
||||
// flowing into non-executable, but readable memory is bad
|
||||
|
@ -868,7 +902,8 @@ public class PseudoDisassembler {
|
|||
}
|
||||
|
||||
// check that body does not wander into non-executable memory
|
||||
if (respectExecuteFlag && !executeSet.isEmpty() && !body.subtract(executeSet).isEmpty()) {
|
||||
AddressSetView execSet = getExecuteSet();
|
||||
if (respectExecuteFlag && !execSet.isEmpty() && !body.subtract(execSet).isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue