MSWasm: Soundly Enforcing Memory-Safe Execution of Unsafe Code

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Michael, Alexandra E., Gollamudi, Anitha, Bosamiya, Jay, Disselkoen, Craig, Denlinger, Aidan, Watt, Conrad, Parno, Bryan, Patrignani, Marco, Vassena, Marco, Stefan, Deian
Format: Preprint
Published: 2022
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866915939610525696
author Michael, Alexandra E.
Gollamudi, Anitha
Bosamiya, Jay
Disselkoen, Craig
Denlinger, Aidan
Watt, Conrad
Parno, Bryan
Patrignani, Marco
Vassena, Marco
Stefan, Deian
author_facet Michael, Alexandra E.
Gollamudi, Anitha
Bosamiya, Jay
Disselkoen, Craig
Denlinger, Aidan
Watt, Conrad
Parno, Bryan
Patrignani, Marco
Vassena, Marco
Stefan, Deian
contents Most programs compiled to WebAssembly (Wasm) today are written in unsafe languages like C and C++. Unfortunately, memory-unsafe C code remains unsafe when compiled to Wasm -- and attackers can exploit buffer overflows and use-after-frees in Wasm almost as easily as they can on native platforms. Memory-Safe WebAssembly (MSWasm) proposes to extend Wasm with language-level memory-safety abstractions to precisely address this problem. In this paper, we build on the original MSWasm position paper to realize this vision. We give a precise and formal semantics of MSWasm, and prove that well-typed MSWasm programs are, by construction, robustly memory safe. To this end, we develop a novel, language-independent memory-safety property based on colored memory locations and pointers. This property also lets us reason about the security guarantees of a formal C-to-MSWasm compiler -- and prove that it always produces memory-safe programs (and preserves the semantics of safe programs). We use these formal results to then guide several implementations: Two compilers of MSWasm to native code, and a C-to-MSWasm compiler (that extends Clang). Our MSWasm compilers support different enforcement mechanisms, allowing developers to make security-performance trade-offs according to their needs. Our evaluation shows that the overhead of enforcing memory safety in software ranges from 22% (enforcing spatial safety alone) to 198% (enforcing full memory safety) on the PolyBenchC suite. More importantly, MSWasm's design makes it easy to swap between enforcement mechanisms; as fast (especially hardware-based) enforcement techniques become available, MSWasm will be able to take advantage of these advances almost for free.
format Preprint
id arxiv_https___arxiv_org_abs_2208_13583
institution arXiv
publishDate 2022
record_format arxiv
spellingShingle MSWasm: Soundly Enforcing Memory-Safe Execution of Unsafe Code
Michael, Alexandra E.
Gollamudi, Anitha
Bosamiya, Jay
Disselkoen, Craig
Denlinger, Aidan
Watt, Conrad
Parno, Bryan
Patrignani, Marco
Vassena, Marco
Stefan, Deian
Cryptography and Security
Programming Languages
Most programs compiled to WebAssembly (Wasm) today are written in unsafe languages like C and C++. Unfortunately, memory-unsafe C code remains unsafe when compiled to Wasm -- and attackers can exploit buffer overflows and use-after-frees in Wasm almost as easily as they can on native platforms. Memory-Safe WebAssembly (MSWasm) proposes to extend Wasm with language-level memory-safety abstractions to precisely address this problem. In this paper, we build on the original MSWasm position paper to realize this vision. We give a precise and formal semantics of MSWasm, and prove that well-typed MSWasm programs are, by construction, robustly memory safe. To this end, we develop a novel, language-independent memory-safety property based on colored memory locations and pointers. This property also lets us reason about the security guarantees of a formal C-to-MSWasm compiler -- and prove that it always produces memory-safe programs (and preserves the semantics of safe programs). We use these formal results to then guide several implementations: Two compilers of MSWasm to native code, and a C-to-MSWasm compiler (that extends Clang). Our MSWasm compilers support different enforcement mechanisms, allowing developers to make security-performance trade-offs according to their needs. Our evaluation shows that the overhead of enforcing memory safety in software ranges from 22% (enforcing spatial safety alone) to 198% (enforcing full memory safety) on the PolyBenchC suite. More importantly, MSWasm's design makes it easy to swap between enforcement mechanisms; as fast (especially hardware-based) enforcement techniques become available, MSWasm will be able to take advantage of these advances almost for free.
title MSWasm: Soundly Enforcing Memory-Safe Execution of Unsafe Code
topic Cryptography and Security
Programming Languages
url https://arxiv.org/abs/2208.13583