Skip to content
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

Siemens fix260 squashed (do not merge) #291

Closed

Conversation

lucasccordeiro
Copy link
Contributor

No description provided.

…ing the dependence graph

Signed-off-by: Lucas Cordeiro <[email protected]>
Signed-off-by: Lucas Cordeiro <[email protected]>
Signed-off-by: Lucas Cordeiro <[email protected]>
Signed-off-by: Lucas Cordeiro <[email protected]>
Signed-off-by: Lucas Cordeiro <[email protected]>
Signed-off-by: Lucas Cordeiro <[email protected]>
Signed-off-by: Lucas Cordeiro <[email protected]>
Signed-off-by: Lucas Cordeiro <[email protected]>
@lucasccordeiro lucasccordeiro force-pushed the siemens_fix260_squashed branch from 1da9076 to 517fbd2 Compare December 28, 2016 16:41
Copy link
Collaborator

@tautschnig tautschnig left a comment

Choose a reason for hiding this comment

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

The tests should definitively get merged (even though there's a design decision to be made whether they should genuinely be in a separate directory or just be part of the cbmc/ folder. For the code there are a couple of questions for discussion, and linting is necessary.

@@ -400,6 +429,9 @@ void full_slicert::operator()(
Forall_goto_functions(f_it, goto_functions)
if(f_it->second.body_available())
{
if(f_it->first=="pthread_create")
throw "--full-slice does not support C/Pthreads yet";

Copy link
Collaborator

Choose a reason for hiding this comment

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

The indent seems wrong here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

{
// some variables are used during symbolic execution only

const irep_idt &statement=target->code.get(ID_statement);
if (statement==ID_array_copy) return true;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why does array_copy need to be singled out?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See #260. There are two test cases that expose this bug in the full slicer: realloc1 and realloc2. If we do not add that check, the full slicer incorrectly cuts all expressions related to array_copy.

@@ -322,18 +329,38 @@ Function: implicit

\*******************************************************************/

static bool implicit(goto_programt::const_targett target)
static bool implicit(const namespacet &ns, goto_programt::const_targett target)
{
// some variables are used during symbolic execution only
Copy link
Collaborator

Choose a reason for hiding this comment

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

This function now seems to be doing a lot more than what it originally was intended for!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have added an explanation in #260. As I reported in the issue, I'm not completely sure whether this is correct or not.

const irep_idt &statement=target->code.get(ID_statement);
if (statement==ID_array_copy) return true;

if (target->is_assume()) return true;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is that the case? It should not be forced into the slice when there is a control dependency on the condition represented by the assume. Except for bugs, the control-dependency code should be handling this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The control-flow dependency code is not handling this. Should we open a bug for this issue then?

if(!target->is_assign()) return false;

const code_assignt &a=to_code_assign(target->code);
if(a.lhs().id()==ID_dereference) return true;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This seems excessive.

if(a.lhs().id()!=ID_symbol) return false;

const symbol_exprt &s=to_symbol_expr(a.lhs());

return s.get_identifier()==CPROVER_PREFIX "rounding_mode";
if (s.source_location().get_function().empty())
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this restriction required?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We were incorrectly slicing all global variables inside the __CPROVER_initialize function. Specifically, the call to s.source_location().get_function().empty() returns true for __CPROVER_initialize function.

Copy link
Collaborator

Choose a reason for hiding this comment

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

The fact that those variables have been wrongly sliced away is a bug, and I'm not sure it actually exists any longer - the bugfix should be via 50383ed. Can you confirm that this change is still necessary?


// static lifetime?
if(ns.lookup(s.get_identifier()).is_static_lifetime)
return true;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why can't those variables not be sliced away?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The problem is that we were slicing all global variables inside the __CPROVER_initialize function. This was causing a large number of incorrect results for the full-slice option.

Copy link
Collaborator

Choose a reason for hiding this comment

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

See above - I think this has been fixed via 50383ed.

// add generic checks
status() << "Generic Property Instrumentation" << eom;
goto_check(ns, options, goto_functions);

Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this code new?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here we have to ensure that we call the full-slice option just after instrumenting the code with goto_check; otherwise, we the full-slice cuts all assignments that are relevant to checking a given property.

it!=d_node.in.end();
++it)
add_to_queue(queue, dep_node_to_cfg[it->first], node.PC);
if (dep_graph.state_exist(node.PC))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it truly possible that a state doesn't exist?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -274,6 +274,14 @@ class ait:public ai_baset
ai_baset::clear();
}

// this one just finds states
virtual const bool state_exist(locationt l) const
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this should be state_exists (with an s)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kroening
Copy link
Member

@lucasccordeiro perhaps as a first easy step, may I have a separate PR for the tests, please?

@lucasccordeiro
Copy link
Contributor Author

@kroening and @tautschnig: I have just created PR #479 to add test cases to check the full-slice option. In particular, I have added all test cases into the cbmc regression suite to make sure that we always test the full-slice option.

@forejtv
Copy link
Contributor

forejtv commented Apr 4, 2017

@lucasccordeiro can you rebase, please?

@lucasccordeiro
Copy link
Contributor Author

@forejtv: I have created a set of small PRs related to this large PR. We had 5 small PRs ( 211cb90, 27227cc, e70aa7d, ad384f1, b4ae916) that were already merged about this large PR. I intend to go back to this work once I fix the issues assigned to me for the GS upgrade.

@lucasccordeiro lucasccordeiro changed the title Siemens fix260 squashed Siemens fix260 squashed (do not merge) Jul 4, 2017
@tautschnig tautschnig changed the base branch from master to develop August 22, 2017 12:35
smowton pushed a commit to smowton/cbmc that referenced this pull request May 9, 2018
SEC-16: Preparation steps for load analysed web apps with libraries included.
@hannes-steffenhagen-diffblue
Copy link
Contributor

Closing for now, the PR description doesn't make it clear what the added value for this and there's been no movement on this PR since 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.

5 participants