[go: up one dir, main page]
More Web Proxy on the site http://driver.im/ skip to main content
10.1145/2814270.2814313acmconferencesArticle/Chapter ViewAbstractPublication PagessplashConference Proceedingsconference-collections
research-article

Use at your own risk: the Java unsafe API in the wild

Published: 23 October 2015 Publication History

Abstract

Java is a safe language. Its runtime environment provides strong safety guarantees that any Java application can rely on. Or so we think. We show that the runtime actually does not provide these guarantees---for a large fraction of today's Java code. Unbeknownst to many application developers, the Java runtime includes a "backdoor" that allows expert library and framework developers to circumvent Java's safety guarantees. This backdoor is there by design, and is well known to experts, as it enables them to write high-performance "systems-level" code in Java. For much the same reasons that safe languages are preferred over unsafe languages, these powerful---but unsafe---capabilities in Java should be restricted. They should be made safe by changing the language, the runtime system, or the libraries. At the very least, their use should be restricted. This paper is a step in that direction. We analyzed 74 GB of compiled Java code, spread over 86,479 Java archives, to determine how Java's unsafe capabilities are used in real-world libraries and applications. We found that 25% of Java bytecode archives depend on unsafe third-party Java code, and thus Java's safety guarantees cannot be trusted. We identify 14 different usage patterns of Java's unsafe capabilities, and we provide supporting evidence for why real-world code needs these capabilities. Our long-term goal is to provide a foundation for the design of new language features to regain safety in Java.

Supplementary Material

Auxiliary Archive (p695-mastrangelo-s.zip)
This auxiliary material contains a VirtualBox Virtual Machine that allows you to reproduce the evaluation done in the paper. For more information, check readme.pdf inside the zip file.

References

