Friend or Foe Inside? Exploring In-Process Isolation to Maintain Memory Safety for Unsafe Rust

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Gülmez, Merve, Nyman, Thomas, Baumann, Christoph, Mühlberg, Jan Tobias
Format: Preprint
Published: 2023
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866918155988762624
author Gülmez, Merve
Nyman, Thomas
Baumann, Christoph
Mühlberg, Jan Tobias
author_facet Gülmez, Merve
Nyman, Thomas
Baumann, Christoph
Mühlberg, Jan Tobias
contents Rust is a popular memory-safe systems programming language. In order to interact with hardware or call into non-Rust libraries, Rust provides \emph{unsafe} language features that shift responsibility for ensuring memory safety to the developer. Failing to do so, may lead to memory safety violations in unsafe code which can violate safety of the entire application. In this work we explore in-process isolation with Memory Protection Keys as a mechanism to shield safe program sections from safety violations that may happen in unsafe sections. Our approach is easy to use and comprehensive as it prevents heap and stack-based violations. We further compare process-based and in-process isolation mechanisms and the necessary requirements for data serialization, communication, and context switching. Our results show that in-process isolation can be effective and efficient, permits for a high degree of automation, and also enables a notion of application rewinding where the safe program section may detect and safely handle violations in unsafe code.
format Preprint
id arxiv_https___arxiv_org_abs_2306_08127
institution arXiv
publishDate 2023
record_format arxiv
spellingShingle Friend or Foe Inside? Exploring In-Process Isolation to Maintain Memory Safety for Unsafe Rust
Gülmez, Merve
Nyman, Thomas
Baumann, Christoph
Mühlberg, Jan Tobias
Cryptography and Security
Programming Languages
Rust is a popular memory-safe systems programming language. In order to interact with hardware or call into non-Rust libraries, Rust provides \emph{unsafe} language features that shift responsibility for ensuring memory safety to the developer. Failing to do so, may lead to memory safety violations in unsafe code which can violate safety of the entire application. In this work we explore in-process isolation with Memory Protection Keys as a mechanism to shield safe program sections from safety violations that may happen in unsafe sections. Our approach is easy to use and comprehensive as it prevents heap and stack-based violations. We further compare process-based and in-process isolation mechanisms and the necessary requirements for data serialization, communication, and context switching. Our results show that in-process isolation can be effective and efficient, permits for a high degree of automation, and also enables a notion of application rewinding where the safe program section may detect and safely handle violations in unsafe code.
title Friend or Foe Inside? Exploring In-Process Isolation to Maintain Memory Safety for Unsafe Rust
topic Cryptography and Security
Programming Languages
url https://arxiv.org/abs/2306.08127