OptSE: Toward Optimal Symbolic Execution
Symbolic execution is a powerful technique that can accurately synthesize program inputs for program testing. However, the scalability of symbolic execution is often limited by the capability of the constraint solver and time for testing. With limited time budget, it is desirable to optimally select paths for symbolic execution and furthermore variables for symbolization in order to achieve the maximum code coverage. In this work, we make two technical contributions towards solving this problem. First, different from most existing solving strategies based on heuristic path selection, we formally define the ‘optimal’ strategy based on <italic xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">the reward of executing a given program path considering both possible code coverage and the cost of constraint solving</i>. We further prove that the problem of identifying the optimal strategy for symbolic execution can be reduced to a classic knapsack problem, whose decision problem form is NP-complete. Second, in view of the complexity in identifying the optimal strategy, we design a practical greedy algorithm, named OPTSE, for approximating the optimal strategy. We implemented OPTSE in KLEE and extensively evaluate it on a diverse set of programs. The results show that OPTSE is effective, i.e., achieving 12% more code coverage and detects 17% more security violations than the state-of-the-art symbolic execution tool and outperforming a collection of strategies that only consider either path selection, solving strategies or simply superimpose them.
Authors
- Xingwei Lin (ORCID: https://orcid.org/0009-0005-5048-2516)
- Peng Cheng (ORCID: https://orcid.org/0000-0002-4221-2162)
- Shunkai Zhu (ORCID: https://orcid.org/0000-0001-6428-6739)
- Jingyi Wang (ORCID: https://orcid.org/0000-0001-7113-7635)
- Jun Sun (ORCID: https://orcid.org/0000-0001-9127-088X)
Institutions
- Zhejiang University (CN)
- Singapore Management University (SG)
Publication Details
- Journal
- IEEE Transactions on Software Engineering
- Published
- 2025-05-02
- DOI
- https://doi.org/10.1109/tse.2025.3564666
- Primary Topic
- Political Conflict and Governance
- Type
- article
- Field-Weighted Citation Impact
- 0.00