arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2401.06653cs.SE
收藏

面向Kotlin编译器差分测试的进化生成式模糊测试

Evolutionary Generative Fuzzing for Differential Testing of the Kotlin Compiler

Calin Georgescu, Mitchell Olsthoorn, Pouria Derakhshanfar, Marat Akhin, Annibale Panichella

AI总结:

本文提出一种黑盒生成式模糊测试方法,结合语义接口模型、扩充上下文无关文法及两种遗传算法生成Kotlin程序,用于K1和K2编译器的差分测试,有效发现并确认了多个编译器缺陷。

摘要:

编译器正确性是可靠软件开发的基石。然而,鉴于可能程序的巨大空间以及现代编程语言的复杂性,对编译器进行系统化测试是不可行的。在此背景下,差分测试提供了一种实用的方法,因为它通过比较给定同一组程序作为输入的替代编译器的输出来解决测试预言问题。在本文中,我们研究了差分测试在发现JetBrains开发的Kotlin编译器中的错误方面的有效性。我们提出了一种黑盒生成式方法,为K1和K2编译器创建输入程序。首先,我们构建Kotlin语义(语义接口)和语法(扩充的上下文无关文法)语言特性的可工作模型,随后利用这些模型生成随机代码片段。其次,我们通过引入两种遗传算法(GAs)来扩展随机采样,旨在生成更多样化的输入程序。我们的案例研究表明,所提出的方法能有效检测K1和K2中的错误;这些错误已被JetBrains开发人员确认,并且(部分)已修复。虽然我们没有观察到不同搜索算法在发现的缺陷数量上存在显著差异,但随机搜索和遗传算法是互补的,因为它们发现了不同类别的错误。最后,我们深入分析了所生成输入程序的大小、复杂性与故障检测能力之间的关系。

英文摘要:

Compiler correctness is a cornerstone of reliable software development. However, systematic testing of compilers is infeasible, given the vast space of possible programs and the complexity of modern programming languages. In this context, differential testing offers a practical methodology as it addresses the oracle problem by comparing the output of alternative compilers given the same set of programs as input. In this paper, we investigate the effectiveness of differential testing in finding bugs within the Kotlin compilers developed at JetBrains. We propose a black-box generative approach that creates input programs for the K1 and K2 compilers. First, we build workable models of Kotlin semantic (semantic interface) and syntactic (enriched context-free grammar) language features, which are subsequently exploited to generate random code snippets. Second, we extend random sampling by introducing two genetic algorithms (GAs) that aim to generate more diverse input programs. Our case study shows that the proposed approach effectively detects bugs in K1 and K2; these bugs have been confirmed and (some) fixed by JetBrains developers. While we do not observe a significant difference w.r.t. the number of defects uncovered by the different search algorithms, random search and GAs are complementary as they find different categories of bugs. Finally, we provide insights into the relationships between the size, complexity, and fault detection capability of the generated input programs.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