Automated Code Repair to Ensure Spatial Memory Safety

William Klieber, R. Martins, Ryan Steele, Matt Churilla, Michael McCall, David Svoboda
{"title":"Automated Code Repair to Ensure Spatial Memory Safety","authors":"William Klieber, R. Martins, Ryan Steele, Matt Churilla, Michael McCall, David Svoboda","doi":"10.1109/APR52552.2021.00013","DOIUrl":null,"url":null,"abstract":"We present a technique for repairing C code to protect against potential violations of spatial memory safety. Many existing techniques can harden software against memory bugs as part of a compiler pass. However, this creates dependencies on the compiler and makes it difficult to fine-tune or even inspect the repairs. We propose an automated technique for repairing the source code to eliminate spatial memory vulnerabilities. Performing the repair at the source-code level introduces a new challenge: analysis and transformation are most easily done on an intermediate representation (IR), but existing techniques using IRs have fundamental limitations in regards to translating changes back to the level of source code. We break this challenge into two parts: (1) translating changes at the level of the IR to the abstract syntax tree (AST) level, and (2) translating changes at the AST level back to the original source-code text. Preemptively repairing potential memory bugs leads to a tradeoff between performance overhead and memory safety. While for safety-critical applications this trade-off may be acceptable, for other applications we can reduce the performance overhead by only repairing suspicious locations. We implemented our approach in a tool called ACR and show that it can repair spatial memory vulnerabilities on buggy programs from the Software Verification Competition. Additionally, we also ran ACR on medium-size programs and preliminary results show the scalability of ACR for thousands of lines of code. Finally, we integrated ACR with static analysis tools and show that the performance overhead is small when repairing only locations that are flagged by a static analyzer.","PeriodicalId":257468,"journal":{"name":"2021 IEEE/ACM International Workshop on Automated Program Repair (APR)","volume":"18 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2021-06-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"2","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"2021 IEEE/ACM International Workshop on Automated Program Repair (APR)","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1109/APR52552.2021.00013","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 2

Abstract

We present a technique for repairing C code to protect against potential violations of spatial memory safety. Many existing techniques can harden software against memory bugs as part of a compiler pass. However, this creates dependencies on the compiler and makes it difficult to fine-tune or even inspect the repairs. We propose an automated technique for repairing the source code to eliminate spatial memory vulnerabilities. Performing the repair at the source-code level introduces a new challenge: analysis and transformation are most easily done on an intermediate representation (IR), but existing techniques using IRs have fundamental limitations in regards to translating changes back to the level of source code. We break this challenge into two parts: (1) translating changes at the level of the IR to the abstract syntax tree (AST) level, and (2) translating changes at the AST level back to the original source-code text. Preemptively repairing potential memory bugs leads to a tradeoff between performance overhead and memory safety. While for safety-critical applications this trade-off may be acceptable, for other applications we can reduce the performance overhead by only repairing suspicious locations. We implemented our approach in a tool called ACR and show that it can repair spatial memory vulnerabilities on buggy programs from the Software Verification Competition. Additionally, we also ran ACR on medium-size programs and preliminary results show the scalability of ACR for thousands of lines of code. Finally, we integrated ACR with static analysis tools and show that the performance overhead is small when repairing only locations that are flagged by a static analyzer.
自动代码修复以确保空间内存安全
我们提出了一种修复C代码的技术,以防止潜在的违反空间内存安全。许多现有的技术都可以作为编译器通过的一部分来加强软件对内存错误的防范。然而,这会产生对编译器的依赖,并使微调甚至检查修复变得困难。我们提出了一种自动修复源代码的技术,以消除空间内存漏洞。在源代码级别执行修复引入了一个新的挑战:分析和转换最容易在中间表示(IR)上完成,但是使用IR的现有技术在将更改转换回源代码级别方面具有根本的限制。我们将这一挑战分为两部分:(1)将IR级别的更改翻译到抽象语法树(AST)级别,以及(2)将AST级别的更改翻译回原始源代码文本。先发制人地修复潜在的内存错误会导致在性能开销和内存安全之间进行权衡。虽然对于安全关键型应用程序,这种权衡是可以接受的,但对于其他应用程序,我们可以通过仅修复可疑位置来降低性能开销。我们在一个名为ACR的工具中实现了我们的方法,并表明它可以修复软件验证竞赛中有缺陷的程序的空间内存漏洞。此外,我们还在中等规模的程序上运行了ACR,初步结果显示了ACR对数千行代码的可伸缩性。最后,我们将ACR与静态分析工具集成在一起,并表明仅修复由静态分析器标记的位置时,性能开销很小。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 求助全文
来源期刊
自引率
0.00%
发文量
0
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:604180095
Book学术官方微信