skip to main content
10.1145/3297858.3304017acmconferencesArticle/Chapter ViewAbstractPublication PagesasplosConference Proceedingsconference-collections
research-article
Public Access

BOGO: Buy Spatial Memory Safety, Get Temporal Memory Safety (Almost) Free

Published: 04 April 2019 Publication History

Abstract

A memory safety violation occurs when a program has an out-of-bound (spatial safety) or use-after-free (temporal safety) memory access. Given its importance as a security vulnerability, recent Intel processors support hardware-accelerated bound checks, called Memory Protection Extensions (MPX). Unfortunately, MPX provides no temporal safety. This paper presents BOGO, a lightweight full memory safety enforcement scheme that transparently guarantees temporal safety on top of MPX's spatial safety. Instead of tracking separate metadata for temporal safety, BOGO reuses the bounds metadata maintained by MPX for both spatial and temporal safety. On free, BOGO scans the MPX bound tables to invalidate the bound of dangling pointers; any following use-after-free error can be detected by MPX as an out-of-bound error. Since scanning the entire MPX bound tables could be expensive, BOGO tracks a small set of hot MPX bound table pages to check on free, and relies on the page fault mechanism to detect any potentially missing dangling pointer, ensuring sound temporal safety protection. Our evaluation shows that BOGO provides full memory safety at 60% runtime overhead and at 36% memory overhead for SPEC CPU 2006 benchmarks. We also show that BOGO incurs reasonable 2.7x slowdown for the worst-case malloc-free intensive benchmarks; and moderate 1.34x overhead for real-world applications.

References