[1]
B. Alpern, S. Augart, S. M. Blackburn, M. Butrico, A. Cocchi, P. Cheng, J. Dolby, S. Fink, D. Grove, M. Hind, K. S. McKinley, M. Mergen, J. E. B. Moss, T. Ngo, and V. Sarkar. The Jikes Research Virtual Machine Project: Building an Opensource Research Community. IBM Syst. J., 44(2):399–417, January 2005.
[2]
Alberto Bacchelli, Anthony Cleve, Michele Lanza, and Andrea Mocci. Extracting structured data from natural language documents with island parsing. In Proceedings of ASE 2011 (26th IEEE/ACM International Conference On Automated Software Engineering), pages 476–479, 2011.
[3]
David F. Bacon, Perry Cheng, and V. T. Rajan. A real-time garbage collector with low overhead and consistent utilization. In Proceedings of the 30th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL ’03, pages 285–298, New York, NY, USA, 2003. ACM.
[4]
Oscar Calla´u, Romain Robbes, Éric Tanter, and David Röthlisberger. How developers use the dynamic features of programming languages: The case of Smalltalk. In Proceedings of the 8th Working Conference on Mining Software Repositories, MSR ’11, pages 23–32, New York, NY, USA, 2011. ACM.
[5]
Roman Kennke Christine H. Flood. JEP 189: Shenandoah: An Ultra-Low-Pause-Time Garbage Collector. http: //openjdk.java.net/jeps/189, 2014.
[6]
Robert Dyer, Hridesh Rajan, Hoan Anh Nguyen, and Tien N. Nguyen. Mining billions of AST nodes to study actual and potential usage of Java language features. In 36th International Conference on Software Engineering, ICSE’14, pages 779–790, June 2014.
[7]
Daniel Frampton, Stephen M. Blackburn, Perry Cheng, Robin J. Garner, David Grove, J. Eliot B. Moss, and Sergey I. Salishev. Demystifying Magic: High-level Lowlevel Programming. In Proceedings of the 2009 ACM SIGPLAN/SIGOPS International Conference on Virtual Execution Environments, VEE ’09, pages 81–90, New York, NY, USA, 2009. ACM.
[8]
Milos Gligoric, Darko Marinov, and Sam Kamin. CoDeSe: Fast Deserialization via Code Generation. In Proceedings of the 2011 International Symposium on Software Testing and Analysis, ISSTA ’11, pages 298–308, New York, NY, USA, 2011. ACM.
[9]
Alessandra Gorla, Ilaria Tavecchia, Florian Gross, and Andreas Zeller. Checking app behavior against app descriptions. In Proceedings of the 36th International Conference on Software Engineering, ICSE 2014, pages 1025–1035, New York, NY, USA, 2014. ACM.
[10]
James Gosling, Bill Joy, Guy L. Steele, Jr., Gilad Bracha, and Alex Buckley. The Java Language Specification, Java SE 7 Edition. Addison-Wesley Professional, 2013.
[11]
Mark Grechanik, Collin McMillan, Luca DeFerrari, Marco Comi, Stefano Crespi, Denys Poshyvanyk, Chen Fu, Qing Xie, and Carlo Ghezzi. An empirical investigation into a largescale Java open source code repository. In Proceedings of the 2010 ACM-IEEE International Symposium on Empirical Software Engineering and Measurement, ESEM ’10, pages 11:1–11:10, New York, NY, USA, 2010. ACM.
[12]
Alex Holkner and James Harland. Evaluating the dynamic behaviour of Python applications. In Proceedings of the Thirty-Second Australasian Conference on Computer Science - Volume 91, ACSC ’09, pages 19–28, Darlinghurst, Australia, Australia, 2009. Australian Computer Society, Inc.
[13]
Guy Korland, Nir Shavit, and Pascal Felber. Noninvasive Concurrency with Java STM. In Communications of the ACM, Invited Review Paper, page 19 pages, 2010.
[14]
Eugene Kuleshov. Using the ASM framework to implement common Java bytecode transformation patterns. In Conference on Aspect Oriented Software Development (AOSD): Industry Track, 2007.
[15]
Doug Lea. JEP 193: Enhanced Volatiles. http://openjdk. java.net/jeps/193, 2014.
[16]
Clemens Mayer, Stefan Hanenberg, Romain Robbes, Éric Tanter, and Andreas Stefik. An empirical study of the influence of static type systems on the usability of undocumented software. In Proceedings of the ACM International Conference on Object Oriented Programming Systems Languages and Applications, OOPSLA ’12, pages 683–702, New York, NY, USA, 2012. ACM.
[17]
Leon Moonen. Generating robust parsers using island grammars. In Proceedings of WCRE 2001 (8th Working Conference on Reverse Engineering), pages 13–22. IEEE CS, 2001.
[18]
Charles Oliver Nutter. JEP 191: Foreign Function Interface. http://openjdk.java.net/jeps/191, 2014.
[19]
OpenJDK. Project Sumatra. http://openjdk.java.net/ projects/sumatra/, 2013.
[20]
Luca Ponzanelli, Andrea Mocci, and Michele Lanza. StORMeD: Stack Overflow ready made data. In Proceedings of MSR 2015 (12th Working Conference on Mining Software Repositories), page to be published. ACM Press, 2015.
[21]
Mario Pukall, Christian Kästner, Walter Cazzola, Sebastian Götz, Alexander Grebhahn, Reimar Schröter, and Gunter Saake. JavAdaptor-Flexible runtime updates of Java applications. Software: Practice and Experience, 43(2):153–185, 2013.
[22]
Xin Qi and Andrew C. Myers. Masked types for sound object initialization. In Proceedings of the 36th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL ’09, pages 53–65, New York, NY, USA, 2009. ACM.
[23]
Gregor Richards, Christian Hammer, Brian Burg, and Jan Vitek. The eval that men do: A large-scale study of the use of eval in JavaScript applications. In Proceedings of the 25th European Conference on Object-oriented Programming, ECOOP’11, pages 52–78, Berlin, Heidelberg, 2011. Springer-Verlag.
[24]
Gregor Richards, Sylvain Lebresne, Brian Burg, and Jan Vitek. An analysis of the dynamic behavior of JavaScript programs. In Proceedings of the 2010 ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI ’10, pages 1–12, New York, NY, USA, 2010. ACM.
[25]
John Rose, Brian Goetz, and Guy Steele. State of the Values. http://cr.openjdk.java.net/˜jrose/values/ values-0.html, 2014.
[26]
John R. Rose. Arrays 2.0. http://cr.openjdk.java.net/ ˜jrose/pres/201207-Arrays-2.pdf, 2012.
[27]
John R. Rose. The isthmus in the VM. https://blogs. oracle.com/jrose/entry/the_isthmus_in_the_vm, 2014.
[28]
Paul Sandoz. Safety not guaranteed: sun.misc.Unsafe and the quest for safe alternatives. http://cr.openjdk.java.net/˜psandoz/ dv14-uk-paul-sandoz-unsafe-the-situation.pdf, 2014. Oracle Inc. {Online; accessed 29-January-2015}.
[29]
Paul Sandoz. Personal communication, 2015.
[30]
Fridtjof Siebert. Eliminating external fragmentation in a nonmoving garbage collector for Java. In Proceedings of the 2000 International Conference on Compilers, Architecture, and Synthesis for Embedded Systems, CASES ’00, pages 9– 17, New York, NY, USA, 2000. ACM.

