论文标题
使用模板Java程序进行编译器测试
Compiler Testing using Template Java Programs
论文作者
论文摘要
我们提出JATTACK,这是一个框架,可以对编译器进行基于模板的测试。开发人员使用Jattack编写了一个模板程序,该程序描述了要生成并作为测试输入的编译器的一组程序。这样的框架使开发人员能够将其域知识纳入测试编译器上,从而提供了基本的程序结构,该结构允许探索可以触发复杂编译器优化的复杂程序。开发人员用主机语言(Java)编写一个模板程序,其中包含贾塔克(Jattack)填充的孔。每个孔都使用特定于域的语言编写,在扩展的抽象语法树(EAST)中构造节点。东节点定义了孔的搜索空间,即一组表达式和值。 Jattack通过执行模板并通过随机选择表达式和值来生成程序(在孔定义的搜索空间内可用)。此外,我们引入了几种优化,以降低Jattack的发电成本。尽管Jattack可用于测试各种编译器功能,但我们演示了其在帮助测试即时(JIT)Java编译器方面的功能,其优化在足够数量的执行后在运行时进行。使用Jattack,我们发现了六个关键错误,这些错误已由Oracle开发人员确认。其中四个以前是未知的,其中包括两个未知的CVE(常见漏洞和暴露)。贾塔克(Jattack)展示了将开发人员域知识(通过模板)与随机测试相结合的力量,以检测JIT编译器中的错误。
We present JAttack, a framework that enables template-based testing for compilers. Using JAttack, a developer writes a template program that describes a set of programs to be generated and given as test inputs to a compiler. Such a framework enables developers to incorporate their domain knowledge on testing compilers, giving a basic program structure that allows for exploring complex programs that can trigger sophisticated compiler optimizations. A developer writes a template program in the host language (Java) that contains holes to be filled by JAttack. Each hole, written using a domain-specific language, constructs a node within an extended abstract syntax tree (eAST). An eAST node defines the search space for the hole, i.e., a set of expressions and values. JAttack generates programs by executing templates and filling each hole by randomly choosing expressions and values (available within the search space defined by the hole). Additionally, we introduce several optimizations to reduce JAttack's generation cost. While JAttack could be used to test various compiler features, we demonstrate its capabilities in helping test just-in-time (JIT) Java compilers, whose optimizations occur at runtime after a sufficient number of executions. Using JAttack, we have found six critical bugs that were confirmed by Oracle developers. Four of them were previously unknown, including two unknown CVEs (Common Vulnerabilities and Exposures). JAttack shows the power of combining developers' domain knowledge (via templates) with random testing to detect bugs in JIT compilers.