skip to main content
10.1145/2093157.2093159acmotherconferencesArticle/Chapter ViewAbstractPublication PagespppjConference Proceedingsconference-collections
research-article

Quarantine: a framework to mitigate memory errors in JNI applications

Published:24 August 2011Publication History

ABSTRACT

By using Java Native Interface (JNI), programmers can integrate Java programs with legacy applications or third-party libraries written in other languages (e.g., C, C++, and Pascal). However, the use of JNI can bypass the Java boundary checking and exception-handling mechanisms. Furthermore, its use can violate Java's type-safety feature because of the type-mismatches between native programs and Java programs. As a result, such integration can cause various security issues including heap errors that can be dangerous and difficult to detect.

In this paper, we introduce Quarantine, a runtime system that can identify objects accessible by native methods and then migrate these objects to a quarantine area, which is used specifically to host this type of object. The goal of Quarantine is to create a runtime platform that allows programmers to apply existing heap protection techniques that have been designed for native languages but do not work well in the Java domain. We implemented Quarantine in Jikes RVM and evaluated its performance using the optimizing compiler. Our results using nine benchmark programs indicate that Quarantine, on average, incurs execution overhead of 14% and 13% when the heap is two and five times larger than the minimum heap requirement for an application, respectively.

References

  1. E. D. Berger and B. G. Zorn. DieHard: Probabilistic Memory Safety for Unsafe Languages. In Proceedings of the 2006 ACM SIGPLAN Conference on Programming language design and implementation, pages 158--168, New York, NY, USA, 2006. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. S. M. Blackburn, P. Cheng, and K. S. McKinley. Oil and Water? High Performance Garbage Collection in Java with MMTk. In Proceedings of the 26th International Conference on Software Engineering (ICSE), pages 137--146, Scotland, UK, May 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. S. M. Blackburn, R. Garner, C. Hoffmann, A. M. Khang, K. S. McKinley, R. Bentzur, A. Diwan, D. Feinberg, D. Frampton, S. Z. Guyer, M. Hirzel, A. Hosking, M. Jump, H. Lee, J. Eliot, B. Moss, A. Phansalkar, D. Stefanović, T. VanDrunen, D. von Dincklage, and B. Wiedermann. The DaCapo Benchmarks: Java Benchmarking Development and Analysis. In Proceedings of the ACM SIGPLAN conference on Object-oriented programming systems, languages, and applications, pages 169--190, Portland, Oregon, USA, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. S. M. Blackburn and A. L. Hosking. Barriers: Friend or Foe? In Proceedings of the 4th ACM International Symposium on Memory Management, pages 143--151, Vancouver, BC, Canada, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Y. Chiba. Heap protection for Java Virtual Machines. In Proceedings of the 4th International Symposium on Principles and Practice of Programming in Java, pages 103--112, Mannheim, Germany, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Y. Chiba. Java Heap Protection for Debugging Native Methods. Science of Computer Programming, 70(2--3):149--167, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. D. J. Dimmich and C. L. Jacobsen. A Foreign Function Interface Generator for occam-pi. In Communicating Process Architectures 2005, pages 235--248, Amsterdam, The Netherlands, September 2005. IOS Press.Google ScholarGoogle Scholar
  8. M. Furr and J. S. Foster. Checking Type Safety of Foreign Function Calls. SIGPLAN Notices, 40(6):62--72, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. L. Hellyer. Primitive write barrier support. http://jira.codehaus.org/browse/RVM-845.Google ScholarGoogle Scholar
  10. M. Hirzel and R. Grimm. Jeannie: Granting Java Native Interface Developers their Wishes. In Proceedings of the 22nd annual ACM SIGPLAN conference on Object-oriented programming systems and applications, pages 19--38, Montreal, Quebec, Canada, 2007. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. G. Kondoh and T. Onodera. Finding Bugs in Java Native Interface Programs. In Proceedings of the 2008 international symposium on Software testing and analysis, pages 109--118, New York, NY, USA, 2008. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. B. Lee, M. Hirzel, R. Grimm, and K. S. McKinley. Debug All Your Code: Portable Mixed-Environment Debugging. In Proceeding of the 24th ACM SIGPLAN conference on Object oriented programming systems languages and applications, pages 207--226, Orlando, Florida, USA, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. B. Lee, B. Wiedermann, M. Hirzel, R. Grimm, and K. S. McKinley. Jinn: Synthesizing Dynamic Bug Detectors for Foreign Language Interfaces. In Proceedings of the 2010 ACM SIGPLAN Conference on Programming Language Design and Implementation, pages 36--49, Toronto, Ontario, Canada, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. S. Li and G. Tan. Finding Bugs in Exceptional Situations of JNI programs. In Proceedings of the 16th ACM Conference on Computer and Communications Security, pages 442--452, Chicago, Illinois, USA, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. S. Liang. Java Native Interface: Programmer's Guide and Reference. Addison-Wesley Longman Publishing Co., Inc., Boston, MA, USA, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. V. B. Lvin, G. Novark, E. D. Berger, and B. G. Zorn. Archipelago: Trading Address Space for Reliability and Security. In Proceedings of the 13th international conference on Architectural support for programming languages and operating systems, pages 115--124, Seattle, WA, USA, March 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. G. Novark, E. D. Berger, and B. G. Zorn. Exterminator: Automatically Correcting Memory Errors with High Probability. Communications of the ACM, 51(12):87--95, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Oracle Corp. Java Native Interface Specification. http://download.oracle.com/javase/6/docs/technotes/guides/jni/spec/jniTOC.html.Google ScholarGoogle Scholar
  19. Oracle Forums: HotSpot Internals. Exception Access Violation + JNI. http://forums.sun.com/thread.jspa?threadID=5349664.Google ScholarGoogle Scholar
  20. Oracle Forums: JNI. Win32: Heap Corruption Detected. http://forums.sun.com/thread.jspa?threadID=5419764.Google ScholarGoogle Scholar
  21. Oracle Forums: JVM. GCTaskThread Crashes Under Heavy Load. http://forums.sun.com/thread.jspa?threadID=5424728.Google ScholarGoogle Scholar
  22. Oracle Forums: JVM. Server JVM Crashing. http://forums.sun.com/thread.jspa?threadID=631588.Google ScholarGoogle Scholar
  23. V. J. Reddi, A. Settle, D. A. Connors, and R. S. Cohn. PIN: A Binary Instrumentation Tool for Computer Architecture Research and Education. In Proceedings of the 2004 workshop on Computer architecture education: held in conjunction with the 31st International Symposium on Computer Architecture, Munich, Germany, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. J. Siefers, G. Tan, and G. Morrisett. Robusta: Taming the Native Beast of the JVM. In Proceedings of the 17th ACM conference on Computer and Communications Security, pages 201--211, Chicago, Illinois, USA, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Standard Performance Evaluation Corporation. SPECjbb2005. On-Line Documentation, 2005. http://www.spec.org/jbb2005.Google ScholarGoogle Scholar
  26. Sun Microsystems. Crash in Native Code. http://java.sun.com/javase/6/webnotes/trouble/TSG-VM/html/crashes.html.Google ScholarGoogle Scholar
  27. G. Tan, S. Chakradhar, R. Srivaths, and R. D. Wang. Safe Java Native Interface. In In Proceedings of the 2006 IEEE International Symposium on Secure Software Engineering, pages 97--106, 2006.Google ScholarGoogle Scholar
  28. G. Tan and J. Croft. An Empirical Security Study of the Native Code in the JDK. In Proceedings of the 17th conference on Security symposium, pages 365--377, Berkeley, CA, USA, 2008. USENIX Association. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. G. Xu and A. Rountev. Precise Memory Leak Detection for Java Software using Container Profiling. In Proceedings of the 30th international conference on Software engineering, ICSE '08, pages 151--160, New York, NY, USA, 2008. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Quarantine: a framework to mitigate memory errors in JNI applications

Recommendations

Comments

Login options

Check if you have access through your login credentials or your institution to get full access on this article.

Sign in
  • Published in

    cover image ACM Other conferences
    PPPJ '11: Proceedings of the 9th International Conference on Principles and Practice of Programming in Java
    August 2011
    186 pages
    ISBN:9781450309356
    DOI:10.1145/2093157

    Copyright © 2011 ACM

    Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

    Publisher

    Association for Computing Machinery

    New York, NY, United States

    Publication History

    • Published: 24 August 2011

    Permissions

    Request permissions about this article.

    Request Permissions

    Check for updates

    Qualifiers

    • research-article

    Acceptance Rates

    Overall Acceptance Rate29of58submissions,50%

PDF Format

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader