Abstract
A self-certifying compiler is designed to generate a correctness proof for each optimization performed during compilation. The generated proofs are checked automatically by an independent proof validator. The outcome is formally verified compilation, achieved without formally verifying the compiler. This paper describes the design and implementation of a self-certifying compilation framework for WebAssembly, a new intermediate language supported by all major browsers.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Notes
- 1.
The implementation is available as open source at https://github.com/nokia/web-assembly-self-certifying-compilation-framework.
- 2.
The full specification is at https://webassembly.github.io/spec/.
- 3.
- 4.
The formal statements follow Dijkstra-Scholten convention [9], where \([\varphi ]\) indicates that the expression \(\varphi \) is valid. We use \(d(X,Y,\ldots )\) to abbreviate \((d(X),d(Y),\ldots )\).
- 5.
The full correspondence for edge \(e_3\) is that \(K,G,M=K',G',M'\) (stack, global, and main memories are identical) and that \(L[0]=L'[0]\), \(L[1]=L'[3]\), and \(L[2]=L'[5]\).
- 6.
Excluding comments. Measured with cloc: https://github.com/AlDanial/cloc.
- 7.
References
Barrett, C.W., Fang, Y., Goldberg, B., Hu, Y., Pnueli, A., Zuck, L.D.: TVOC: a translation validator for optimizing compilers. In: CAV, pp. 291–295 (2005)
Barthe, G., Demange, D., Pichardie, D.: Formal verification of an SSA-based middle-end for CompCert. ACM Trans. Program. Lang. Syst. 36(1), 4 (2014)
Benton, N.: Simple relational correctness proofs for static analyses and program transformations. In: POPL, pp. 14–25 (2004)
Bevier, W.R., Hunt, W.A., Moore, J.S., Young, W.D.: An approach to systems verification. J. Autom. Reasoning 5(4), 411–428 (1989)
Blum, M., Kannan, S.: Designing programs that check their work. J. ACM 42(1), 269–291 (1995)
Churchill, B.R., Padon, O., Sharma, R., Aiken, A.: Semantic program alignment for equivalence checking. In: PLDI, pp. 1027–1040 (2019)
Cytron, R., Ferrante, J., Rosen, B.K., Wegman, M.N., Zadeck, F.K.: Efficiently computing static single assignment form and the control dependence graph. ACM Trans. Program. Lang. Syst. 13(4), 451–490 (1991)
Dahiya, M., Bansal, S.: Modeling undefined behaviour semantics for checking equivalence across compiler optimizations. In: HVC, pp. 19–34 (2017)
Dijkstra, E.W., Scholten, C.S.: Predicate calculus and program semantics. In: Texts and Monographs in Computer Science, Springer, New York (1990). https://doi.org/10.1007/978-1-4612-3228-5
Fedyukovich, G., Gurfinkel, A., Sharygina, N.: Automated discovery of simulation between programs. In: Davis, M., Fehnker, A., McIver, A., Voronkov, A. (eds.) LPAR 2015. LNCS, vol. 9450, pp. 606–621. Springer, Heidelberg (2015). https://doi.org/10.1007/978-3-662-48899-7_42
Gjomemo, R., Namjoshi, K.S., Phung, P.H., Venkatakrishnan, V.N., Zuck, L.D.: From verification to optimizations. In: D’Souza, D., Lal, A., Larsen, K.G. (eds.) VMCAI 2015. LNCS, vol. 8931, pp. 300–317. Springer, Heidelberg (2015). https://doi.org/10.1007/978-3-662-46081-8_17
Godlin, B., Strichman, O.: Regression verification. In: Proceedings of the 46th Design Automation Conference, DAC 2009, San Francisco, CA, USA, July 26–31, 2009, pp. 466–471 (2009)
Godlin, B., Strichman, O.: Regression verification: proving the equivalence of similar programs. Softw. Test., Verif. Reliab. 23(3), 241–258 (2013)
Haas, A., et al.: Bringing the web up to speed with WebAssembly. In: PLDI, pp. 185–200 (2017)
Jourdan, J., Pottier, F., Leroy, X.: Validating LR(1) parsers. In: ESOP, pp. 397–416 (2012)
Kang, J., Kim, Y., et al.: Crellvm: verified credible compilation for LLVM. In: PLDI, pp. 631–645 (2018)
Lahiri, S.K., Hawblitzel, C., Kawaguchi, M., Rebêlo, H.: SYMDIFF: a language-agnostic semantic diff tool for imperative programs. In: CAV, pp. 712–717 (2012)
Leroy, X.: Formal certification of a compiler back-end or: programming a compiler with a proof assistant. In: POPL, pp. 42–54. ACM (2006)
Leroy, X.: Formal verification of a realistic compiler. Commun. ACM 52(7), 107–115 (2009)
Marinov, D.: Credible Compilation. Master’s thesis, Massachusetts Institute of Technology (2000)
McCarthy, J., Painter, J.: Correctness of a compiler for arithmetic expressions, pp. 33–41. American Mathematical Society (1967)
de Moura, L., Bjørner, N.: Z3: an efficient SMT solver. In: Ramakrishnan, C.R., Rehof, J. (eds.) TACAS 2008. LNCS, vol. 4963, pp. 337–340. Springer, Heidelberg (2008). https://doi.org/10.1007/978-3-540-78800-3_24
Namjoshi, K.S.: Certifying model checkers. In: CAV, pp. 2–13 (2001)
Namjoshi, K.S.: Witnessing an SSA transformation. In: VeriSure Workshop, CAV (2014). https://kedar-namjoshi.github.io/papers/Namjoshi-VeriSure-CAV-2014.pdf
Namjoshi, K.S., Singhania, N.: Loopy: Programmable and formally verified loop transformations. In: SAS, pp. 383–402 (2016)
Namjoshi, K.S., Tagliabue, G., Zuck, L.D.: A witnessing compiler: a proof of concept. In: RV, pp. 340–345 (2013)
Namjoshi, K.S., Zuck, L.D.: Witnessing program transformations. In: Logozzo, F., Fähndrich, M. (eds.) SAS 2013. LNCS, vol. 7935, pp. 304–323. Springer, Heidelberg (2013). https://doi.org/10.1007/978-3-642-38856-9_17
Necula, G.: Translation validation of an optimizing compiler. In: (PLDI) 2000, pp. 83–95 (2000)
Peled, D.A., Pnueli, A., Zuck, L.D.: From falsification to verification. In: FSTTCS, pp. 292–304 (2001)
Pnueli, A., Shtrichman, O., Siegel, M.: The code validation tool (CVT)- automatic verification of a compilation process. Software Tools Technol. Transfer 2(2), 192–201 (1998)
Rinard, M.: Credible Compilation. Tech. Rep. MIT-LCS-TR-776, MIT (1999)
Samet, H.: Automatically proving the correctness of translations involving optimized code - research sponsored by Advanced Research Projects Agency, ARPA order no. 2494. Ph.D. thesis, Stanford University (1975)
Strichman, O., Veitsman, M.: Regression verification for unbalanced recursive functions. In: Fitzgerald, J., Heitmeyer, C., Gnesi, S., Philippou, A. (eds.) FM 2016. LNCS, vol. 9995, pp. 645–658. Springer, Cham (2016). https://doi.org/10.1007/978-3-319-48989-6_39
Zaks, A., Pnueli, A.: Program analysis for compiler validation. In: PASTE, pp. 1–7 (2008)
Zhang, L., Malik, S.: Validating SAT solvers using an independent resolution-based checker: practical implementations and other applications. In: DATE, pp. 10880–10885 (2003)
Zhao, J., Nagarakatte, S., Martin, M.M.K., Zdancewic, S.: Formal verification of SSA-based optimizations for LLVM. In: PLDI 2013, pp. 175–186 (2013)
Zuck, L.D., Pnueli, A., Goldberg, B., Barrett, C.W., Fang, Y., Hu, Y.: Translation and run-time validation of loop transformations. Formal Methods Syst. Des. 27(3), 335–360 (2005)
Acknowledgments
This material is based upon work supported by the National Science Foundation under Grant CCF-1563393. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation.
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2021 Springer Nature Switzerland AG
About this paper
Cite this paper
Namjoshi, K.S., Xue, A. (2021). A Self-certifying Compilation Framework for WebAssembly. In: Henglein, F., Shoham, S., Vizel, Y. (eds) Verification, Model Checking, and Abstract Interpretation. VMCAI 2021. Lecture Notes in Computer Science(), vol 12597. Springer, Cham. https://doi.org/10.1007/978-3-030-67067-2_7
Download citation
DOI: https://doi.org/10.1007/978-3-030-67067-2_7
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-030-67066-5
Online ISBN: 978-3-030-67067-2
eBook Packages: Computer ScienceComputer Science (R0)