• Home
  • Search
  • Finding bugs in java native interface programs
  • Open Access IconOpen Access
  • Cite Icon59
  • https://doi.org/10.1145/1390630.1390645Copy DOI Icon

Finding bugs in java native interface programs

  • Jul 20, 2008
  • Goh Kondoh +1 more
Show More
  • Abstract
  • Literature Map
  • References
  • Citations
  • Similar Papers
Abstract

In this paper, we describe static analysis techniques for finding bugs in programs using the Java Native Interface (JNI). The JNI is both tedious and error-prone because there are many JNI-specific mistakes that are not caught by a native compiler. This paper is focused on four kinds of common mistakes. First, explicit statements to handle a possible exception need to be inserted after a statement calling a Java method. However, such statements tend to be forgotten. We present a typestate analysis to detect this exception-handling mistake. Second, while the native code can allocate resources in a Java VM, those resources must be manually released, unlike Java. Mistakes in resource management cause leaks and other errors. To detect Java resource errors, we used the typestate analysis also used for detecting general memory errors. Third, if a reference to a Java resource lives across multiple native method invocations, it should be converted into a global reference. However, programmers sometimes forget this rule and, for example, store a local reference in a global variable for later uses. We provide a syntax checker that detects this bad coding practice. Fourth, no JNI function should be called in a critical region. If called there, the current thread might block and cause a deadlock. Misinterpreting the end of the critical region, programmers occasionally break this rule. We present a simple typestate analysis to detect an improper JNI function call in a critical region.

Similar Papers
  • Conference Article
  • Citations30

Artemis

  • Jun 11, 2006
  • Long Fei +1
  • Research Article
  • Citations35

Artemis

  • Jun 11, 2006
  • ACM SIGPLAN Notices
  • Long Fei +1
  • Conference Article
  • Citations3

JUSTGen: Effective Test Generation for Unspecified JNI Behaviors on JVMs

  • May 01, 2021
  • Sungjae Hwang +3
  • Conference Article
  • Citations12

JUSTGen: Effective Test Generation for Unspecified JNI Behaviors on JVMs

  • May 01, 2021
  • Sungjae Hwang +3
  • Conference Article
  • Citations65

Finding bugs in exceptional situations of JNI programs

  • Nov 09, 2009
  • Siliang Li +1
  • Conference Article
  • Citations44

Jinn

  • Jun 05, 2010
  • Byeongcheol Lee +4
  • Conference Article
  • Citations1

JNICodejail

  • Sep 11, 2013
  • Behnaz Hassanshahi +1
  • Research Article
  • Citations21

Bringing java's wild native world under control

  • Nov 01, 2013
  • ACM Transactions on Information and System Security
  • Mengtao Sun +4
  • Research Article
  • Citations1

The design of JVM and native libraries in ScalaLab for efficient scientific computation

  • Oct 01, 2018
  • International Journal of Modeling, Simulation, and Scientific Computing
  • Stergios Papadimitriou +1
  • Research Article
  • Citations1

JNI light: an operational model for the core JNI

  • Nov 10, 2014
  • Mathematical Structures in Computer Science
  • Gang Tan
  • Research Article
  • Citations12

Jinn

  • Jun 05, 2010
  • ACM SIGPLAN Notices
  • Byeongcheol Lee +4
  • Conference Article

Modeling and Formally Verifying a Safety-Critical System Through MCRL2

  • Jan 01, 2018
  • Ram Chandra Bhushan +1
  • Research Article

Software Model Checking via Summary-Guided Search

  • Oct 09, 2025
  • Proceedings of the ACM on Programming Languages
  • Ruijie Fang +2
  • Dissertation

Automated generation and checking of verification conditions

  • Dec 17, 2013
  • Milena Vujosevic-Janicic
  • Research Article
  • Citations32

STLlint: lifting static checking from languages to libraries

  • Sep 15, 2005
  • Software: Practice and Experience
  • Douglas Gregor +1
Cactus Communications logo

Copyright 2026 Cactus Communications. All rights reserved.