Affiliation:
1. University of Texas at Austin, Austin, USA
2. IBM Watson Research Center, Hawthorne, USA
3. New York University, New York, USA
Abstract
Programming language specifications mandate static and dynamic analyses to preclude syntactic and semantic errors. Although individual languages are usually well-specified, composing languages is not, and this poor specification is a source of many errors in
multilingual
programs. For example, virtually all Java programs compose Java and C using the Java Native Interface (JNI). Since JNI is informally specified, developers have difficulty using it correctly, and current Java compilers and virtual machines (VMs) inconsistently check only a subset of JNI constraints.
This paper's most significant contribution is to show how to synthesize dynamic analyses from state machines to detect foreign function interface (FFI) violations. We identify three classes of FFI constraints encoded by eleven state machines that capture thousands of JNI and Python/C FFI rules. We use a mapping function to specify which state machines, transitions, and program entities (threads, objects, references) to check at each FFI call and return. From this function, we synthesize a context-specific dynamic analysis to find FFI bugs. We build bug detection tools for JNI and Python/C using this approach. For JNI, we dynamically and transparently interpose the analysis on Java and C language transitions through the JVM tools interface. The resulting tool, called Jinn, is compiler and virtual machine
independent
. It detects and diagnoses a wide variety of FFI bugs that other tools miss. This approach greatly reduces the annotation burden by exploiting common FFI constraints: whereas the generated Jinn code is 22,000+ lines, we wrote only 1,400 lines of state machine and mapping code. Overall, this paper lays the foundation for a more principled approach to developing correct multilingual software and a more concise and automated approach to FFI specification.
Publisher
Association for Computing Machinery (ACM)
Subject
Computer Graphics and Computer-Aided Design,Software
Cited by
11 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. Could Tierless Languages Reduce IoT Development Grief?;ACM Transactions on Internet of Things;2023-02-23
2. Detecting Cross-language Memory Management Issues in Rust;Computer Security – ESORICS 2022;2022
3. JNI program analysis with automatically extracted C semantic summary;Proceedings of the 28th ACM SIGSOFT International Symposium on Software Testing and Analysis;2019-07-10
4. Short Paper;Proceedings of the 2016 ACM Workshop on Programming Languages and Analysis for Security;2016-10-24
5. JNI light: an operational model for the core JNI;Mathematical Structures in Computer Science;2014-11-10