内联装配的接口一致性:自动检查、修补和优化
Interface Compliance of Inline Assembly: Automatically Check, Patch and Refine
摘要:
内联汇编仍然是低级C编程中的常见做法,通常是出于效率原因或访问特定硬件资源。此类采用GNU语法的嵌入式汇编代码(由主要编译器(例如GCC、Clang和ICC)支持)有一个接口,指定汇编代码如何与C环境交互。为了简单起见,编译器将GNU内联汇编代码视为黑盒,仅依赖于它们的接口将它们正确地粘合到编译的C代码中。因此,组装块和它的接口之间的适当性(称为一致性)是最重要的,因为这样的一致性问题可能导致微妙的和难以发现的bug。我们提出RUSTInA,第一个自动化技术,正式检查内联组装的合规性,额外的能力,提出(证明)补丁和(优化)在某些情况下的改进。RUSTInA是基于一个原始的形式化的内联装配符合性问题,连同新颖的专用算法。我们的原型已经在202个Debian软件包上进行了评估,其中包括内联汇编(2656个chunk),在85个软件包中发现了2183个问题,在54个软件包中发现了986个重要问题(包括主要项目,如ffmpeg或ALSA),并为其中的92%提出了补丁。目前,已经有38个补丁被接受(解决了156个重大问题),开发团队给出了积极的反馈。
英文摘要:
Inline assembly is still a common practice in low-level C programming, typically for efficiency reasons or for accessing specific hardware resources. Such embedded assembly codes in the GNU syntax (supported by major compilers such as GCC, Clang and ICC) have an interface specifying how the assembly codes interact with the C environment. For simplicity reasons, the compiler treats GNU inline assembly codes as blackboxes and relies only on their interface to correctly glue them into the compiled C code. Therefore, the adequacy between the assembly chunk and its interface (named compliance) is of primary importance, as such compliance issues can lead to subtle and hard-to-find bugs. We propose RUSTInA, the first automated technique for formally checking inline assembly compliance, with the extra ability to propose (proven) patches and (optimization) refinements in certain cases. RUSTInA is based on an original formalization of the inline assembly compliance problem together with novel dedicated algorithms. Our prototype has been evaluated on 202 Debian packages with inline assembly (2656 chunks), finding 2183 issues in 85 packages -- 986 significant issues in 54 packages (including major projects such as ffmpeg or ALSA), and proposing patches for 92% of them. Currently, 38 patches have already been accepted (solving 156 significant issues), with positive feedback from development teams.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。