Adaptable Runtime Monitoring for the Java Virtual Machine

  • Andrea Rosà
  • Yudi Zheng
  • Haiyang Sun
  • Omar Javed
  • Walter Binder
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 9953)


Nowadays, many programming language implementations and programming frameworks target the Java Virtual Machine (JVM). Examples include the Java and Scala compilers, Oracle’s Truffle framework and the interpreters built on top of it for a variety of dynamic programming languages, as well as big-data frameworks such as Apache Spark, Apache Flink, and Apache Storm. Unfortunately, the JVM provides only limited support for runtime monitoring. The JVM Tool Interface (JVMTI) offers only a very low-level programming model, often introduces high overhead, and does not guarantee proper isolation of the monitoring logic from the observed program. Aspect-Oriented Programming (AOP), in particular AspectJ, is often used to implement runtime monitoring tools. While offering a convenient programming model, the use of such technologies acerbates performance- and isolation-related problems. In this paper, we advocate the use of our dynamic program analysis framework DiSL for runtime monitoring on the JVM. DiSL reconciles an AOP-based programming model, full coverage of all executed bytecodes, optimizations of the monitoring logic, and support for isolation of the monitoring logic. Moreover, DiSL also offers an API to deploy, adapt, and remove monitoring logic at runtime, and it provides seamless support for monitoring also applications running on Android devices.


Runtime monitoring Runtime adaptation Bytecode optimization Bytecode instrumentation Partial evaluation Java Virtual Machine 



