xuruiyang2002 / miniklee

MinKLEE for teaching
1 stars 0 forks source link

MiniKLEE Development Plan #1

Open xuruiyang2002 opened 1 week ago

xuruiyang2002 commented 1 week ago

We propose to build a toy symbolic executor for teaching purpose.

Objective

Currently there are two types of symbolic execution:

We are going to implement a toy EGT symbolic executior which currently has the following features/weakness:

if (c == 1000) { bug(); } else { printf(‘Pass’) } return 0; }


- Can only Support a subset of LLVM Operations such as `Add`, `Sub`, `Alloca`, `Load`, **`Br`** _et al_, others we leave to future
- To Be Determined
xuruiyang2002 commented 1 week ago

Build Framework Based on LLVM

Version: dd6b3c535fd72202f720cdd2944f6380cc2b0840

xuruiyang2002 commented 1 week ago

Model Control-flow

There are two issues to be carefully considered:

Now we have modeled the interpretive skeleton (at commit point c597e4300fa1161315a59c9c8ddc1c45de7c109b), next is interpreting the semantics of each instruction.

At commit c597e4300fa1161315a59c9c8ddc1c45de7c109b, miniklee could fetch and analyze each at basic block level (which means transfer control flow in main function), and return successfully.

xuruiyang2002 commented 1 week ago

Interpret Control-flow

At commit point 4cf6fc292265ce2cf2bde71d579fdff2f4ed8952, we have alreay built the basic assisted frameworks to represent and operate symbolics.

The current number of all lines (for cpp and h files) is 900+ lines

xuruiyang2002 commented 3 days ago

Implement TinySolver

After modeling and interpreting the semantics of each instruction (c2dfc9fd2e60ad73d358fb77e8006182c34d399b), we arrive at the most exciting part: forking when branching. This means that when encountering a branch, the symbolic executor invokes a solver to solve the constraints it has collected during path exploration.

To keep things simple and reduce complexity, as well as to make development life less painful, we have decided not to integrate the Z3 solver into our toolchain. Instead, we implement a naive solver that can handle simple equations and inequalities involving only addition and subtraction.

UPDATE: So far, TinySolver has been completed, and we can use it to solve any linear equations (with only addition and subtraction).

xuruiyang2002 commented 2 days ago

Generate Test Case and Handle Errors

With TinySolver completed (c3e2a82560d33193ad8d62afd09e83d01ee2b9c5), we can now solve linear equations involving only addition and subtraction. This marks the end of the MiniKLEE development journey.

Last but but the least thing to do: generate test case and handling errors.