diff options
| author | Tomasz Kuchta <t.kuchta@samsung.com> | 2023-10-12 09:51:24 +0200 |
|---|---|---|
| committer | MartinNowack <2443641+MartinNowack@users.noreply.github.com> | 2024-01-12 14:07:49 +0000 |
| commit | ad0daf5bc3c534f93aff24d196efbfef2ef3e36b (patch) | |
| tree | 44234921a56503df4ccda249b2c7ec93dd51c187 /lib/Core/ExecutionState.h | |
| parent | 3fa03d12d28658694f2bf2085e8634cc267e3f16 (diff) | |
| download | klee-ad0daf5bc3c534f93aff24d196efbfef2ef3e36b.tar.gz | |
Feature: implement single memory object resolution for symbolic addresses.
This feature implements tracking of and resolution of memory objects in the presence of symbolic addresses. For example, an expression like the following: int x; klee_make_symbolic(&x, sizeof(x), "x"); int* tmp = &b.y[x].z; For a concrete array object "y", which is a member of struct "b", a symbolic offset "x" would normally be resolved to any matching memory object - including the ones outside of the object "b". This behaviour is consistent with symbex approach of exploring all execution paths. However, from the point of view of security testing, we would only be interested to know if we are still in-bounds or there is a buffer overflow. The implemented feature creates and tracks (via the GEP instruction) the mapping between the current symbolic offset and the base object it refers to: in our example we are able to tell that the reference should happen within the object "b" (as the array "y" is inside the same memory blob). As a result, we are able to minimize the symbolic exploration to only two paths: one within the bounds of "b", the other with a buffer overflow bug. The feature is turned on via the single-object-resolution command line flag. A new test case was implemented to illustrate how the feature works.
Diffstat (limited to 'lib/Core/ExecutionState.h')
| -rw-r--r-- | lib/Core/ExecutionState.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/Core/ExecutionState.h b/lib/Core/ExecutionState.h index 20187166..833537f2 100644 --- a/lib/Core/ExecutionState.h +++ b/lib/Core/ExecutionState.h @@ -248,6 +248,10 @@ public: /// @brief Disables forking for this state. Set by user code bool forkDisabled = false; + /// @brief Mapping symbolic address expressions to concrete base addresses + typedef std::map<ref<Expr>, ref<ConstantExpr>> base_addrs_t; + base_addrs_t base_addrs; + public: #ifdef KLEE_UNITTEST // provide this function only in the context of unittests |
