mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-05-28 12:56:02 +08:00
Merge remote-tracking branch 'origin/Ghidra_11.4'
This commit is contained in:
+24
-31
@@ -4,9 +4,9 @@
|
|||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
@@ -235,7 +235,6 @@ public class AutoVersionTrackingTask extends Task {
|
|||||||
monitor.doIncrementProgress();
|
monitor.doIncrementProgress();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// This is the first of the "speculative" post-correlator match algorithm. The correlator
|
// This is the first of the "speculative" post-correlator match algorithm. The correlator
|
||||||
// returns all duplicate function instruction matches so there will always be more
|
// returns all duplicate function instruction matches so there will always be more
|
||||||
// than one possible match for each function. The compare mechanism used by the
|
// than one possible match for each function. The compare mechanism used by the
|
||||||
@@ -255,7 +254,7 @@ public class AutoVersionTrackingTask extends Task {
|
|||||||
// if Auto VT min function length for dupe matches is different than current
|
// if Auto VT min function length for dupe matches is different than current
|
||||||
// exact instruction match setting temporarily change it for auto VT run
|
// exact instruction match setting temporarily change it for auto VT run
|
||||||
int dupFunctionMinLen =
|
int dupFunctionMinLen =
|
||||||
toolOptions.getInt(VTOptionDefines.DUPE_FUNCTION_CORRELATOR_MIN_LEN_OPTION, 10);
|
toolOptions.getInt(VTOptionDefines.DUPE_FUNCTION_CORRELATOR_MIN_LEN_OPTION, 25);
|
||||||
|
|
||||||
vtOptions.setInt(
|
vtOptions.setInt(
|
||||||
ExactMatchInstructionsProgramCorrelatorFactory.FUNCTION_MINIMUM_SIZE,
|
ExactMatchInstructionsProgramCorrelatorFactory.FUNCTION_MINIMUM_SIZE,
|
||||||
@@ -279,9 +278,10 @@ public class AutoVersionTrackingTask extends Task {
|
|||||||
toolOptions.getBoolean(VTOptionDefines.RUN_REF_CORRELATORS_OPTION, true);
|
toolOptions.getBoolean(VTOptionDefines.RUN_REF_CORRELATORS_OPTION, true);
|
||||||
if (runRefCorrelators) {
|
if (runRefCorrelators) {
|
||||||
|
|
||||||
double minScore = toolOptions.getDouble(VTOptionDefines.REF_CORRELATOR_MIN_SCORE_OPTION, 0.95);
|
double minScore =
|
||||||
double minConf = toolOptions.getDouble(VTOptionDefines.REF_CORRELATOR_MIN_CONF_OPTION, 10.0);
|
toolOptions.getDouble(VTOptionDefines.REF_CORRELATOR_MIN_SCORE_OPTION, 0.95);
|
||||||
|
double minConf =
|
||||||
|
toolOptions.getDouble(VTOptionDefines.REF_CORRELATOR_MIN_CONF_OPTION, 10.0);
|
||||||
|
|
||||||
// Get the number of data and function matches
|
// Get the number of data and function matches
|
||||||
int numDataMatches = getNumberOfDataMatches(monitor);
|
int numDataMatches = getNumberOfDataMatches(monitor);
|
||||||
@@ -497,32 +497,31 @@ public class AutoVersionTrackingTask extends Task {
|
|||||||
int minVoteCountNeeded, int maxConflictsAllowed,
|
int minVoteCountNeeded, int maxConflictsAllowed,
|
||||||
TaskMonitor monitor) throws CancelledException {
|
TaskMonitor monitor) throws CancelledException {
|
||||||
|
|
||||||
|
|
||||||
Set<VTMatch> goodImpliedMatches = new HashSet<>();
|
Set<VTMatch> goodImpliedMatches = new HashSet<>();
|
||||||
|
|
||||||
for (VTMatch match : matchesToProcess) {
|
for (VTMatch match : matchesToProcess) {
|
||||||
monitor.checkCancelled();
|
monitor.checkCancelled();
|
||||||
|
|
||||||
VTAssociation association = match.getAssociation();
|
VTAssociation association = match.getAssociation();
|
||||||
|
|
||||||
// skip if already accepted or blocked match
|
// skip if already accepted or blocked match
|
||||||
if (association.getStatus() != VTAssociationStatus.AVAILABLE) {
|
if (association.getStatus() != VTAssociationStatus.AVAILABLE) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// skip if there are any conflicting associations
|
// skip if there are any conflicting associations
|
||||||
int numConflicts = association.getRelatedAssociations().size() - 1;
|
int numConflicts = association.getRelatedAssociations().size() - 1;
|
||||||
if (numConflicts > maxConflictsAllowed) {
|
if (numConflicts > maxConflictsAllowed) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
int voteCount = association.getVoteCount();
|
int voteCount = association.getVoteCount();
|
||||||
|
|
||||||
if (voteCount >= minVoteCountNeeded) {
|
if (voteCount >= minVoteCountNeeded) {
|
||||||
goodImpliedMatches.add(match);
|
goodImpliedMatches.add(match);
|
||||||
}
|
}
|
||||||
|
|
||||||
monitor.incrementProgress();
|
monitor.incrementProgress();
|
||||||
}
|
}
|
||||||
|
|
||||||
return goodImpliedMatches;
|
return goodImpliedMatches;
|
||||||
@@ -893,7 +892,6 @@ public class AutoVersionTrackingTask extends Task {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* From the given related association, ie a group of src/dest pairs of functions with identical
|
* From the given related association, ie a group of src/dest pairs of functions with identical
|
||||||
* instructions, use operand information to find any unique matches in the set.
|
* instructions, use operand information to find any unique matches in the set.
|
||||||
@@ -907,7 +905,6 @@ public class AutoVersionTrackingTask extends Task {
|
|||||||
Collection<VTAssociation> relatedAssociations, TaskMonitor monitor)
|
Collection<VTAssociation> relatedAssociations, TaskMonitor monitor)
|
||||||
throws CancelledException {
|
throws CancelledException {
|
||||||
|
|
||||||
|
|
||||||
// create function to operand map maps for each source and destination function
|
// create function to operand map maps for each source and destination function
|
||||||
// in the given related associations (src/dst function pairs)
|
// in the given related associations (src/dst function pairs)
|
||||||
Map<Function, Map<Long, Map<Integer, Object>>> sourceFunctionsMap =
|
Map<Function, Map<Long, Map<Integer, Object>>> sourceFunctionsMap =
|
||||||
@@ -916,7 +913,6 @@ public class AutoVersionTrackingTask extends Task {
|
|||||||
Map<Function, Map<Long, Map<Integer, Object>>> destFunctionsMap =
|
Map<Function, Map<Long, Map<Integer, Object>>> destFunctionsMap =
|
||||||
createFunctionsMap(relatedAssociations, false, monitor);
|
createFunctionsMap(relatedAssociations, false, monitor);
|
||||||
|
|
||||||
|
|
||||||
// only functions with scalar or address operands are mapped so the lists could be
|
// only functions with scalar or address operands are mapped so the lists could be
|
||||||
// empty if there are functions with no operand info to be mapped
|
// empty if there are functions with no operand info to be mapped
|
||||||
if (sourceFunctionsMap.isEmpty() || destFunctionsMap.isEmpty()) {
|
if (sourceFunctionsMap.isEmpty() || destFunctionsMap.isEmpty()) {
|
||||||
@@ -1032,7 +1028,6 @@ public class AutoVersionTrackingTask extends Task {
|
|||||||
return functionsMap;
|
return functionsMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Using the given source function's map and a list of destination function maps, and a list
|
* Using the given source function's map and a list of destination function maps, and a list
|
||||||
* of destination functions to omit because they already have found matches, try to find a
|
* of destination functions to omit because they already have found matches, try to find a
|
||||||
@@ -1214,7 +1209,6 @@ public class AutoVersionTrackingTask extends Task {
|
|||||||
*/
|
*/
|
||||||
private boolean hasAnyAssociations(Address source, Address dest) {
|
private boolean hasAnyAssociations(Address source, Address dest) {
|
||||||
|
|
||||||
|
|
||||||
Collection<VTAssociation> sourceAssociations = session.getAssociationManager()
|
Collection<VTAssociation> sourceAssociations = session.getAssociationManager()
|
||||||
.getRelatedAssociationsBySourceAddress(source);
|
.getRelatedAssociationsBySourceAddress(source);
|
||||||
|
|
||||||
@@ -1261,7 +1255,6 @@ public class AutoVersionTrackingTask extends Task {
|
|||||||
throws CancelledException {
|
throws CancelledException {
|
||||||
|
|
||||||
Map<Long, Map<Integer, Object>> offsetToOperandsMap = new HashMap<>();
|
Map<Long, Map<Integer, Object>> offsetToOperandsMap = new HashMap<>();
|
||||||
|
|
||||||
|
|
||||||
Program program = function.getProgram();
|
Program program = function.getProgram();
|
||||||
|
|
||||||
@@ -1278,7 +1271,7 @@ public class AutoVersionTrackingTask extends Task {
|
|||||||
if (map.keySet().isEmpty()) {
|
if (map.keySet().isEmpty()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get offset from top of function to use in function to operandMap map
|
// get offset from top of function to use in function to operandMap map
|
||||||
// can be positive or negative offset (positive means instruction address is after
|
// can be positive or negative offset (positive means instruction address is after
|
||||||
// the entry address, negative means instruction address is before entry address)
|
// the entry address, negative means instruction address is before entry address)
|
||||||
|
|||||||
+1
-1
@@ -848,7 +848,7 @@ public class VTMatchTableProvider extends ComponentProviderAdapter
|
|||||||
.setOptionsHelpLocation(
|
.setOptionsHelpLocation(
|
||||||
new HelpLocation(VTPlugin.HELP_TOPIC_NAME, "Auto_Version_Tracking_Options"));
|
new HelpLocation(VTPlugin.HELP_TOPIC_NAME, "Auto_Version_Tracking_Options"));
|
||||||
|
|
||||||
vtOptions.registerOption(DUPE_FUNCTION_CORRELATOR_MIN_LEN_OPTION, 10, null,
|
vtOptions.registerOption(DUPE_FUNCTION_CORRELATOR_MIN_LEN_OPTION, 25, null,
|
||||||
"Minimum Function Length of Auto Version Tracking Duplicate Function Correlator");
|
"Minimum Function Length of Auto Version Tracking Duplicate Function Correlator");
|
||||||
vtOptions.getOptions(DUPE_FUNCTION_CORRELATOR_MIN_LEN_OPTION)
|
vtOptions.getOptions(DUPE_FUNCTION_CORRELATOR_MIN_LEN_OPTION)
|
||||||
.setOptionsHelpLocation(
|
.setOptionsHelpLocation(
|
||||||
|
|||||||
+14
@@ -90,6 +90,8 @@ public class VTAutoVersionTrackingTest extends AbstractGhidraHeadedIntegrationTe
|
|||||||
|
|
||||||
vtOptions.setDouble(VTOptionDefines.REF_CORRELATOR_MIN_SCORE_OPTION, 0.999999999);
|
vtOptions.setDouble(VTOptionDefines.REF_CORRELATOR_MIN_SCORE_OPTION, 0.999999999);
|
||||||
vtOptions.setDouble(VTOptionDefines.REF_CORRELATOR_MIN_CONF_OPTION, 10.0);
|
vtOptions.setDouble(VTOptionDefines.REF_CORRELATOR_MIN_CONF_OPTION, 10.0);
|
||||||
|
//min was 10 when tests first written but have changed since so now need to set it manually
|
||||||
|
vtOptions.setInt(VTOptionDefines.DUPE_FUNCTION_CORRELATOR_MIN_LEN_OPTION, 10);
|
||||||
|
|
||||||
runAutoVTCommand(vtOptions);
|
runAutoVTCommand(vtOptions);
|
||||||
|
|
||||||
@@ -155,6 +157,8 @@ public class VTAutoVersionTrackingTest extends AbstractGhidraHeadedIntegrationTe
|
|||||||
|
|
||||||
vtOptions.setDouble(VTOptionDefines.REF_CORRELATOR_MIN_SCORE_OPTION, 0.5);
|
vtOptions.setDouble(VTOptionDefines.REF_CORRELATOR_MIN_SCORE_OPTION, 0.5);
|
||||||
vtOptions.setDouble(VTOptionDefines.REF_CORRELATOR_MIN_CONF_OPTION, 1.0);
|
vtOptions.setDouble(VTOptionDefines.REF_CORRELATOR_MIN_CONF_OPTION, 1.0);
|
||||||
|
//min was 10 when tests first written but have changed since so now need to set it manually
|
||||||
|
vtOptions.setInt(VTOptionDefines.DUPE_FUNCTION_CORRELATOR_MIN_LEN_OPTION, 10);
|
||||||
|
|
||||||
runAutoVTCommand(vtOptions);
|
runAutoVTCommand(vtOptions);
|
||||||
|
|
||||||
@@ -279,6 +283,8 @@ public class VTAutoVersionTrackingTest extends AbstractGhidraHeadedIntegrationTe
|
|||||||
|
|
||||||
vtOptions.setDouble(VTOptionDefines.REF_CORRELATOR_MIN_SCORE_OPTION, 1.0);
|
vtOptions.setDouble(VTOptionDefines.REF_CORRELATOR_MIN_SCORE_OPTION, 1.0);
|
||||||
vtOptions.setDouble(VTOptionDefines.REF_CORRELATOR_MIN_CONF_OPTION, 10.0);
|
vtOptions.setDouble(VTOptionDefines.REF_CORRELATOR_MIN_CONF_OPTION, 10.0);
|
||||||
|
//min was 10 when tests first written but have changed since so now need to set it manually
|
||||||
|
vtOptions.setInt(VTOptionDefines.DUPE_FUNCTION_CORRELATOR_MIN_LEN_OPTION, 10);
|
||||||
|
|
||||||
runAutoVTCommand(vtOptions);
|
runAutoVTCommand(vtOptions);
|
||||||
|
|
||||||
@@ -329,6 +335,8 @@ public class VTAutoVersionTrackingTest extends AbstractGhidraHeadedIntegrationTe
|
|||||||
|
|
||||||
vtOptions.setDouble(VTOptionDefines.REF_CORRELATOR_MIN_SCORE_OPTION, 1.0);
|
vtOptions.setDouble(VTOptionDefines.REF_CORRELATOR_MIN_SCORE_OPTION, 1.0);
|
||||||
vtOptions.setDouble(VTOptionDefines.REF_CORRELATOR_MIN_CONF_OPTION, 10.0);
|
vtOptions.setDouble(VTOptionDefines.REF_CORRELATOR_MIN_CONF_OPTION, 10.0);
|
||||||
|
//min was 10 when tests first written but have changed since so now need to set it manually
|
||||||
|
vtOptions.setInt(VTOptionDefines.DUPE_FUNCTION_CORRELATOR_MIN_LEN_OPTION, 10);
|
||||||
|
|
||||||
runAutoVTCommand(vtOptions);
|
runAutoVTCommand(vtOptions);
|
||||||
|
|
||||||
@@ -369,6 +377,8 @@ public class VTAutoVersionTrackingTest extends AbstractGhidraHeadedIntegrationTe
|
|||||||
|
|
||||||
vtOptions.setDouble(VTOptionDefines.REF_CORRELATOR_MIN_SCORE_OPTION, 1.0);
|
vtOptions.setDouble(VTOptionDefines.REF_CORRELATOR_MIN_SCORE_OPTION, 1.0);
|
||||||
vtOptions.setDouble(VTOptionDefines.REF_CORRELATOR_MIN_CONF_OPTION, 10.0);
|
vtOptions.setDouble(VTOptionDefines.REF_CORRELATOR_MIN_CONF_OPTION, 10.0);
|
||||||
|
//min was 10 when tests first written but have changed since so now need to set it manually
|
||||||
|
vtOptions.setInt(VTOptionDefines.DUPE_FUNCTION_CORRELATOR_MIN_LEN_OPTION, 10);
|
||||||
|
|
||||||
runAutoVTCommand(vtOptions);
|
runAutoVTCommand(vtOptions);
|
||||||
|
|
||||||
@@ -442,6 +452,8 @@ public class VTAutoVersionTrackingTest extends AbstractGhidraHeadedIntegrationTe
|
|||||||
|
|
||||||
vtOptions.setDouble(VTOptionDefines.REF_CORRELATOR_MIN_SCORE_OPTION, 1.0);
|
vtOptions.setDouble(VTOptionDefines.REF_CORRELATOR_MIN_SCORE_OPTION, 1.0);
|
||||||
vtOptions.setDouble(VTOptionDefines.REF_CORRELATOR_MIN_CONF_OPTION, 10.0);
|
vtOptions.setDouble(VTOptionDefines.REF_CORRELATOR_MIN_CONF_OPTION, 10.0);
|
||||||
|
//min was 10 when tests first written but have changed since so now need to set it manually
|
||||||
|
vtOptions.setInt(VTOptionDefines.DUPE_FUNCTION_CORRELATOR_MIN_LEN_OPTION, 10);
|
||||||
|
|
||||||
runAutoVTCommand(vtOptions);
|
runAutoVTCommand(vtOptions);
|
||||||
|
|
||||||
@@ -600,6 +612,8 @@ public class VTAutoVersionTrackingTest extends AbstractGhidraHeadedIntegrationTe
|
|||||||
|
|
||||||
vtOptions.setDouble(VTOptionDefines.REF_CORRELATOR_MIN_SCORE_OPTION, 1.0);
|
vtOptions.setDouble(VTOptionDefines.REF_CORRELATOR_MIN_SCORE_OPTION, 1.0);
|
||||||
vtOptions.setDouble(VTOptionDefines.REF_CORRELATOR_MIN_CONF_OPTION, 10.0);
|
vtOptions.setDouble(VTOptionDefines.REF_CORRELATOR_MIN_CONF_OPTION, 10.0);
|
||||||
|
//min was 10 when tests first written but have changed since so now need to set it manually
|
||||||
|
vtOptions.setInt(VTOptionDefines.DUPE_FUNCTION_CORRELATOR_MIN_LEN_OPTION, 10);
|
||||||
|
|
||||||
runAutoVTCommand(vtOptions);
|
runAutoVTCommand(vtOptions);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user