Skip to content

Commit

Permalink
Merge branch 'hotfix-1.8.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
zvonimir committed Aug 27, 2017
2 parents 9739700 + 3d8c4d3 commit 5d79b66
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#---------------------------------------------------------------------------
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = smack
PROJECT_NUMBER = 1.8.0
PROJECT_NUMBER = 1.8.1
PROJECT_BRIEF = "A bounded software verifier."
PROJECT_LOGO =
OUTPUT_DIRECTORY = docs
Expand Down
2 changes: 1 addition & 1 deletion bin/package-smack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Note: this script requires CDE to be downloaded from
# http://www.pgbovine.net/cde.html

VERSION=1.8.0
VERSION=1.8.1
PACKAGE=smack-$VERSION-64

# Create folder to export
Expand Down
2 changes: 1 addition & 1 deletion bin/versions
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
MONO_VERSION=5.0.0.100
BOOGIE_COMMIT=4e4c3a5252
CORRAL_COMMIT=874a078e39
CORRAL_COMMIT=6f6926e3bb
LOCKPWN_COMMIT=a4d802a1cb
26 changes: 24 additions & 2 deletions lib/smack/SmackRep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -978,7 +978,14 @@ std::string SmackRep::getPrelude() {
s << "// Memory address bounds" << "\n";
s << Decl::axiom(Expr::eq(Expr::id(Naming::GLOBALS_BOTTOM),pointerLit(globalsBottom))) << "\n";
s << Decl::axiom(Expr::eq(Expr::id(Naming::EXTERNS_BOTTOM),pointerLit(externsBottom))) << "\n";
s << Decl::axiom(Expr::eq(Expr::id(Naming::MALLOC_TOP),pointerLit((unsigned long) INT_MAX - 10485760))) << "\n";
unsigned long malloc_top;
if (ptrSizeInBits == 32)
malloc_top = 2147483647UL;
else if (ptrSizeInBits == 64)
malloc_top = 9223372036854775807UL;
else
llvm_unreachable("Unexpected pointer bit width.");
s << Decl::axiom(Expr::eq(Expr::id(Naming::MALLOC_TOP),pointerLit(malloc_top))) << "\n";
s << "\n";

if (SmackOptions::MemorySafety) {
Expand All @@ -994,8 +1001,23 @@ std::string SmackRep::getPrelude() {
std::string b = std::to_string(ptrSizeInBits);
std::string bt = "bv" + b;
std::string it = "i" + b;
s << Decl::function(indexedName("$bv2int",{ptrSizeInBits}), {{"i",bt}}, it, NULL, {Attr::attr("builtin", "bv2int")}) << "\n";
s << Decl::function(indexedName("$int2bv",{ptrSizeInBits}), {{"i",it}}, bt, NULL, {Attr::attr("builtin", "(_ int2bv " + b + ")")}) << "\n";
if (SmackOptions::BitPrecise) {
s << Decl::function(indexedName("$bv2uint",{ptrSizeInBits}), {{"i",bt}}, it, NULL, {Attr::attr("builtin", "bv2int")}) << "\n";
const Expr* arg = Expr::id("i");
const Expr* uint = Expr::fn(indexedName("$bv2uint", {ptrSizeInBits}), arg);
std::string offset;
if (ptrSizeInBits == 32)
offset = "4294967296";
else if (ptrSizeInBits == 64)
offset = "18446744073709551616";
else
llvm_unreachable("Unexpected pointer bit width.");
s << Decl::function(indexedName("$bv2int",{ptrSizeInBits}), {{"i",bt}}, it,
Expr::cond(Expr::fn(indexedName("$slt", {bt, "bool"}), {arg, Expr::lit(0UL, ptrSizeInBits)}),
Expr::fn(indexedName("$sub", {it}), {uint, Expr::lit(offset, 0U)}), uint), {Attr::attr("inline")});
} else
s << Decl::function(indexedName("$bv2int",{ptrSizeInBits}), {{"i",bt}}, it, NULL, {Attr::attr("builtin", "bv2int")}) << "\n";
s << "\n";

if (SmackOptions::BitPrecise) {
Expand Down
6 changes: 4 additions & 2 deletions share/smack/lib/smack.c
Original file line number Diff line number Diff line change
Expand Up @@ -2056,7 +2056,8 @@ void __SMACK_decls() {
" p := $CurrAddr;\n"
" havoc $CurrAddr;\n"
" if ($sgt.ref.bool(n, $0.ref)) {\n"
" assume $sle.ref.bool($add.ref(p, n), $CurrAddr);\n"
" assume $sge.ref.bool($sub.ref($CurrAddr, n), p);\n"
" assume $sgt.ref.bool($CurrAddr, $0.ref) && $slt.ref.bool($CurrAddr, $MALLOC_TOP);\n"
" assume $Size(p) == n;\n"
" assume (forall q: ref :: {$base(q)} $sle.ref.bool(p, q) && $slt.ref.bool(q, $add.ref(p, n)) ==> $base(q) == p);\n"
" } else {\n"
Expand Down Expand Up @@ -2159,7 +2160,8 @@ void __SMACK_decls() {
" p := $CurrAddr;\n"
" havoc $CurrAddr;\n"
" if ($sgt.ref.bool(n, $0.ref)) {\n"
" assume $sle.ref.bool($add.ref(p, n), $CurrAddr);\n"
" assume $sge.ref.bool($sub.ref($CurrAddr, n), p);\n"
" assume $sgt.ref.bool($CurrAddr, $0.ref) && $slt.ref.bool($CurrAddr, $MALLOC_TOP);\n"
" } else {\n"
" assume $sle.ref.bool($add.ref(p, $1.ref), $CurrAddr);\n"
" }\n"
Expand Down
2 changes: 1 addition & 1 deletion share/smack/reach.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from smackgen import *
from smackverify import *

VERSION = '1.8.0'
VERSION = '1.8.1'

def reachParser():
parser = argparse.ArgumentParser(add_help=False, parents=[verifyParser()])
Expand Down
35 changes: 26 additions & 9 deletions share/smack/svcomp/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ def is_crappy_driver_benchmark(args, bpl):
while (True):
pass

def force_timeout():
sys.stdout.flush()
time.sleep(1000)

def verify_bpl_svcomp(args):
"""Verify the Boogie source file using SVCOMP-tuned heuristics."""
heurTrace = "\n\nHeuristics Info:\n"
Expand Down Expand Up @@ -329,6 +333,14 @@ def verify_bpl_svcomp(args):
if not args.quiet:
error = smack.top.error_trace(verifier_output, args)
print error
if args.memory_safety:
heurTrace += (args.prop_to_check + "has errors\n")
if args.prop_to_check == 'valid-free':
if args.valid_deref_check_result != 'verified':
force_timeout()
elif args.prop_to_check == 'memleak':
if args.valid_free_check_result == 'timeout':
force_timeout()

elif result == 'timeout': #normal inlining
heurTrace += "Timed out during normal inlining.\n"
Expand Down Expand Up @@ -370,10 +382,11 @@ def verify_bpl_svcomp(args):
heurTrace += (args.prop_to_check + "is verified\n")
if args.prop_to_check == 'valid-deref':
args.valid_deref_check_result = 'verified'
if args.prop_to_check == 'memleak':
elif args.prop_to_check == 'valid-free':
args.valid_free_check_result = 'verified'
elif args.prop_to_check == 'memleak':
if args.valid_deref_check_result == 'timeout':
sys.stdout.flush()
time.sleep(1000)
force_timeout()
else:
sys.exit(smack.top.results(args)[args.valid_deref_check_result])
verify_bpl_svcomp(args)
Expand All @@ -391,10 +404,12 @@ def verify_bpl_svcomp(args):
heurTrace += (args.prop_to_check + " times out\n")
if args.prop_to_check == 'valid-deref':
args.valid_deref_check_result = 'timeout'
if args.prop_to_check == 'memleak':
force_timeout()
elif args.prop_to_check == 'valid-free':
args.valid_free_check_result = 'timeout'
elif args.prop_to_check == 'memleak':
if args.valid_deref_check_result == 'timeout':
sys.stdout.flush()
time.sleep(1000)
force_timeout()
else:
sys.exit(smack.top.results(args)[args.valid_deref_check_result])
verify_bpl_svcomp(args)
Expand All @@ -411,10 +426,11 @@ def verify_bpl_svcomp(args):
heurTrace += (args.prop_to_check + " is verified\n")
if args.prop_to_check == 'valid-deref':
args.valid_deref_check_result = 'verified'
if args.prop_to_check == 'memleak':
elif args.prop_to_check == 'valid-free':
args.valid_free_check_result = 'verified'
elif args.prop_to_check == 'memleak':
if args.valid_deref_check_result == 'timeout':
sys.stdout.flush()
time.sleep(1000)
force_timeout()
else:
sys.exit(smack.top.results(args)[args.valid_deref_check_result])
verify_bpl_svcomp(args)
Expand All @@ -423,6 +439,7 @@ def verify_bpl_svcomp(args):
sys.exit(smack.top.results(args)[result])

def write_error_file(args, status, verifier_output):
return
if args.memory_safety or status == 'timeout' or status == 'unknown':
return
hasBug = (status != 'verified')
Expand Down
2 changes: 1 addition & 1 deletion share/smack/top.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from utils import temporary_file, try_command, remove_temp_files
from replay import replay_error_trace

VERSION = '1.8.0'
VERSION = '1.8.1'

def frontends():
"""A dictionary of front-ends per file extension."""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def version(self, executable):
Sets the version number for SMACK, which gets displayed in the "Tool" row
in BenchExec table headers.
"""
return '1.8.0'
return '1.8.1'

def name(self):
"""
Expand Down

0 comments on commit 5d79b66

Please sign in to comment.