Version 1
: Received: 29 September 2024 / Approved: 30 September 2024 / Online: 2 October 2024 (04:56:20 CEST)
How to cite:
Yin, X.; Huang, Z.; Kan, S.; Shen, G. SafeMD:Ownership-based Safe Memory Deallocation for C Programs. Preprints2024, 2024092413. https://doi.org/10.20944/preprints202409.2413.v1
Yin, X.; Huang, Z.; Kan, S.; Shen, G. SafeMD:Ownership-based Safe Memory Deallocation for C Programs. Preprints 2024, 2024092413. https://doi.org/10.20944/preprints202409.2413.v1
Yin, X.; Huang, Z.; Kan, S.; Shen, G. SafeMD:Ownership-based Safe Memory Deallocation for C Programs. Preprints2024, 2024092413. https://doi.org/10.20944/preprints202409.2413.v1
APA Style
Yin, X., Huang, Z., Kan, S., & Shen, G. (2024). SafeMD:Ownership-based Safe Memory Deallocation for C Programs. Preprints. https://doi.org/10.20944/preprints202409.2413.v1
Chicago/Turabian Style
Yin, X., Shuanglong Kan and Guohua Shen. 2024 "SafeMD:Ownership-based Safe Memory Deallocation for C Programs" Preprints. https://doi.org/10.20944/preprints202409.2413.v1
Abstract
Rust is a relatively new programming language that aims to provide memory safety at compile time. It introduces a novel ownership system which enforces automatic deallocation of unused resources without using the garbage collector. In light of Rust's promise of safety, a natural question arises about the possible benefits of exploiting ownership to ensure memory safety of C programs. In our previous work, we developed a formal ownership checker to verify whether a C program follows ownership constraints. A C program that satisfies the ownership constraints is free of dangling pointers. In this paper, we further propose a static ownership-based safe memory deallocation approach, named SafeMD, to ensure memory-leak free in the C programs that satisfy ownership constraints defined in prior formal ownership checker. Benefitting from the C programs satisfying ownership constraints, SafeMD obviates alias and inter-procedural analysis during the finding of fixing patches. Also, the patches generated by SafeMD make the input C programs still satisfy ownership constraints. Usually, a C program that satisfies the ownership constraints is safer than its normal version. Our evaluation shows that SafeMD is effective in fixing memory leaks of C programs that satisfy ownership constraints.
Copyright:
This is an open access article distributed under the Creative Commons Attribution License which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.