Cited By

View all
  • (2024)Semantic Web Approaches in Stack OverflowInternational Journal on Semantic Web & Information Systems10.4018/IJSWIS.35861720:1(1-61)Online publication date: 9-Nov-2024
  • (2023)Bilingual problemsProceedings of the 32nd USENIX Conference on Security Symposium10.5555/3620237.3620580(6133-6150)Online publication date: 9-Aug-2023
  • (2023)Reference Capabilities for Flexible Memory ManagementProceedings of the ACM on Programming Languages10.1145/36228467:OOPSLA2(1363-1393)Online publication date: 16-Oct-2023
  • Show More Cited By

Recommendations

Comments

Please enable JavaScript to view thecomments powered by Disqus.

Information & Contributors

Information

Published In

cover image ACM Conferences
OOPSLA 2015: Proceedings of the 2015 ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and Applications
October 2015
953 pages
ISBN:9781450336895
DOI:10.1145/2814270
  • cover image ACM SIGPLAN Notices
    ACM SIGPLAN Notices  Volume 50, Issue 10
    OOPSLA '15
    October 2015
    953 pages
    ISSN:0362-1340
    EISSN:1558-1160
    DOI:10.1145/2858965
    • Editor:
    • Andy Gill
    Issue’s Table of Contents
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]

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 23 October 2015

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. Java
  2. Maven Central
  3. Stack Overflow
  4. mining
  5. patterns
  6. unsafe

Qualifiers

  • Research-article

Funding Sources

Conference

SPLASH '15
Sponsor:

Acceptance Rates

Overall Acceptance Rate 268 of 1,244 submissions, 22%

Upcoming Conference

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)43
  • Downloads (Last 6 weeks)6
Reflects downloads up to 30 Dec 2024

Other Metrics

Citations

Cited By

View all
  • (2024)Semantic Web Approaches in Stack OverflowInternational Journal on Semantic Web & Information Systems10.4018/IJSWIS.35861720:1(1-61)Online publication date: 9-Nov-2024
  • (2023)Bilingual problemsProceedings of the 32nd USENIX Conference on Security Symposium10.5555/3620237.3620580(6133-6150)Online publication date: 9-Aug-2023
  • (2023)Reference Capabilities for Flexible Memory ManagementProceedings of the ACM on Programming Languages10.1145/36228467:OOPSLA2(1363-1393)Online publication date: 16-Oct-2023
  • (2023)Outside the Sandbox: A Study of Input/Output Methods in JavaProceedings of the 27th International Conference on Evaluation and Assessment in Software Engineering10.1145/3593434.3593501(253-258)Online publication date: 14-Jun-2023
  • (2023)Analyzing and Improving the Scalability of In-Memory Indices for Managed Search EnginesProceedings of the 2023 ACM SIGPLAN International Symposium on Memory Management10.1145/3591195.3595272(15-29)Online publication date: 6-Jun-2023
  • (2023)High-Performance Object Serialization based on Ahead-of-Time Schema Generation2023 IEEE 22nd International Conference on Trust, Security and Privacy in Computing and Communications (TrustCom)10.1109/TrustCom60117.2023.00335(2378-2385)Online publication date: 1-Nov-2023
  • (2023)UnGoML: Automated Classification of unsafe Usages in Go2023 IEEE/ACM 20th International Conference on Mining Software Repositories (MSR)10.1109/MSR59073.2023.00050(309-321)Online publication date: May-2023
  • (2022)Breaking Type Safety in Go: An Empirical Study on the Usage of the unsafe PackageIEEE Transactions on Software Engineering10.1109/TSE.2021.305772048:7(2277-2294)Online publication date: 1-Jul-2022
  • (2022)API beauty is in the eye of the clientsJournal of Systems and Software10.1016/j.jss.2021.111134184:COnline publication date: 1-Feb-2022
  • (2021)Automatic API Usage Scenario Documentation from Technical Q&A SitesACM Transactions on Software Engineering and Methodology10.1145/343976930:3(1-45)Online publication date: 23-Apr-2021
  • Show More Cited By

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media