Interface Compliance of Inline Assembly: Automatically Check, Patch and RefineACM SIGSOFT Distinguished PaperTechnical Track
Sat 29 May 2021 07:50 - 08:10 at Blended Sessions Room 3 - 4.5.3. Programming: Low Level
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 (2640 chunks), finding 2036 issues in 77 packages – 849 significant issues in 44 packages (including major projects such as ffmpeg or ALSA), and proposing patches for 95% of them. Currently, 27 patches have already been accepted (solving 53 significant issues), with positive feedback from development teams.