This work has been supported by Oracle (ERO project 1332), by the Swiss National Science Foundation (project 200021_141002), and by the European Commission (contract ACP2-GA-2013-605442).


  1. 1.
    Würthinger, T., Wöß, A., Stadler, L., Duboscq, G., Simon, D., Wimmer, C.: Self-optimizing AST interpreters. ACM SIGPLAN Not. 2012 48, 73–82 (2012)Google Scholar
  2. 2.
    Duboscq, G., Würthinger, T., Stadler, L., Wimmer, C., Simon, D., Mössenböck, H.: An intermediate representation for speculative optimizations in a dynamic compiler. In: VMIL, pp. 1–10 (2013)Google Scholar
  3. 3.
    Zaharia, M., Chowdhury, M., Das, T., Dave, A., Ma, J., McCauley, M., Franklin, M.J., Shenker, S., Stoica, I.: Resilient distributed datasets: a fault-tolerant abstraction for in-memory cluster computing. In: NSDI, pp. 2:1–2:15 (2012)Google Scholar
  4. 4.
    Kiczales, G., Hilsdale, E., Hugunin, J., Kersten, M., Palm, J., Griswold, W.G.: An overview of AspectJ. In: Knudsen, J.L. (ed.) ECOOP 2001. LNCS, vol. 2072, pp. 327–354. Springer, Heidelberg (2001). doi: 10.1007/3-540-45337-7_18 CrossRefGoogle Scholar
  5. 5.
    Jin, D., Meredith, P.O., Lee, C., Roşu, G.: JavaMOP: efficient parametric runtime monitoring framework. In: ICSE, pp. 1427–1430 (2012)Google Scholar
  6. 6.
    Marek, L., Villazón, A., Zheng, Y., Ansaloni, D., Binder, W., Qi, Z.: DiSL: a domain-specific language for bytecode instrumentation. In: AOSD, pp. 239–250 (2012)Google Scholar
  7. 7.
    Zheng, Y., Bulej, L., Zhang, C., Kell, S., Ansaloni, D., Binder, W.: Dynamic optimization of bytecode instrumentation. In: VMIL, pp. 21–30 (2013)Google Scholar
  8. 8.
    Zheng, Y., Ansaloni, D., Marek, L., Sewe, A., Binder, W., Villazón, A., Tuma, P., Qi, Z., Mezini, M.: Turbo DiSL: partial evaluation for high-level bytecode instrumentation. In: Furia, C.A., Nanz, S. (eds.) TOOLS 2012. LNCS, vol. 7304, pp. 353–368. Springer, Heidelberg (2012). doi: 10.1007/978-3-642-30561-0_24 CrossRefGoogle Scholar
  9. 9.
    Marek, L., Kell, S., Zheng, Y., Bulej, L., Binder, W., Tůma, P., Ansaloni, D., Sarimbekov, A., Sewe, A.: ShadowVM: robust and comprehensive dynamic program analysis for the Java platform. In: GPCE, pp. 105–114 (2013)Google Scholar
  10. 10.
    Kell, S., Ansaloni, D., Binder, W., Marek, L.: The JVM is not observable enough (and what to do about it). In: VMIL, pp. 33–38 (2012)Google Scholar
  11. 11.
    Unkel, C., Lam, M.S.: Automatic inference of stationary fields: a generalization of Java’s final fields. In: POPL, pp. 183–195 (2008)Google Scholar
  12. 12.
    Nelson, S., Pearce, D.J., Noble, J.: Profiling object initialization for Java. In: RV, pp. 292–307 (2012)Google Scholar
  13. 13.
    Sun, H., Zheng, Y., Bulej, L., Villazón, A., Qi, Z., Tůma, P., Binder, W.: A programming model and framework for comprehensive dynamic analysis on Android. In: MODULARITY, pp. 133–145 (2015)Google Scholar
  14. 14.
    Masuhara, H., Kiczales, G., Dutchyn, C.: A compilation and optimization model for aspect-oriented programs. In: Hedin, G. (ed.) CC 2003. LNCS, vol. 2622, pp. 46–60. Springer, Heidelberg (2003). doi: 10.1007/3-540-36579-6_4 CrossRefGoogle Scholar
  15. 15.
    Chen, F., Meredith, P.O., Jin, D., Rosu, G.: Efficient formalism-independent monitoring of parametric properties. In: ASE, pp. 383–394 (2009)Google Scholar
  16. 16.
    Jin, D., Meredith, P.O., Griffith, D., Rosu, G.: Garbage collection for monitoring parametric properties. In: PLDI, pp. 415–424 (2011)Google Scholar
  17. 17.
    Jones, N.D., Gomard, C.K., Sestoft, P.: Partial Evaluation and Automatic Program Generation. Prentice Hall, Englewood Cliffs (1993)MATHGoogle Scholar
  18. 18.
    Shali, A., Cook, W.R.: Hybrid partial evaluation. In: OOPSLA, pp. 375–390 (2011)Google Scholar
  19. 19.
    Albert, E., Gómez-Zamalloa, M., Hubert, L., Puebla, G.: Verification of Java bytecode using analysis and transformation of logic programs. In: Hanus, M. (ed.) PADL 2007. LNCS, vol. 4354, pp. 124–139. Springer, Heidelberg (2006). doi: 10.1007/978-3-540-69611-7_8 CrossRefGoogle Scholar
  20. 20.
    Hermenegildo, M.V., Puebla, G., Bueno, F., López-García, P.: Integrated program debugging, verification, and optimization using abstract interpretation (and the Ciao system preprocessor). Sci. Comput. Program. 58, 115–140 (2005)MathSciNetCrossRefMATHGoogle Scholar
  21. 21.
    Hao, H., Singh, V., Du, W.: On the effectiveness of API-level access control using bytecode rewriting in Android. In: CCS, pp. 25–36 (2013)Google Scholar
  22. 22.
    Hornyack, P., Han, S., Jung, J., Schechter, S., Wetherall, D.: These aren’t the droids you’re looking for: retrofitting Android to protect data from imperious applications. In: CCS, pp. 639–652 (2011)Google Scholar
  23. 23.
    Dietz, M., Shekhar, S., Pisetsky, Y., Shu, A., Wallach, D.S.: Quire: Lightweight provenance for smart phone operating systems. In: USENIX Security, pp. 23:1–23:16 (2011)Google Scholar
  24. 24.
    Yan, L.K., Yin, H.: DroidScope: seamlessly reconstructing the OS and Dalvik semantic views for dynamic Android malware analysis. In: USENIX Security, pp. 29:1–29:16 (2012)Google Scholar
  25. 25.
    Würthinger, T., Ansaloni, D., Binder, W., Wimmer, C., Mössenböck, H.: Safe and atomic run-time code evolution for Java and its application to dynamic AOP. In: OOPSLA, pp. 825–844 (2011)Google Scholar

Copyright information

© Springer International Publishing AG 2016

Authors and Affiliations

  • Andrea Rosà
    • 1
  • Yudi Zheng
    • 1
  • Haiyang Sun
    • 1
  • Omar Javed
    • 1
  • Walter Binder
    • 1
  1. 1.Faculty of InformaticsUniversità della Svizzera italiana (USI)LuganoSwitzerland

Personalised recommendations