about summary refs log tree commit diff homepage
path: root/lib/Core/Executor.h
diff options
context:
space:
mode:
authorFrank Busse <bb0xfb@gmail.com>2020-01-29 19:13:20 +0000
committerMartinNowack <2443641+MartinNowack@users.noreply.github.com>2020-06-25 18:44:05 +0100
commit3fd9be596e20664e62f8daf5ddabaa10d7b4de3f (patch)
treeaa75e794645adb5c811b52ee3ef0eadbfe371377 /lib/Core/Executor.h
parent248be605d192abf425eae6d14fc206e507b48380 (diff)
downloadklee-3fd9be596e20664e62f8daf5ddabaa10d7b4de3f.tar.gz
Enforce fork/branch limits in branch() and fix double termination
* extend help messages for -max-memory and -max-memory-inhibit
* introduces branchingPermitted()
* enforces fork/branch limits in branch() (vector version)
* changes main loop
  * calls updateStates() before checkMemoryUsage()
  * calls updateStates() again in case we early terminate states

This should prevent double termination for now. Other solutions are
imho more expensive as we would have to compare possibly large
vectors of states (either states(arr) in checkMemoryUsage() or
removedStates in terminateState()).
Diffstat (limited to 'lib/Core/Executor.h')
-rw-r--r--lib/Core/Executor.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/Core/Executor.h b/lib/Core/Executor.h
index 7acbc60f..d27fa503 100644
--- a/lib/Core/Executor.h
+++ b/lib/Core/Executor.h
@@ -436,7 +436,13 @@ private:
                                     ref<Expr> e,
                                     ref<ConstantExpr> value);
 
-  void checkMemoryUsage();
+  /// check memory usage and terminate states when over threshold of -max-memory + 100MB
+  /// \return true if below threshold, false otherwise (states were terminated)
+  bool checkMemoryUsage();
+
+  /// check if branching/forking is allowed
+  bool branchingPermitted(const ExecutionState &state) const;
+
   void printDebugInstructions(ExecutionState &state);
   void doDumpStates();