一句话:提出用图神经网络估计程序终止行为,并定位可能导致不终止的 AST 节点以辅助调试。
程序终止性分析旨在检测不终止及其引发的挂起、拒绝服务等问题。已有神经网络方法多依赖形式化方法提供可靠性保证,因而受其限制。本文转向随机性机器学习,不追求求解器可解释的严格保证,而是估计程序是否终止以及可能的不终止原因,供程序员调试。作者利用程序的图表示,设计并实现了基于图卷积网络(GCN)和图注意力网络(GAT)的终止性分类器,以及一个语义分割图神经网络,用于定位 AST 中可能导致不终止的节点。文中还展示语义分割信息如何与程序切片结合,进一步辅助调试。
Termination analyses investigate the termination behavior of programs, intending to detect nontermination, which is known to cause a variety of program bugs (e.g. hanging programs, denial-of-service vulnerabilities). Beyond formal approaches, various attempts have been made to estimate the termination behavior of programs using neural networks. However, the majority of these approaches continue to rely on formal methods to provide strong soundness guarantees and consequently suffer from similar limitations. In this paper, we move away from formal methods and embrace the stochastic nature of machine learning models. Instead of aiming for rigorous guarantees that can be interpreted by solvers, our objective is to provide an estimation of a program's termination behavior and of the likely reason for nontermination (when applicable) that a programmer can use for debugging purposes. Compared to previous approaches using neural networks for program termination, we also take advantage of the graph representation of programs by employing Graph Neural Networks. To further assist programmers in understanding and debugging nontermination bugs, we adapt the notions of attention and semantic segmentation, previously used for other application domains, to programs. Overall, we designed and implemented classifiers for program termination based on Graph Convolutional Networks and Graph Attention Networks, as well as a semantic segmentation Graph Neural Network that localizes AST nodes likely to cause nontermination. We also illustrated how the information provided by semantic segmentation can be combined with program slicing to further aid debugging.