Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
135 commits
Select commit Hold shift + click to select a range
ffae884
Add DisjointSetUnion
dim8art Aug 20, 2023
850ae7f
Rework IndependentSolver using persistent DSU
dim8art Aug 20, 2023
15bd87d
Reworking ConcretizingSolver
dim8art Aug 20, 2023
3316cb0
Add persistency to Assignment
dim8art Aug 20, 2023
f72486f
Rework solver chain + small refactoring changes
dim8art Aug 20, 2023
9a96f85
[fix] Solvers performance fixes
Columpio Aug 15, 2023
7f5db38
[feat] Z3 Tree incremental solver
Columpio Sep 12, 2023
2428e2b
[feat] Improve `TargetCalculator`
misonijnik Sep 12, 2023
2d8e12b
[refactor] `CodeGraphDistance` -> `CodeGraphInfo`
misonijnik Sep 14, 2023
4486529
[feat] Improve `only-output-states-covering-new` option
misonijnik Sep 15, 2023
d3344b5
[feat] Add `cover-on-the-fly` option
misonijnik Sep 16, 2023
8d69a9f
[fix] Make `isReachedTarget` consistent with `reportTruePositive`
misonijnik Sep 18, 2023
fcfef9d
Created shadow copy of errno in 32bit space to work with 32bit programs.
S1eGa Aug 18, 2023
0a16747
Added building of uClibc for 32 and 64-bit archs.
S1eGa Aug 21, 2023
12c647a
[feat] tc support
S1eGa Jul 25, 2023
97cd057
[fix] float and double symbolics
S1eGa Jul 27, 2023
c54358b
[fix] z3-tree with 0 size pool
Columpio Sep 21, 2023
dff6af1
[refactor] Use `bit_suffix` explicit
misonijnik Sep 21, 2023
e1a57bb
[fix] Fix a few bugs
misonijnik Sep 20, 2023
026da46
[fix] Make the tests independent of default search strategies
misonijnik Sep 21, 2023
aa7528b
[fix] Incremental DT with no frames
Columpio Sep 26, 2023
8de31b5
[fix] Improve `IndependentConstraintSetUnion`
misonijnik Sep 22, 2023
847ed62
[feat] Add optimization in case all constraints are dependent
misonijnik Sep 25, 2023
3fae575
[fix] Rebuild constraint dsu after constraints simplification
misonijnik Sep 29, 2023
a0bb3ca
[fix] Fix MemorySubobject warning
misonijnik Sep 27, 2023
390866f
[fix] Fix `CachingSolver`
misonijnik Sep 27, 2023
f5f7574
[fix] Tests for states with mocks
Columpio Oct 2, 2023
37f0da6
Memory optimize, remove InstructionInfoTable, add immutable list for …
ladisgin Aug 15, 2023
90e8cbf
[feat] uint128
Columpio Oct 4, 2023
27b6ed1
[chore] Optimized KBlock mem
Columpio Oct 5, 2023
2dc5efa
[fix] Error testcase processing doesn't affect `coveredNew`
misonijnik Oct 5, 2023
16155cd
[fix] Fix `computeValidity` in partial response case
misonijnik Oct 5, 2023
c934eb7
[chore] Disable test
misonijnik Oct 5, 2023
4ac9163
[chore] Add a test
misonijnik Oct 5, 2023
532bcff
[chore] Add an option to disable loop deletion pass
misonijnik Oct 5, 2023
8798ea5
[fix] Fix stats
misonijnik Oct 5, 2023
d5095be
[feat] Differentiate `isCoveredNew` and `isCoveredNewError`
misonijnik Oct 6, 2023
c9c1419
[chore] Z3 is not required in a lot of tests, so remove the requirements
misonijnik Oct 6, 2023
f1e8720
[feat] Improved Iterative Deepening Searcher
Columpio Oct 10, 2023
ca88a99
[fix] Fixed inner types for unnamed structs.
S1eGa Oct 12, 2023
2171ce3
[feat] Separate branch and block coverage
misonijnik Sep 22, 2023
d0e280b
[chore] Update build.sh
misonijnik Oct 16, 2023
cdc1f7f
[feat] Prefer a smaller integer vaule in a model
misonijnik Oct 16, 2023
bfaabef
[chore] Optimized IterativeDeepeningSearcher
Columpio Oct 20, 2023
febf79d
[chore] Optimized getDistance
Columpio Oct 20, 2023
4d9ad3e
[chore] Strip llvm.dbg.declare
Columpio Oct 20, 2023
d5ff4df
[fix] Compare exprs by height in simplifier
ocelaiwo Oct 20, 2023
c3553c0
[feat] Uninitialized Memory [feat] Sizeless ObjectState
ocelaiwo Oct 17, 2023
6408e41
[chore] Disable test
misonijnik Oct 21, 2023
c70df43
[fix] Fix performance bugs
misonijnik Oct 22, 2023
341510c
[fix] Change satisfies function in InvalidReponse
dim8art Oct 21, 2023
c4f7c5c
Change CacheEntry to store constraints_ty
dim8art Oct 21, 2023
001f9ef
Create AlphaEquvalenceSolver
dim8art Oct 21, 2023
8529980
[fix] Propagation of without filter
Columpio Oct 23, 2023
ecfca38
[fix] Small fixes
Columpio Oct 23, 2023
8991cbc
[fix] Generate test only for successful solution found
misonijnik Oct 24, 2023
0583657
[chore] Deal with compiler warnings
Columpio Oct 24, 2023
d8ff87b
[feat] Cover on the fly based on time
Columpio Oct 24, 2023
d74463a
[fix] rewriting ordering for terms with equal height
Columpio Oct 24, 2023
b4fbe6d
[fix] Update test
misonijnik Oct 24, 2023
6569119
[feat] Removed unwanted calls pass
Columpio Oct 25, 2023
1e08227
[fix] Filter objects and values in `changeVersion`
misonijnik Oct 25, 2023
200db1d
[fix] Clean memory operations
misonijnik Oct 26, 2023
0cb981d
[fix] Fix `AlphaEquivalenceSolver`
misonijnik Oct 27, 2023
0a80185
[fix] Halt when LLVM passes already proved unreachability
Columpio Oct 27, 2023
803fabc
[chore] Update version and `README.md`
misonijnik Oct 30, 2023
8865af3
[fix] Improved call remover
Columpio Oct 31, 2023
06bfbc0
[feat] Add `OptimizeAggressive` option
misonijnik Nov 1, 2023
1a472d9
[feat] Getting the performance/memory consumption balance in `Disjoin…
misonijnik Nov 2, 2023
f14b8ac
[fix] Fix performance for unbalanced expressions
misonijnik Nov 2, 2023
1689ece
[refactor] Separate `isStuck` and `isCycled`, `isStuck` is smarter now
misonijnik Nov 2, 2023
ab185fe
[fix] Limit the cexPreferences size
misonijnik Nov 2, 2023
fa0c7b6
[fix] Remove unused field
misonijnik Nov 2, 2023
7c002e7
[fix] Fix memory consumption
misonijnik Nov 2, 2023
1b1e789
[feat] Enable `coverOnTheFly` after approaching memory cup
misonijnik Nov 2, 2023
2872586
[style]
misonijnik Nov 2, 2023
8b91d6a
[fix] Consider all not empty and not fully covered functions
misonijnik Nov 3, 2023
01ddb65
[fix] Fix perfomance bug
misonijnik Nov 3, 2023
9f054a9
[fix] Fix `isStuck`
misonijnik Nov 3, 2023
2477ed7
[fix] klee-test-comp.c
Columpio Nov 3, 2023
0cf7c49
[feat] Single-file run script
Columpio Nov 3, 2023
3b81fd8
[chore] Updated README
Columpio Nov 7, 2023
984f5e6
[feat] Improve coverage branches tests
misonijnik Nov 5, 2023
c57d898
[fix] `CexCachingSolver`
misonijnik Nov 6, 2023
16d8098
[fix] Slightly improve performance
misonijnik Nov 5, 2023
b394cb3
[fix] `AlphaEquivalenceSolver`
misonijnik Nov 7, 2023
14b89d4
[feat] Add `X86FPAsX87FP80`
misonijnik Nov 7, 2023
ee3b200
[chore] Update `scripts/kleef`
misonijnik Nov 7, 2023
ccf75c6
[chore] Disable `libc++` tests on msan run because they time out on CI
misonijnik Nov 8, 2023
08d24ad
[fix] Must consider the whole concretization
misonijnik Nov 8, 2023
2677745
[chore] Update `kleef` script
misonijnik Nov 10, 2023
82b0cfd
[chore] Update tests
misonijnik Nov 10, 2023
786bfa9
[feat] Added Bitwuzla solver in list of available solvers. Added scri…
S1eGa Nov 14, 2023
0d66ada
[fix] `MemoryTriggerCoverOnTheFly`
misonijnik Nov 12, 2023
2bfa518
[chore] Update `kleef`
misonijnik Nov 12, 2023
805f8c8
[fix] Optimized free-standing functions are broken
misonijnik Nov 13, 2023
25b4e29
[chore] Update `kleef` script
misonijnik Nov 10, 2023
fe9f1cf
[fix] Address may be symbolic but unique, try resolve firstly
misonijnik Nov 14, 2023
e5382b0
[fix] Put in order `fp-runtime` functions
misonijnik Nov 14, 2023
84134ae
[fix] Bring calls to `SparseStorage` constructor up to date
misonijnik Nov 15, 2023
9100331
[chore] Update `GuidedSearcher::selectState`
misonijnik Nov 15, 2023
feeb5d4
[fix] Convert all x86FP to x87FP80 in `FPToX87FP80Ext`
misonijnik Nov 17, 2023
d57dc78
[fix] Restore `newSize` in case `newSize > maxSize`
misonijnik Nov 17, 2023
ed7cbb3
[chore] `ExprEitherSymcrete` ->`ExprOrSymcrete`
misonijnik Nov 17, 2023
cb911fc
[fix] `AlphaBuilder`
misonijnik Nov 20, 2023
b8349ad
[fix] `CexCachingSolver`
misonijnik Nov 20, 2023
55e977a
[fix] SparseStorage::print
ocelaiwo Nov 11, 2023
515cc47
[fix] `sizeOfSetRange`
misonijnik Nov 20, 2023
5bfd840
[fix] Disable `AlignSymbolicPointers` by default
misonijnik Nov 21, 2023
df2b70e
[chore] Update scripts
misonijnik Nov 21, 2023
1ab3f77
[fix] Update test
misonijnik Nov 21, 2023
8101fa7
[chore] Install meson locally
misonijnik Nov 21, 2023
6182e7d
[fix] `X86FPAsX87FP80` should consider bitcasts too
misonijnik Nov 21, 2023
4dd078d
[fix] Preserve `floatReplacements`
misonijnik Nov 22, 2023
8745293
[chore] Update `kleef`
misonijnik Nov 22, 2023
4cb8421
[feat] Add new memory usage checks
ocelaiwo Nov 21, 2023
a731677
typo
dim8art Nov 21, 2023
096ccf3
Add lazy calculation of constraint dsu
dim8art Nov 21, 2023
f2ef004
[fix] Use `X87FP80ToFPTrunc` before `ZExt`
misonijnik Nov 22, 2023
5d2c06a
[fix] `X86FPAsX87FP80` should consider bitcasts by `X87FP80ToFPTrunc`
misonijnik Nov 22, 2023
9d6364c
[chore] Update options default values
misonijnik Nov 22, 2023
411b93c
[chore] Update `kleef`
misonijnik Nov 22, 2023
094b57d
[fix] Continue searching for the error if the state is not reproducible
misonijnik Nov 22, 2023
a0b773a
[chore] Update `kleef`
misonijnik Nov 22, 2023
6f0ef36
[feat] Added flag to dump all states if function specified in functio…
S1eGa Nov 22, 2023
2a48f60
[fix] `X86FPAsX87FP80` should consider bitcasts by `X87FP80ToFPTrunc`
misonijnik Nov 22, 2023
745251d
[chore] Update tests
misonijnik Nov 22, 2023
b576156
[chore] Update `build.sh`
misonijnik Nov 23, 2023
e38396f
[fixup]
misonijnik Nov 23, 2023
bb70564
"[chore] Update `build.sh`"
misonijnik Nov 23, 2023
9e66f06
[fix] Added flag to dump all states if function specified in function…
misonijnik Nov 23, 2023
3dc70a6
[chore] Update `kleef`
misonijnik Nov 23, 2023
b85dd69
[fix] Added flag to dump all states if function specified in function…
misonijnik Nov 23, 2023
f8cc447
[fix]
misonijnik Nov 23, 2023
6ea5f36
[chore] Update `kleef`
misonijnik Nov 23, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
13 changes: 12 additions & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,16 @@ env:
LLVM_VERSION: 11
MINISAT_VERSION: "master"
REQUIRES_RTTI: 0
SOLVERS: Z3:STP
SOLVERS: BITWUZLA:Z3:STP
STP_VERSION: 2.3.3
TCMALLOC_VERSION: 2.9.1
UCLIBC_VERSION: klee_uclibc_v1.3
USE_TCMALLOC: 1
USE_LIBCXX: 1
Z3_VERSION: 4.8.15
SQLITE_VERSION: 3400100
BITWUZLA_VERSION: main
BITWUZLA_COMMIT: 80ef7cd803e1c71b5939c3eb951f1736388f7090

jobs:
Linux:
Expand All @@ -48,6 +50,7 @@ jobs:
"Z3 only",
"metaSMT",
"STP master",
"Bitwuzla only",
"Latest klee-uclibc",
"Asserts disabled",
"No TCMalloc, optimised runtime",
Expand Down Expand Up @@ -109,6 +112,10 @@ jobs:
env:
SOLVERS: STP
STP_VERSION: master
# Test just using Bitwuzla only
- name: "Bitwuzla only"
env:
SOLVERS: BITWUZLA
# Check we can build latest klee-uclibc branch
- name: "Latest klee-uclibc"
env:
Expand Down Expand Up @@ -172,6 +179,7 @@ jobs:
name: [
"STP",
"Z3",
"Bitwuzla",
]
include:
- name: "STP"
Expand All @@ -180,6 +188,9 @@ jobs:
- name: "Z3"
env:
SOLVERS: Z3:STP
- name: "Bitwuzla"
env:
SOLVERS: BITWUZLA:Z3
env:
ENABLE_OPTIMIZED: 0
COVERAGE: 1
Expand Down
53 changes: 37 additions & 16 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ project(KLEE CXX C)
# Project version
###############################################################################
set(KLEE_VERSION_MAJOR 3)
set(KLEE_VERSION_MINOR 0-utbot)
set(KLEE_VERSION_MINOR 0)
set(KLEE_VERSION "${KLEE_VERSION_MAJOR}.${KLEE_VERSION_MINOR}")

# If a patch is needed, we can add KLEE_VERSION_PATCH
# set(KLEE_VERSION_PATCH 0)
# set(KLEE_VERSION "${KLEE_VERSION_MAJOR}.${KLEE_VERSION_MINOR}.${KLEE_VERSION_PATCH}")

message(STATUS "KLEE version ${KLEE_VERSION}")
set(PACKAGE_STRING "\"KLEE ${KLEE_VERSION}\"")
set(PACKAGE_URL "\"https://klee.github.io\"")
message(STATUS "KLEEF version ${KLEE_VERSION}")
set(PACKAGE_STRING "\"KLEEF ${KLEE_VERSION}\"")
set(PACKAGE_URL "\"https://toolchain-labs.com/projects/kleef.html\"")

################################################################################
# Sanity check - Disallow building in source.
Expand Down Expand Up @@ -204,14 +204,19 @@ include(${CMAKE_SOURCE_DIR}/cmake/find_stp.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/find_z3.cmake)
# metaSMT
include(${CMAKE_SOURCE_DIR}/cmake/find_metasmt.cmake)
# bitwuzla
include(${CMAKE_SOURCE_DIR}/cmake/find_bitwuzla.cmake)

if ((NOT ${ENABLE_Z3}) AND (NOT ${ENABLE_STP}) AND (NOT ${ENABLE_METASMT}))

if ((NOT ${ENABLE_Z3}) AND (NOT ${ENABLE_STP}) AND (NOT ${ENABLE_METASMT}) AND (NOT ${ENABLE_BITWUZLA}))
message(FATAL_ERROR "No solver was specified. At least one solver is required."
"You should enable a solver by passing one of more the following options"
" to cmake:\n"
"\"-DENABLE_SOLVER_STP=ON\"\n"
"\"-DENABLE_SOLVER_Z3=ON\"\n"
"\"-DENABLE_SOLVER_METASMT=ON\"")
"\"-DENABLE_SOLVER_BITWUZLA=ON\"\n"
"\"-DENABLE_SOLVER_METASMT=ON\"
")
endif()

###############################################################################
Expand Down Expand Up @@ -473,10 +478,10 @@ endif()
################################################################################
option(ENABLE_FLOATING_POINT "Enable KLEE's floating point extension" OFF)
if (ENABLE_FLOATING_POINT)
if (NOT ${ENABLE_Z3})
if ((NOT ${ENABLE_Z3}) AND (NOT ${ENABLE_BITWUZLA}))
message (FATAL_ERROR "Floating point extension is availible only when using Z3 backend."
"You should enable Z3 by passing the following option to cmake:\n"
"\"-DENABLE_SOLVER_Z3=ON\"\n")
"You should enable either Z3 or Bitwuzla by passing the following options to cmake, respectively:\n"
"\"-DENABLE_SOLVER_Z3=ON\" or \"-DENABLE_SOLVER_BITWUZLA=ON\"\n")
else()
set(ENABLE_FP 1) # For config.h
message(STATUS "Floating point extension enabled")
Expand Down Expand Up @@ -506,19 +511,29 @@ endif()
# KLEE uclibc support
################################################################################
set(KLEE_UCLIBC_PATH "" CACHE PATH "Path to klee-uclibc root directory")
set(KLEE_UCLIBC_BCA_NAME "klee-uclibc.bca")

set(KLEE_UCLIBC_BCA_32_NAME "klee-uclibc-32.bca")
set(KLEE_UCLIBC_BCA_64_NAME "klee-uclibc-64.bca")

if (NOT KLEE_UCLIBC_PATH STREQUAL "")
# Find the C library bitcode archive
set(KLEE_UCLIBC_C_BCA "${KLEE_UCLIBC_PATH}/lib/libc.a")
if (NOT EXISTS "${KLEE_UCLIBC_C_BCA}")
set(KLEE_UCLIBC_C_32_BCA "${KLEE_UCLIBC_PATH}-32/lib/libc.a")
set(KLEE_UCLIBC_C_64_BCA "${KLEE_UCLIBC_PATH}-64/lib/libc.a")

if (NOT EXISTS "${KLEE_UCLIBC_C_32_BCA}" OR NOT EXISTS "${KLEE_UCLIBC_C_64_BCA}")
message(FATAL_ERROR
"klee-uclibc library not found at \"${KLEE_UCLIBC_C_BCA}\". Set KLEE_UCLIBC_PATH to klee-uclibc root directory or empty string.")
"klee-uclibc library not found at \"${KLEE_UCLIBC_C_32_BCA}\" or \"${KLEE_UCLIBC_C_64_BCA}\". Set KLEE_UCLIBC_PATH to klee-uclibc root directory or empty string.")
endif()
message(STATUS "Found klee-uclibc library: \"${KLEE_UCLIBC_C_BCA}\"")
message(STATUS "Found klee-uclibc library: \"${KLEE_UCLIBC_C_32_BCA}\" and \"${KLEE_UCLIBC_C_64_BCA}\"")
# Copy KLEE_UCLIBC_C_BCA so KLEE can find it where it is expected.
# Create 32 and 64 bit versions
execute_process(COMMAND ${CMAKE_COMMAND} -E copy
"${KLEE_UCLIBC_C_BCA}"
"${KLEE_RUNTIME_DIRECTORY}/${KLEE_UCLIBC_BCA_NAME}"
"${KLEE_UCLIBC_C_32_BCA}"
"${KLEE_RUNTIME_DIRECTORY}/${KLEE_UCLIBC_BCA_32_NAME}"
)
execute_process(COMMAND ${CMAKE_COMMAND} -E copy
"${KLEE_UCLIBC_C_64_BCA}"
"${KLEE_RUNTIME_DIRECTORY}/${KLEE_UCLIBC_BCA_64_NAME}"
)
else()
message(STATUS "Skipping copying of klee-uclibc runtime")
Expand Down Expand Up @@ -633,6 +648,12 @@ unset(_flags)
configure_file(${CMAKE_SOURCE_DIR}/include/klee/Config/config.h.cmin
${CMAKE_BINARY_DIR}/include/klee/Config/config.h)

################################################################################
# Generate `klee/klee.h` and `klee-test-comp.c`
################################################################################
configure_file(${CMAKE_SOURCE_DIR}/include/klee/klee.h ${CMAKE_BINARY_DIR}/include/klee/klee.h COPYONLY)
configure_file(${CMAKE_SOURCE_DIR}/include/klee-test-comp.c ${CMAKE_BINARY_DIR}/include/klee-test-comp.c COPYONLY)

################################################################################
# Generate `CompileTimeInfo.h`
################################################################################
Expand Down
28 changes: 5 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,9 @@
KLEE Symbolic Virtual Machine
KLEEF Symbolic Virtual Machine
=============================

[![Build Status](https://github.com/klee/klee/workflows/CI/badge.svg)](https://github.com/klee/klee/actions?query=workflow%3ACI)
[![Build Status](https://api.cirrus-ci.com/github/klee/klee.svg)](https://cirrus-ci.com/github/klee/klee)
[![Coverage](https://codecov.io/gh/klee/klee/branch/master/graph/badge.svg)](https://codecov.io/gh/klee/klee)
[![Build Status](https://github.com/UnitTestBot/klee/workflows/CI/badge.svg)](https://github.com/UnitTestBot/klee/actions?query=workflow%3ACI)
[![Coverage](https://codecov.io/gh/UnitTestBot/klee/branch/main/graph/badge.svg)](https://codecov.io/gh/UnitTestBot/klee)

`KLEE` is a symbolic virtual machine built on top of the LLVM compiler
infrastructure. Currently, there are two primary components:
`KLEEF` is a complete overhaul of the KLEE symbolic execution engine for LLVM, fine-tuned for a robust analysis of industrial C/C++ code.

1. The core symbolic virtual machine engine; this is responsible for
executing LLVM bitcode modules with support for symbolic
values. This is comprised of the code in lib/.

2. A POSIX/Linux emulation layer oriented towards supporting uClibc,
with additional support for making parts of the operating system
environment symbolic.

Additionally, there is a simple library for replaying computed inputs
on native code (for closed programs). There is also a more complicated
infrastructure for replaying the inputs generated for the POSIX/Linux
emulation layer, which handles running native programs in an
environment that matches a computed test input, including setting up
files, pipes, environment variables, and passing command line
arguments.

For further information, see the [webpage](http://klee.github.io/).
For further information, see the [webpage](https://toolchain-labs.com/projects/kleef.html).
10 changes: 7 additions & 3 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ SQLITE_VERSION="3400100"
## LLVM Required options
LLVM_VERSION=14
ENABLE_OPTIMIZED=1
ENABLE_DEBUG=1
ENABLE_DEBUG=0
DISABLE_ASSERTIONS=1
REQUIRES_RTTI=1

## Solvers Required options
# SOLVERS=STP
SOLVERS=STP:Z3
SOLVERS=BITWUZLA:Z3:STP

## Google Test Required options
GTEST_VERSION=1.11.0
Expand All @@ -46,7 +46,11 @@ UCLIBC_VERSION=klee_uclibc_v1.3

## Z3 Required options
Z3_VERSION=4.8.15

STP_VERSION=2.3.3
MINISAT_VERSION=master

BASE="$BASE" KLEE_RUNTIME_BUILD=$KLEE_RUNTIME_BUILD COVERAGE=$COVERAGE ENABLE_DOXYGEN=$ENABLE_DOXYGEN USE_TCMALLOC=$USE_TCMALLOC USE_LIBCXX=$USE_LIBCXX LLVM_VERSION=$LLVM_VERSION ENABLE_OPTIMIZED=$ENABLE_OPTIMIZED ENABLE_DEBUG=$ENABLE_DEBUG DISABLE_ASSERTIONS=$DISABLE_ASSERTIONS REQUIRES_RTTI=$REQUIRES_RTTI SOLVERS=$SOLVERS GTEST_VERSION=$GTEST_VERSION UCLIBC_VERSION=$UCLIBC_VERSION STP_VERSION=$STP_VERSION MINISAT_VERSION=$MINISAT_VERSION Z3_VERSION=$Z3_VERSION SQLITE_VERSION=$SQLITE_VERSION ./scripts/build/build.sh klee --install-system-deps
BITWUZLA_VERSION=main
BITWUZLA_COMMIT=80ef7cd803e1c71b5939c3eb951f1736388f7090

BASE="$BASE" KLEE_RUNTIME_BUILD=$KLEE_RUNTIME_BUILD COVERAGE=$COVERAGE ENABLE_DOXYGEN=$ENABLE_DOXYGEN USE_TCMALLOC=$USE_TCMALLOC USE_LIBCXX=$USE_LIBCXX LLVM_VERSION=$LLVM_VERSION ENABLE_OPTIMIZED=$ENABLE_OPTIMIZED ENABLE_DEBUG=$ENABLE_DEBUG DISABLE_ASSERTIONS=$DISABLE_ASSERTIONS REQUIRES_RTTI=$REQUIRES_RTTI SOLVERS=$SOLVERS GTEST_VERSION=$GTEST_VERSION UCLIBC_VERSION=$UCLIBC_VERSION STP_VERSION=$STP_VERSION MINISAT_VERSION=$MINISAT_VERSION Z3_VERSION=$Z3_VERSION BITWUZLA_VERSION=$BITWUZLA_VERSION BITWUZLA_COMMIT=$BITWUZLA_COMMIT SQLITE_VERSION=$SQLITE_VERSION ./scripts/build/build.sh klee --install-system-deps
46 changes: 46 additions & 0 deletions cmake/find_bitwuzla.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#===------------------------------------------------------------------------===#
#
# The KLEE Symbolic Virtual Machine
#
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
#===------------------------------------------------------------------------===#

find_package (PkgConfig REQUIRED)
pkg_check_modules(BITWUZLA IMPORTED_TARGET bitwuzla)

# Set the default so that if the following is true:
# * Bitwuzla was found
# * ENABLE_SOLVER_BITWUZLA is not already set as a cache variable
#
# then the default is set to `ON`. Otherwise set the default to `OFF`.
# A consequence of this is if we fail to detect Bitwuzla the first time
# subsequent calls to CMake will not change the default.

if(BITWUZLA_FOUND)
set(ENABLE_SOLVER_BITWUZLA_DEFAULT ON)
else()
set(ENABLE_SOLVER_BITWUZLA_DEFAULT OFF)
endif()

option(ENABLE_SOLVER_BITWUZLA "Enable Bitwuzla solver support" ${ENABLE_SOLVER_BITWUZLA_DEFAULT})

if (ENABLE_SOLVER_BITWUZLA)
message(STATUS "Bitwuzla solver support enabled")
if (BITWUZLA_FOUND)
message(STATUS "Found Bitwuzla")
set(ENABLE_BITWUZLA 1) # For config.h

list(APPEND KLEE_COMPONENT_EXTRA_INCLUDE_DIRS ${BITWUZLA_INCLUDE_DIRS})
list(APPEND KLEE_SOLVER_LIBRARIES ${BITWUZLA_LINK_LIBRARIES})
list(APPEND KLEE_SOLVER_INCLUDE_DIRS ${BITWUZLA_INCLUDE_DIRS})
list(APPEND KLEE_SOLVER_LIBRARY_DIRS ${BITWUZLA_LINK_LIBRARIES})

else()
message(FATAL_ERROR "Bitwuzla not found.")
endif()
else()
message(STATUS "Bitwuzla solver support disabled")
set(ENABLE_BITWUZLA 0) # For config.h
endif()
17 changes: 14 additions & 3 deletions include/klee-test-comp.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,42 @@
//
//===----------------------------------------------------------------------===//

#include <stdint.h>
#ifdef EXTERNAL
#include "klee.h"
#include <assert.h>
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#else
void klee_make_symbolic(void *addr, unsigned int nbytes, const char *name);
void klee_assume(_Bool condition);
__attribute__((noreturn)) void klee_silent_exit(int status);
void __assert_fail(const char *assertion, const char *file, unsigned int line,
const char *function);
void klee_prefer_cex(void *, uintptr_t);
#endif

int __VERIFIER_nondet_int(void) {
int x;
klee_make_symbolic(&x, sizeof(x), "int");
klee_prefer_cex(&x, x < 1024);
return x;
}

unsigned int __VERIFIER_nondet_uint(void) {
unsigned int x;
klee_make_symbolic(&x, sizeof(x), "unsigned int");
klee_prefer_cex(&x, x < 1024);
return x;
}

#ifdef __x86_64__
unsigned __int128 __VERIFIER_nondet_uint128(void) {
unsigned __int128 x;
klee_make_symbolic(&x, sizeof(x), "unsigned __int128");
return x;
}
#endif

unsigned __VERIFIER_nondet_unsigned(void) {
unsigned x;
Expand Down Expand Up @@ -82,7 +93,7 @@ unsigned long __VERIFIER_nondet_ulong(void) {
}

double __VERIFIER_nondet_double(void) {
long x;
double x;
klee_make_symbolic(&x, sizeof(x), "double");
return x;
}
Expand All @@ -96,7 +107,7 @@ void *__VERIFIER_nondet_pointer(void) {
}

float __VERIFIER_nondet_float(void) {
int x;
float x;
klee_make_symbolic(&x, sizeof(x), "float");
return x;
}
Expand Down
Loading