Skip to content

Commit 6f6c099

Browse files
author
owen-jones-diffblue
authored
Merge pull request diffblue#347 from diffblue/owen-jones-diffblue/per-test-turn-off-precise-access-paths
Add functionality to turn off precise access paths for individual tests
2 parents 2d8639b + 36990b8 commit 6f6c099

File tree

6 files changed

+22
-20
lines changed

6 files changed

+22
-20
lines changed

driver/analyser.py

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ def run_security_analyser(
5252
dump_html_slice,
5353
dump_html_program,
5454
verbosity,
55+
do_not_use_precise_access_paths,
5556
data_flow_insensitive_instrumentation,
5657
results_dir,
5758
temp_root_dir
@@ -70,29 +71,15 @@ def run_security_analyser(
7071
"rules": transition_rules_file_pathname,
7172
"timeout": timeout,
7273
"verbosity": verbosity,
74+
"dump_html_summaries": dump_html_summaries,
75+
"dump_html_statistics": dump_html_statistics,
76+
"dump_html_slice": dump_html_slice,
77+
"dump_html_program": dump_html_program,
78+
"do_not_use_precise_access_paths": do_not_use_precise_access_paths,
7379
"output-dir": "./",
7480
"temp-dir": temp_root_dir,
7581
"data-flow-insensitive-instrumentation": data_flow_insensitive_instrumentation
7682
}
77-
if dump_html_summaries:
78-
root_config_json["dump_html_summaries"] = True
79-
else:
80-
root_config_json["dump_html_summaries"] = False
81-
82-
if dump_html_statistics:
83-
root_config_json["dump_html_statistics"] = True
84-
else:
85-
root_config_json["dump_html_statistics"] = False
86-
87-
if dump_html_slice:
88-
root_config_json["dump_html_slice"] = True
89-
else:
90-
root_config_json["dump_html_slice"] = False
91-
92-
if dump_html_program:
93-
root_config_json["dump_html_program"] = True
94-
else:
95-
root_config_json["dump_html_program"] = False
9683
with open(root_config_json_fname, "w") as root_config_json_file:
9784
root_config_json_file.write(json.dumps(root_config_json, sort_keys=True, indent=4))
9885

driver/run.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,9 @@ def __parse_cmd_line():
134134
"of this data-flow insensitive instrumentation is that it allows more aggressive program "
135135
"slicing and so smaller programs for CBMC to analyse, i.e. considerably faster analysis. "
136136
"The disadvantage is that some of the generated error traces might be false positives.")
137+
parser.add_argument("--do-not-use-precise-access-paths", action="store_true",
138+
help="Call security-analyzer with a command line argument which turns off precise access "
139+
"paths.")
137140
return parser.parse_args()
138141

139142

@@ -177,6 +180,7 @@ def evaluate(cmdline, common_libraries):
177180
cmdline.dump_html_slice,
178181
cmdline.dump_html_program,
179182
cmdline.verbosity,
183+
cmdline.do_not_use_precise_access_paths,
180184
cmdline.data_flow_insensitive_instrumentation,
181185
cmdline.results_dir,
182186
os.path.abspath(os.path.join(cmdline.temp_dir,"GOTO-ANALYSER-TEMP"))

regression/end_to_end/taint_over_list_models/test_taint_over_list_models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ def test_taint_over_list_models():
2020
"build",
2121
"rules.json",
2222
os.path.realpath(os.path.dirname(__file__)),
23-
["--use-models-library"])
23+
["--use-models-library", "--do-not-use-precise-access-paths"])
2424
assert traces.count_traces() == 1
2525
assert traces.trace_exists("java::Main.main:()V", 14)

src/taint-analysis/taint_config.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ taint_configt::taint_configt(const std::string &cfg_fname)
2222
, dump_html_statistics(false)
2323
, dump_html_slice(false)
2424
, dump_html_program(false)
25+
, do_not_use_precise_access_paths(false)
2526
, data_flow_insensitive_instrumentation(false)
2627
{
2728
}
@@ -177,6 +178,7 @@ bool taint_configt::load(message_handlert &handler)
177178
dump_html_statistics=cfg["dump_html_statistics"].is_true();
178179
dump_html_slice=cfg["dump_html_slice"].is_true();
179180
dump_html_program=cfg["dump_html_program"].is_true();
181+
do_not_use_precise_access_paths=cfg["do_not_use_precise_access_paths"].is_true();
180182
data_flow_insensitive_instrumentation=
181183
cfg["data-flow-insensitive-instrumentation"].is_true();
182184

src/taint-analysis/taint_config.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@ class taint_configt
9595
return dump_html_program;
9696
}
9797

98+
bool is_do_not_precise_access_paths_enabled() const
99+
{
100+
return do_not_use_precise_access_paths;
101+
}
102+
98103
bool use_data_flow_insensitive_instrumentation() const
99104
{
100105
return data_flow_insensitive_instrumentation;
@@ -120,6 +125,7 @@ class taint_configt
120125
bool dump_html_statistics;
121126
bool dump_html_slice;
122127
bool dump_html_program;
128+
bool do_not_use_precise_access_paths;
123129
bool data_flow_insensitive_instrumentation;
124130
};
125131

src/taint-analysis/taint_security_scanner.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@ bool taint_do_security_scan(
118118

119119
statistics.begin_loading_taint_summaries_database();
120120

121+
local_value_sett::do_not_use_precise_access_paths =
122+
config.is_do_not_precise_access_paths_enabled();
123+
121124
boost::filesystem::path summaries_root(
122125
config.get_taint_summaries_root_directory());
123126

0 commit comments

Comments
 (0)