Jinn: Synthesizing dynamic bug detectors for foreign language interfaces

Byeongcheol Lee, Ben Wiedermann, Martin Hirzel, Robert Grimm, Kathryn S. McKinley

Research output: Chapter in Book/Report/Conference proceedingConference contribution

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.

Original languageEnglish (US)
Title of host publicationPLDI'10 - Proceedings of the 2010 ACM SIGPLAN Conference on Programming Language Design and Implementation
Pages36-49
Number of pages14
DOIs
StatePublished - 2010
EventACM SIGPLAN 2010 Conference on Programming Language Design and Implementation, PLDI 2010 - Toronto, ON, Canada
Duration: Jun 5 2010Jun 10 2010

Publication series

NameProceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI)

Other

OtherACM SIGPLAN 2010 Conference on Programming Language Design and Implementation, PLDI 2010
Country/TerritoryCanada
CityToronto, ON
Period6/5/106/10/10

Keywords

  • dynamic analysis
  • ffi bugs
  • foreign function interfaces (FFI)
  • java native interface (jni)
  • multilingual programs
  • python/C
  • specification
  • specification generation

ASJC Scopus subject areas

  • Software

Fingerprint

Dive into the research topics of 'Jinn: Synthesizing dynamic bug detectors for foreign language interfaces'. Together they form a unique fingerprint.

Cite this