Skip to content

Commit 826c1b4

Browse files
committed
Computation of taint summaries for all functions (including those in rules).
1 parent d20f8cc commit 826c1b4

File tree

4 files changed

+13
-54
lines changed

4 files changed

+13
-54
lines changed

src/summaries/summary_dump.cpp

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,29 +1025,6 @@ void dump_irept(const irept &irep, std::ostream &ostr, const std::string &shift)
10251025
}
10261026

10271027

1028-
bool skip_fn_summary(const std::string &fname)
1029-
{
1030-
if (fname.find("java::sun.") == 0UL
1031-
|| fname.find("java::com.oracle.") == 0UL
1032-
|| fname.find("java::com.sun.") == 0UL
1033-
|| fname.find("java::java.") == 0UL
1034-
|| fname.find("java::javax.") == 0UL
1035-
|| fname.find("java::org.ietf.") == 0UL
1036-
|| fname.find("java::org.jpc.") == 0UL
1037-
|| fname.find("java::org.omg.") == 0UL
1038-
|| fname.find("java::org.w3c.") == 0UL
1039-
|| fname.find("java::org.xml.") == 0UL
1040-
|| fname.find("java::jdk.") == 0UL
1041-
|| fname.find("java::org.apache.") == 0UL
1042-
|| fname.find("java::org.springframework.") == 0UL
1043-
|| fname.find("java::org.json.") == 0UL
1044-
|| fname.find("java::junit.") == 0UL
1045-
)
1046-
return true;
1047-
return false;
1048-
}
1049-
1050-
10511028
std::string to_file_name(std::string file_name, std::size_t suffix_length)
10521029
{
10531030
// The maximum file name length is 255 on most Linux file systems

src/summaries/summary_dump.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ void dump_instruction_code_in_html(
101101
);
102102

103103
std::string to_file_name(std::string file_name, std::size_t suffix_length=15);
104-
bool skip_fn_summary(const std::string &fname);
105104

106105

107106
/// Functions to dump summaries to HTML.
@@ -152,8 +151,6 @@ class summary_dumpt:public messaget
152151
for(const std::pair<irep_idt, std::shared_ptr<summary_typet>> &summary
153152
: computed_summaries)
154153
{
155-
if(skip_fn_summary(id2string(summary.first)))
156-
continue;
157154
dump_in_html(
158155
summary.first,
159156
*summary.second,
@@ -182,8 +179,6 @@ class summary_dumpt:public messaget
182179
" </tr>\n";
183180
for(const irep_idt &id : computed_summaries.keys())
184181
{
185-
if(skip_fn_summary(id2string(id)))
186-
continue;
187182
ostr
188183
<< " <tr>\n"
189184
" <td>" << to_html_text(id2string(id)) << "</td>\n"

src/taint-analysis/taint_summary.cpp

Lines changed: 13 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -702,23 +702,20 @@ void taint_algorithm_computing_summary_of_functiont::initialise_domain(
702702
const auto &fn_type=
703703
program->get_functions().function_map.at(callee_id).type;
704704

705-
if(!database.contains(callee_id))
705+
for(const auto &arg : fn_call.arguments())
706706
{
707-
// Normally should have already processed called functions as we
708-
// follow an inverted topological ordering
709-
// This callee must recursively call us
710-
for(const auto &arg : fn_call.arguments())
711-
{
712-
collect_lvsa_access_paths(
713-
arg,
714-
program->get_namespace(),
715-
environment,
716-
lvsa,
717-
it,
718-
*numbering);
719-
}
720-
continue;
707+
collect_lvsa_access_paths(
708+
arg,
709+
program->get_namespace(),
710+
environment,
711+
lvsa,
712+
it,
713+
*numbering);
721714
}
715+
716+
if(!database.contains(callee_id))
717+
continue;
718+
722719
const std::shared_ptr<taint_summaryt> summary = database.at(callee_id);
723720
for(const std::pair<taint_lvalue_numbert, taint_variablet>& input
724721
: summary->input)
@@ -1499,7 +1496,6 @@ void taint_algorithm_computing_summary_of_functiont::
14991496
void taint_algorithm_computing_summary_of_functiont::
15001497
taint_summarise_function(
15011498
const irep_idt &function_id,
1502-
bool function_has_taint_rule,
15031499
taint_summaryt::dbt &database,
15041500
local_value_set_analysist::dbt &lvsa_db)
15051501
{
@@ -1539,11 +1535,6 @@ void taint_algorithm_computing_summary_of_functiont::
15391535
lvsa.nstubs,
15401536
lvsa.nstub_assignments);
15411537

1542-
// No need to analyse the internal taint flow of functions that have
1543-
// a taint axiom (source, sink or sanitizer) associated with them:
1544-
if(function_has_taint_rule)
1545-
return;
1546-
15471538
if(database.contains(function_id))
15481539
// Already been pre-computed
15491540
return;
@@ -1700,7 +1691,6 @@ void taint_summarise_all_functions(
17001691
const goto_functionst::function_mapt &functions_map =
17011692
program->get_functions().function_map;
17021693
const auto fn_it = functions_map.find(fn_name);
1703-
bool has_rule = transition_rules->has_rule(fn_name);
17041694
if(fn_it!=functions_map.cend() && fn_it->second.body_available()
17051695
&& fn_name!="_start")
17061696
{
@@ -1723,7 +1713,6 @@ void taint_summarise_all_functions(
17231713
log);
17241714
summariser.taint_summarise_function(
17251715
fn_name,
1726-
has_rule,
17271716
summaries_to_compute,
17281717
lvsa_db);
17291718
++processed;
@@ -1738,8 +1727,7 @@ void taint_summarise_all_functions(
17381727
(double)topological_order_size)
17391728
<< "%] Skipping"
17401729
<< (fn_it!=functions_map.cend() && !fn_it->second.body_available()
1741-
? " [function without a body]"
1742-
: has_rule ? " [function call representing a transition rule]" : "")
1730+
? " [function without a body]" : "")
17431731
<< ": "
17441732
<< fn_name
17451733
<< messaget::eom;

src/taint-analysis/taint_summary.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,6 @@ class taint_algorithm_computing_summary_of_functiont
189189

190190
void taint_summarise_function(
191191
const irep_idt &function_id,
192-
bool function_has_taint_rule,
193192
taint_summaryt::dbt &database,
194193
local_value_set_analysist::dbt &lvsa_db);
195194

0 commit comments

Comments
 (0)