Abstract
We present a static analysis of endian portability for C programs. Our analysis can infer that a given program, or two syntactically close versions thereof, compute the same outputs when run with the same inputs on platforms with different byte-orders, a.k.a. endiannesses. We target low-level C programs that abuse C pointers and unions, hence rely on implementation-specific behaviors undefined in the C standard.
Our method is based on abstract interpretation, and parametric in the choice of a numerical abstract domain. We first present a novel concrete collecting semantics, relating the behaviors of two versions of a program, running on platforms with different endiannesses. We propose a joint memory abstraction, able to infer equivalence relations between little- and big-endian memories. We introduce a novel symbolic predicate domain to infer relations between individual bytes of the variables in the two programs, which has near-linear cost, and the right amount of relationality to express (bitwise) arithmetic properties relevant to endian portability. We implemented a prototype static analyzer, able to scale to large real-world industrial software, with zero false alarms.
This work is performed as part of a collaborative partnership between Sorbonnne Université/CNRS (LIP6) and Airbus. This work is partially supported by the European Research Council under the Consolidator Grant Agreement 681393 – MOPSA.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Similar content being viewed by others
References
DO-331: Model-based development and verification supplement to DO-178C and DO-278A (2011)
AT & T, The Santa Cruz Operation Inc.: System V application binary interface (1997)
Berry, G.: SCADE: synchronous design and validation of embedded control software. In: Ramesh, S., Sampath, P. (eds.) Next Generation Design and Verification Methodologies for Distributed Embedded Control Systems, pp. 19–33. Springer, Dordrecht (2007). https://doi.org/10.1007/978-1-4020-6254-4_2
Brahmi, A., Delmas, D., Essoussi, M.H., Randimbivololona, F., Atki, A., Marie, T.: Formalise to automate: deployment of a safe and cost-efficient process for avionics software. In: 9th European Congress on Embedded Real Time Software and Systems (ERTS 2018), Toulouse, France, January 2018. https://hal.archives-ouvertes.fr/hal-01708332
Brevnov, E., Domeika, M., Loenko, M., Ozhdikhin, P., Tang, X., Willkinson, H.: BEC: bi-endian compiler technology for porting byte order sensitive applications 16(1), 42–61 (2012)
Brown, N.: Sparse: a look under the hood (2016). https://lwn.net/Articles/689907/
Chevalier, M.: Proving the security of software-intensive embedded systems by abstract interpretation. Ph.D. thesis, Université PSL, November 2020
Chevalier, M., Feret, J.: Sharing ghost variables in a collection of abstract domains. In: Beyer, D., Zufferey, D. (eds.) VMCAI 2020. LNCS, vol. 11990, pp. 158–179. Springer, Cham (2020). https://doi.org/10.1007/978-3-030-39322-9_8
Cohen, D.: On holy wars and a plea for peace. Computer 14(10), 48–54 (1981). https://doi.org/10.1109/C-M.1981.220208
Cousot, P., Cousot, R.: Abstract interpretation: a unified lattice model for static analysis of programs by construction or approximation of fixpoints. In: POPL 1977, pp. 238–252. ACM, January 1977
Cousot, P., Halbwachs, N.: Automatic discovery of linear restraints among variables of a program. In: POPL 1978, pp. 84–97. ACM (1978)
Delmas, D., Souyris, J.: Astrée: from research to industry. In: Nielson, H.R., Filé, G. (eds.) SAS 2007. LNCS, vol. 4634, pp. 437–451. Springer, Heidelberg (2007). https://doi.org/10.1007/978-3-540-74061-2_27
Delmas, D., Goubault, E., Putot, S., Souyris, J., Tekkal, K., Védrine, F.: Towards an industrial use of FLUCTUAT on safety-critical avionics software. In: Alpuente, M., Cook, B., Joubert, C. (eds.) FMICS 2009. LNCS, vol. 5825, pp. 53–69. Springer, Heidelberg (2009). https://doi.org/10.1007/978-3-642-04570-7_6
Delmas, D., Miné, A.: Analysis of program differences with numerical abstract interpretation. In: PERR 2019, Prague, Czech Republic, April 2019
Delmas, D., Miné, A.: Analysis of software patches using numerical abstract interpretation. In: Chang, B.-Y.E. (ed.) SAS 2019. LNCS, vol. 11822, pp. 225–246. Springer, Cham (2019). https://doi.org/10.1007/978-3-030-32304-2_12
Delmas, D., Ouadjaout, A., Miné, A.: Artifact for static analysis of endian portability by abstract. Interpretation (2021). https://doi.org/10.5281/zenodo.5206794
Granger, P.: Static analysis of arithmetic congruences. Int. J. Comput. Math. 30, 165–199 (1989)
Gross, J., Ganga, I., Sridhar, T.: Geneve: generic network virtualization encapsulation. RFC 8926, RFC Editor, November 2020
ISO/IEC JTC1/SC22/WG14 working group: C standard. Technical report 1124, ISO & IEC (2007)
Journault, M., Miné, A., Monat, R., Ouadjaout, A.: Combinations of reusable abstract domains for a multilingual static analyzer. In: Chakraborty, S., Navas, J.A. (eds.) VSTTE 2019. LNCS, vol. 12031, pp. 1–18. Springer, Cham (2020). https://doi.org/10.1007/978-3-030-41600-3_1
Kápl, R., Parízek, P.: Endicheck: dynamic analysis for detecting endianness bugs. In: TACAS 2020. LNCS, vol. 12079, pp. 254–270. Springer, Cham (2020). https://doi.org/10.1007/978-3-030-45237-7_15
Mahameed, S.: Mellanox, mlx5 RDMA net device support (2017). https://lwn.net/Articles/720074/
Mellanox Technologies: mlx5 core library (2020). https://github.com/torvalds/linux/tree/master/drivers/net/ethernet/mellanox/mlx5/core
Miné, A.: Field-sensitive value analysis of embedded C programs with union types and pointer arithmetics. In: Proceedings of the ACM SIGPLAN/SIGBED Conference on Languages, Compilers, and Tools for Embedded Systems (LCTES 2006), pp. 54–63. ACM, June 2006
Miné, A.: Symbolic methods to enhance the precision of numerical abstract domains. In: Emerson, E.A., Namjoshi, K.S. (eds.) VMCAI 2006. LNCS, vol. 3855, pp. 348–363. Springer, Heidelberg (2005). https://doi.org/10.1007/11609773_23
Miné, A.: Abstract domains for bit-level machine integer and floating-point operations. In: Proceedings of the 4th International Workshop on Invariant Generation (WING 2012), p. 16. No. HW-MACS-TR-0097, Computer Science, School of Mathematical and Computer Science, Heriot-Watt University, UK, June 2012
Miné, A.: Static analysis by abstract interpretation of concurrent programs. Technical report, École normale supérieure, May 2013
Miné, A., Delmas, D.: Towards an industrial use of sound static analysis for the verification of concurrent embedded avionics software. In: Proceedings of the 15th International Conference on Embedded Software (EMSOFT 2015), pp. 65–74. IEEE CS Press, October 2015
Miné, A., Ouadjaout, A., Journault, M.: Design of a modular platform for static analysis. In: The Ninth Workshop on Tools for Automatic Program Analysis (TAPAS 2018), Fribourg-en-Brisgau, Germany, August 2018. https://hal.sorbonne-universite.fr/hal-01870001
Nita, M., Grossman, D.: Automatic transformation of bit-level C code to support multiple equivalent data layouts. In: Hendren, L. (ed.) CC 2008. LNCS, vol. 4959, pp. 85–99. Springer, Heidelberg (2008). https://doi.org/10.1007/978-3-540-78791-4_6
Red Hat Inc: Generic network virtualization encapsulation (2017). https://github.com/torvalds/linux/blob/master/drivers/net/geneve.c
S.C of RTCA: DO-178C: Software considerations in airborne systems and equipment certification (2011)
Souyris, J., Wiels, V., Delmas, D., Delseny, H.: Formal verification of avionics software products, pp. 532–546 (2009)
The LineageOS Project: Lineageos (2020). https://github.com/LineageOS/
The Squashfs Project: Squashfs (2020). https://github.com/LineageOS/android_kernel_sony_msm8960t/tree/lineage-18.1/fs/squashfs
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
Delmas, D., Ouadjaout, A., Miné, A. (2021). Static Analysis of Endian Portability by Abstract Interpretation. In: Drăgoi, C., Mukherjee, S., Namjoshi, K. (eds) Static Analysis. SAS 2021. Lecture Notes in Computer Science(), vol 12913. Springer, Cham. https://doi.org/10.1007/978-3-030-88806-0_5
Download citation
DOI: https://doi.org/10.1007/978-3-030-88806-0_5
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-030-88805-3
Online ISBN: 978-3-030-88806-0
eBook Packages: Computer ScienceComputer Science (R0)