理解代码风格:基于CNN的高效代码优化识别系统
Understand Code Style: Efficient CNN-based Compiler Optimization Recognition System
摘要:
漏洞优化级别识别可以应用于漏洞发现和二进制分析。由于存在许多不同的编译优化选项,二进制文件内容的差异非常复杂。编译器优化算法成千上万,处理器体系结构多种多样,人工分析二进制文件并用规则识别其编译器优化水平是非常困难的。本文首先提出了一种基于CNN的编译器优化级别识别模型:BinEye。该系统提取语义和结构差异,并自动识别编译器优化级别。该模型被设计为非常适合二进制文件处理,并且易于理解。我们构建了一个包含80,028个二进制文件的数据集,用于模型训练和测试。我们提出的模型达到了97%以上的准确率。同时,BinEye是一个完全基于CNN的系统,它具有更快的前向计算速度,至少比普通的基于RNN的模型快8倍。通过对模型输出的分析,我们成功地发现了编译器优化水平不同所导致的汇编代码的差异。这意味着我们提出的模型是可解释的。基于我们的模型,我们提出了一种分析不同编译器优化级别导致的代码差异的方法,这对分析闭源编译器和二进制安全分析具有很大的指导意义。
英文摘要:
Compiler optimization level recognition can be applied to vulnerability discovery and binary analysis. Due to the exists of many different compilation optimization options, the difference in the contents of the binary file is very complicated. There are thousands of compiler optimization algorithms and multiple different processor architectures, so it is very difficult to manually analyze binary files and recognize its compiler optimization level with rules. This paper first proposes a CNN-based compiler optimization level recognition model: BinEye. The system extracts semantic and structural differences and automatically recognize the compiler optimization levels. The model is designed to be very suitable for binary file processing and is easy to understand. We built a dataset containing 80,028 binary files for the model training and testing. Our proposed model achieves an accuracy of over 97%. At the same time, BinEye is a fully CNN-based system and it has a faster forward calculation speed, at least 8 times faster than the normal RNN-based model. Through our analysis of the model output, we successfully found the difference in assembly codes caused by the different compiler optimization level. This means that the model we proposed is interpretable. Based on our model, we propose a method to analyze the code differences caused by different compiler optimization levels, which has great guiding significance for analyzing closed source compilers and binary security analysis.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。