Skip to content

SSS: value-set-analysis adaptation #612

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

smowton
Copy link
Contributor

@smowton smowton commented Mar 8, 2017

This makes a couple of small additions to VSA (storing function-ID in each value set, and a declared-type in value set entries), and templatizes and virtualizes it to make it suitable for subclassing and adaptation by the security scanner.

smowton added 4 commits March 8, 2017 11:40
Encountered during security scanner analysis: a potential case where
an infinite series of pointer casts (both explicit and implicit via
taking the address of a structure's first member) was accumulated,
leading to nontermintion of the VSA algorithm. This is a temporary
fix until the underlying cause can be conclusively identified.
Value sets already know their own location id; this adds the function
id too so that context-sensitive variants of VSA can find that without
needing to track extra context themselves.
This is essentially specific to the security scanner's needs, but is
also impossible to add to value-set without templating the class, thus
moving ~2000LOC into its header file. This is the temporary kludge until
we bite the bullet and do that, or think of something smarter.
This templates value-set-analysis, so that it can be subclassed
providing a value-set extension, and virtualizes value-set so it
can similarly be extended.
@@ -1062,6 +1062,32 @@ void value_sett::get_reference_set(
dest.push_back(to_expr(it));
}

static void strip_casts(
exprt& e,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

&

@smowton smowton force-pushed the sss_templatize_vsa branch from cfc2ba4 to ff34029 Compare March 9, 2017 12:14
@smowton
Copy link
Contributor Author

smowton commented Mar 9, 2017

Done

@@ -1062,6 +1062,32 @@ void value_sett::get_reference_set(
dest.push_back(to_expr(it));
}

static void strip_casts(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

function comment block missing

return;
}
else
return;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe add a blank line after the return

xmlt &i=dest.new_element("instruction");
i.new_element()=::xml(location);

for(value_sett::valuest::const_iterator
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for each

if(location==previous_location)
continue;

if(location.is_nil() || location.get_file()==irep_idt())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get_file().empty()

@smowton
Copy link
Contributor Author

smowton commented Mar 10, 2017

Made first two changes. The latter two are inherited from existing VSA, so I won't make them here (they will only clash with likely-upcoming upstream changes)

@peterschrammel peterschrammel merged commit dcd058a into diffblue:security-scanner-support Mar 10, 2017
peterschrammel added a commit that referenced this pull request Jul 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants