Project

General

Profile

Actions

Bug #1970

closed

Nondetermined variable intitialization is not performed

Added by Pavel Shved about 13 years ago. Updated almost 13 years ago.

Status:
Closed
Priority:
High
Assignee:
Category:
-
Target version:
Start date:
11/06/2011
Due date:
% Done:

0%

Estimated time:
Detected in build:
svn
Platform:
Published in build:

Description

At the Competition on Software Verification 2012, the functions that return a nondetermined value at each call are assumed to have the same behavior as this function:

X __VERIFIER_nondet_X() { X val; return val; }

However, if this definition is actually in the source code, BLAST doesn't think it's undetermined. Instead, it thinks that all invocations of such a function return the same value!

This bug leads to false safes, so it should be fixed. In competition setup we lose 10 points because of this, and could have lost 30 points more if the presence of this definition hadn't made several ssh* tests time out instead of failing with a wrong verdict.

To check for this behavior, I added a test: source:tests/files/nondet_definition.c

How to fix it?

According to C standards (as per this StackOverflow answer), a variable inside a function that is uninitialized at declaration gets an undetermined value. However, the function listed above is transformed by CIL to a CFG with one edge with a Return() operation on it. Return operation, by definition, works with Expressions rather than with Lvalues, so it can't be used for updating the Lvalue it returns in our case.

I guess, the proper solution is to update local variable maps at function calls.

And I suddenly recalled that I've already "fixed" something about variable maps at function calls. In bug #1684, there was a functionality that cleared these maps at each function call, but I removed it because it interfered with alias analysis badly.

So, we need to revamp the fix of #1684, and create a consistent approach to local variable mappings that suits both aliases and such cases as in the test linked above. Maybe, we may implement port something from "non-flat" algorithms described in "Abstractions from Proofs"...


Files

bad_s3.c (69.5 KB) bad_s3.c ssh test as in competition Pavel Shved, 12/28/2011 12:57 AM
good_bad_s3.c (69.5 KB) good_bad_s3.c "fixed" ssh test that should pass if the reason is nondet functon Pavel Shved, 12/28/2011 12:57 AM

Related issues 1 (0 open1 closed)

Related to BLAST - Bug #1684: BLAST incorrectly updates lvalue indexes when converting to SSA with recursion enabled!ClosedPavel Shved08/24/2011

Actions
Actions

Also available in: Atom PDF