[1]
{n. d.}. 2011 CWE/SANS Top 25 Most Dangerous Software Errors. ({n. d.}). http://cwe.mitre.org/top25/.
[2]
{n. d.}. ab - Apache HTTP server benchmarking tool. ({n. d.}). https://httpd.apache.org/docs/2.4/programs/ab.html.
[3]
{n. d.}. DangSan Open Source Implementation. ({n. d.}). https://github.com/vusec/dangsan.
[4]
{n. d.}. NIST Software Assurance Reference Dataset Project. ({n. d.}). https://samate.nist.gov/SARD.
[5]
{n. d.}. Scriptable database and system performance benchmark. ({n. d.}). https://github.com/akopytov/sysbench.
[6]
{n. d.}. SoftBound+CETS Open Source Implementation. ({n. d.}). https://github.com/santoshn/softboundcets-34.
[7]
{n. d.}. Spec2006 AddressSanitizer Patch. ({n. d.}). https://github.com/google/sanitizers/ blob/master/addresssanitizer/ spec/spec2006-asan.patch.
[8]
{n. d.}. Struct Bound Narrowing. ({n. d.}). https://gcc.gnu.org/wiki/Intel MPX support in the GCC compiler# Narrowing.
[9]
Periklis Akritidis, Manuel Costa, Miguel Castro, and Steven Hand. 2009. Baggy Bounds Checking: An Efficient and Backwards-compatible Defense Against Out-of-bounds Errors. In Proceedings of the 18th Conference on USENIX Security Symposium (SSYM'09). 51--66.
[10]
Todd M Austin, Scott E Breach, and Gurindar S Sohi. 1994. Efficient detection of all pointer and array access errors. Vol. 29. ACM.
[11]
Tyler Bletsch, Xuxian Jiang, Vince W Freeh, and Zhenkai Liang. 2011. Jump-oriented programming: a new class of code-reuse attack. In Proceedings of the 6th ACM Symposium on Information, Computer and Communications Security. ACM, 30--40.
[12]
Nathan Burow, Derrick McKee, Scott A Carr, and Mathias Payer. 2017. CUP: Comprehensive User-Space Protection for C/C++. arXiv preprint arXiv:1704.05004 (to appear in AsiaCCS'18) (2017).
[13]
Juan Caballero, Gustavo Grieco, Mark Marron, and Antonio Nappa. 2012. Undangle: early detection of dangling pointers in use-after-free and double-free vulnerabilities. In Proceedings of the 2012 International Symposium on Software Testing and Analysis. ACM, 133--143.
[14]
Stephen Checkoway, Lucas Davi, Alexandra Dmitrienko, Ahmad-Reza Sadeghi, Hovav Shacham, and Marcel Winandy. 2010. Return-oriented Programming Without Returns. In Proceedings of the 17th ACM Conference on Computer and Communications Security (CCS '10). ACM, New York, NY, USA, 559--572.
[15]
Xi Chen, Asia Slowinska, and Herbert Bos. 2016. On the Detection of Custom Memory Allocators in C Binaries. Empirical Softw. Engg. 21, 3 (June 2016), 753--777.
[16]
David Chisnall, Colin Rothwell, Robert NM Watson, Jonathan Woodruff, Munraj Vadera, SimonWMoore, Michael Roe, Brooks Davis, and Peter G Neumann. 2015. Beyond the PDP-11: Architectural support for a memory-safe C abstract machine. In ACM SIGPLAN Notices, Vol. 50. ACM, 117--130.
[17]
Tzi-cker Chiueh and Fu-Hau Hsu. 2001. RAD: A compile-time solution to buffer overflow attacks. In Distributed Computing Systems, 2001. 21st International Conference on. IEEE, 409--417.
[18]
Brian F. Cooper, Adam Silberstein, Erwin Tam, Raghu Ramakrishnan, and Russell Sears. 2010. Benchmarking Cloud Serving Systems with YCSB. In Proceedings of the 1st ACM Symposium on Cloud Computing (SoCC '10). ACM, New York, NY, USA, 143--154.
[19]
Crispan Cowan, Calton Pu, Dave Maier, JonathanWalpole, Peat Bakke, Steve Beattie, Aaron Grier, Perry Wagle, Qian Zhang, and Heather Hinton. 1998. Stackguard: automatic adaptive detection and prevention of buffer-overflow attacks. In Usenix Security, Vol. 98. 63--78.
[20]
John Criswell, Andrew Lenharth, Dinakar Dhurjati, and Vikram Adve. 2007. Secure Virtual Architecture: A Safe Execution Environment for Commodity Operating Systems. In Proceedings of Twenty-first ACM SIGOPS Symposium on Operating Systems Principles (SOSP '07). ACM, New York, NY, USA, 351--366.
[21]
Joe Devietti, Colin Blundell, Milo M. K. Martin, and Steve Zdancewic. 2008. Hardbound: Architectural Support for Spatial Safety of the C Programming Language. In Proceedings of the 13th International Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS XIII). 103--114.
[22]
Dinakar Dhurjati and Vikram Adve. 2006. Backwards-compatible Array Bounds Checking for C with Very Low Overhead. In Proceedings of the 28th International Conference on Software Engineering (ICSE '06). 162--171.
[23]
Dinakar Dhurjati and Vikram Adve. 2006. Efficiently detecting all dangling pointer uses in production servers. In Dependable Systems and Networks, 2006. DSN 2006. International Conference on. IEEE, 269-- 280.
[24]
Dinakar Dhurjati, Sumant Kowshik, and Vikram Adve. 2006. SAFECode: Enforcing Alias Analysis for Weakly Typed Languages. In Proceedings of the 27th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI '06). ACM, New York, NY, USA, 144--157.
[25]
Dinakar Dhurjati, Sumant Kowshik, Vikram Adve, and Chris Lattner. 2005. Memory Safety Without Garbage Collection for Embedded Applications. ACM Trans. Embed. Comput. Syst. 4, 1 (Feb. 2005), 73-- 111.
[26]
Gregory J Duck and Roland HC Yap. 2017. EffectiveSan: Type and Memory Error Detection using Dynamically Typed C/C++. arXiv preprint arXiv:1710.06125 (to appear in PLDI'18) (2017).
[27]
Google. 2017. AddressSanitizerUseAfterReturn. (2017). https://github. com/google/sanitizers/wiki/AddressSanitizerUseAfterReturn
[28]
Rajiv Gupta. 1993. Optimizing array bound checks using flow analysis. ACM Letters on Programming Languages and Systems (LOPLAS) 2, 1--4 (1993), 135--150.
[29]
Trevor Jim, J Gregory Morrisett, Dan Grossman, Michael W Hicks, James Cheney, and Yanling Wang. 2002. Cyclone: A Safe Dialect of C. In USENIX Annual Technical Conference, General Track. 275--288.
[30]
RichardWM Jones, Paul H J Kelly, Most C, and Uncaught Errors. 1997. Backwards-compatible bounds checking for arrays and pointers in C programs. In in Distributed Enterprise Applications. HP Labs Tech Report. 255--283.
[31]
Changhee Jung, Sangho Lee, Easwaran Raman, and Santosh Pande. 2014. Automated Memory Leak Detection for Production Use. In Proceedings of the 36th International Conference on Software Engineering.
[32]
Taddeus Kroes, Koen Koning, Erik van der Kouwe, Herbert Bos, and Cristiano Giuffrida. 2018. Delta Pointers: Buffer Overflow Checks Without the Checks. In Proceedings of the Thirteenth EuroSys Conference (EuroSys '18). ACM, New York, NY, USA, Article 22, 14 pages.
[33]
Chris Lattner and Vikram Adve. 2004. LLVM: A Compilation Framework for Lifelong Program Analysis & Transformation. In Proceedings of the International Symposium on Code Generation and Optimization: Feedback-directed and Runtime Optimization (CGO '04). 75--.
[34]
Byoungyoung Lee, Chengyu Song, Yeongjin Jang, TieleiWang, Taesoo Kim, Long Lu, and Wenke Lee. 2015. Preventing Use-after-free with Dangling Pointers Nullification. In NDSS.
[35]
Zhengyang Liu and John Criswell. 2017. Flexible and Efficient Memory Object Metadata. In Proceedings of the 2017 ACM SIGPLAN International Symposium on Memory Management (ISMM 2017). ACM, New York, NY, USA, 36--46.
[36]
Shan Lu, Zhenmin Li, Feng Qin, Lin Tan, Pin Zhou, and Yuanyuan Zhou. 2005. Bugbench: Benchmarks for evaluating bug detection tools. In Workshop on the evaluation of software defect detection tools, Vol. 5.
[37]
S.S. Muchnick. 1997. Advanced Compiler Design Implementation. Morgan Kaufmann Publishers.
[38]
Santosh Nagarakatte, Milo MK Martin, and Steve Zdancewic. 2015. Everything you want to know about pointer-based checking. In LIPIcs-Leibniz International Proceedings in Informatics, Vol. 32. Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik.
[39]
Santosh Nagarakatte, Milo M. K. Martin, and Steve Zdancewic. 2012. Watchdog: Hardware for Safe and Secure Manual Memory Management and Full Memory Safety. In Proceedings of the 39th Annual International Symposium on Computer Architecture (ISCA '12). 189--200.
[40]
Santosh Nagarakatte, Milo M. K. Martin, and Steve Zdancewic. 2014. WatchdogLite: Hardware-Accelerated Compiler-Based Pointer Checking. In Proceedings of Annual IEEE/ACM International Symposium on Code Generation and Optimization (CGO '14). 175:175--175:184.
[41]
Santosh Nagarakatte, Jianzhou Zhao, Milo M.K. Martin, and Steve Zdancewic. 2009. SoftBound: Highly Compatible and Complete Spatial Memory Safety for C. In Proceedings of the 2009 ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI '09). 245--258.
[42]
Santosh Nagarakatte, Jianzhou Zhao, Milo MK Martin, and Steve Zdancewic. 2010. CETS: compiler enforced temporal safety for C. In ACM Sigplan Notices, Vol. 45. ACM, 31--40.
[43]
Santosh Ganapati Nagarakatte. 2012. Practical low-overhead enforcement of memory safety for c programs. Ph.D. Dissertation. University of Pennsylvania.
[44]
George C Necula, Jeremy Condit, Matthew Harren, Scott McPeak, and Westley Weimer. 2005. CCured: Type-safe retrofitting of legacy software. ACM Transactions on Programming Languages and Systems (TOPLAS) 27, 3 (2005), 477--526.
[45]
Nicholas Nethercote and Julian Seward. 2007. Valgrind: A Framework for Heavyweight Dynamic Binary Instrumentation. In Proceedings of the 2007 ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI '07). 89--100.
[46]
Gene Novark, Emery D. Berger, and Benjamin G. Zorn. 2009. Efficiently and precisely locating memory leaks and bloat. In Proc. of the 30th PLDI.
[47]
Oleksii Oleksenko, Dmitrii Kuvaiskii, Pramod Bhatotia, Pascal Felber, and Christof Fetzer. 2017. Intel MPX Explained: An Empirical Study of Intel MPX and Software-based Bounds Checking Approaches. CoRR abs/1702.00719 (2017). arXiv:1702.00719 http://arxiv.org/abs/ 1702.00719
[48]
Marco Prandini and Marco Ramilli. 2012. Return-oriented programming. IEEE Security & Privacy 10, 6 (2012), 84--87.
[49]
Feng Qin, Shan Lu, and Yuanyuan Zhou. 2005. SafeMem: Exploiting ECC-memory for detecting memory leaks and memory corruption during production runs. In High-Performance Computer Architecture, 2005. HPCA-11. 11th International Symposium on. IEEE, 291--302.
[50]
Olatunji Ruwase and Monica S Lam. 2004. A Practical Dynamic Buffer Overflow Detector. In NDSS, Vol. 2004. 159--169.
[51]
Pawel Sarbinowski, Vasileios P Kemerlis, Cristiano Giuffrida, and Elias Athanasopoulos. 2016. VTPin: practical VTable hijacking protection for binaries. In Proceedings of the 32nd Annual Conference on Computer Security Applications. ACM, 448--459.
[52]
Mark Seaborn and Thomas Dullien. 2015. Exploiting the DRAM rowhammer bug to gain kernel privileges. Black Hat (2015), 7--9.
[53]
Konstantin Serebryany, Derek Bruening, Alexander Potapenko, and Dmitriy Vyukov. 2012. AddressSanitizer: A Fast Address Sanity Checker. In USENIX Annual Technical Conference. 309--318.
[54]
Konstantin Serebryany, Derek Bruening, Alexander Potapenko, and Dmitry Vyukov. 2012. AddressSanitizer: A Fast Address Sanity Checker. In Proceedings of the 2012 USENIX Conference on Annual Technical Conference (USENIX ATC'12). USENIX Association, Berkeley, CA, USA, 28--28. http://dl.acm.org/citation.cfm?id=2342821.2342849
[55]
Chengyu Song, Hyungon Moon, Monjur Alam, Insu Yun, Byoungyoung Lee, Taesoo Kim, Wenke Lee, and Yunheung Paek. 2016. HDFI: Hardware-Assisted Data-flow Isolation. In Security and Privacy (SP), 2016 IEEE Symposium on. IEEE, 1--17.
[56]
Yulei Sui, Ding Ye, Yu Su, and Jingling Xue. 2016. Eliminating redundant bounds checks in dynamic buffer overflow detection using weakest preconditions. IEEE Transactions on Reliability 65, 4 (2016), 1682--1699.
[57]
Laszlo Szekeres, Mathias Payer, Tao Wei, and Dawn Song. 2013. Sok: Eternal war in memory. In Security and Privacy (SP), 2013 IEEE Symposium on. IEEE, 48--62.
[58]
Minh Tran, Mark Etheridge, Tyler Bletsch, Xuxian Jiang, Vincent Freeh, and Peng Ning. 2011. On the Expressiveness of Return-into-libc Attacks. In Proceedings of the 14th International Conference on Recent Advances in Intrusion Detection (RAID'11). Springer-Verlag, Berlin, Heidelberg, 121--141.
[59]
Erik van der Kouwe, Vinod Nigade, and Cristiano Giuffrida. 2017. DangSan: Scalable Use-after-free Detection. In Proceedings of the Twelfth European Conference on Computer Systems. ACM, 405--419.
[60]
Victor van der Veen, Yanick Fratantonio, Martina Lindorfer, Daniel Gruss, Clementine Maurice, Giovanni Vigna, Herbert Bos, Kaveh Razavi, and Cristiano Giuffrida. 2016. Drammer: Deterministic Rowhammer Attacks on Mobile Platforms. In Proceedings of the 2016 ACM SIGSAC Conference on Computer and Communications Security (CCS '16). ACM, New York, NY, USA, 1675--1689.
[61]
Guru Venkataramani, Brandyn Roemer, Yan Solihin, and Milos Prvulovic. 2007. Memtracker: Efficient and programmable support for memory access monitoring and debugging. In High Performance Computer Architecture, 2007. HPCA 2007. IEEE 13th International Symposium on. IEEE, 273--284.
[62]
Xiaoxiao Wang, Mohammad Tehranipoor, and Jim Plusquellic. 2008. Detecting malicious inclusions in secure hardware: Challenges and solutions. In Hardware-Oriented Security and Trust, 2008. HOST 2008. IEEE International Workshop on. IEEE, 15--19.
[63]
John Wilander and Mariam Kamkar. 2003. A Comparison of Publicly Available Tools for Dynamic Buffer Overflow Prevention. In NDSS, Vol. 3. 149--162.
[64]
John Wilander, Nick Nikiforakis, Yves Younan, Mariam Kamkar, and Wouter Joosen. 2011. RIPE: Runtime Intrusion Prevention Evaluator. In Proceedings of the 27th Annual Computer Security Applications Conference (ACSAC '11). ACM, New York, NY, USA, 41--50.
[65]
Jonathan Woodruff, Robert NM Watson, David Chisnall, Simon W Moore, Jonathan Anderson, Brooks Davis, Ben Laurie, Peter G Neumann, Robert Norton, and Michael Roe. 2014. The CHERI capability model: Revisiting RISC in an age of risk. In Computer Architecture (ISCA), 2014 ACM/IEEE 41st International Symposium on. IEEE, 457-- 468.
[66]
Wei Xu, Daniel C DuVarney, and R Sekar. 2004. An efficient and backwards-compatible transformation to ensure memory safety of C programs. ACM SIGSOFT Software Engineering Notes 29, 6 (2004), 117--126.
[67]
Kaiyuan Yang, Matthew Hicks, Qing Dong, Todd Austin, and Dennis Sylvester. 2016. A2: Analog malicious hardware. In Security and Privacy (SP), 2016 IEEE Symposium on. IEEE, 18--37.
[68]
Ding Ye, Yu Su, Yulei Sui, and Jingling Xue. 2014. WPBound: Enforcing spatial memory safety efficiently at runtime with weakest preconditions. In Software Reliability Engineering (ISSRE), 2014 IEEE 25th International Symposium on. IEEE, 88--99.
[69]
Ding Ye, Yu Su, Yulei Sui, and Jingling Xue. 2014. WPBOUND: Enforcing Spatial Memory Safety Efficiently at Runtime withWeakest Preconditions. In Proceedings of the 2014 IEEE 25th International Symposium on Software Reliability Engineering (ISSRE '14). IEEE Computer Society, Washington, DC, USA, 88--99.
[70]
Suan Hsi Yong and Susan Horwitz. 2003. Protecting C programs from attacks via invalid pointer dereferences. In ACM SIGSOFT Software Engineering Notes, Vol. 28. ACM, 307--316.
[71]
Yves Younan. 2015. FreeSentry: protecting against use-after-free vulnerabilities due to dangling pointers. In NDSS.

Cited By

View all

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
ASPLOS '19: Proceedings of the Twenty-Fourth International Conference on Architectural Support for Programming Languages and Operating Systems
April 2019
1126 pages
ISBN:9781450362405
DOI:10.1145/3297858
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

Sponsors

In-Cooperation

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 04 April 2019

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. memory safety
  2. mpx

Qualifiers

  • Research-article

Funding Sources

Conference

ASPLOS '19

Acceptance Rates

ASPLOS '19 Paper Acceptance Rate 74 of 351 submissions, 21%;
Overall Acceptance Rate 535 of 2,713 submissions, 20%

Upcoming Conference

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)234
  • Downloads (Last 6 weeks)44
Reflects downloads up to 13 Jan 2025

Other Metrics

Citations

Cited By

View all

View Options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Login options

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media