https://github.com/asterinas/mlsdisk
Multilayered, Log-structured Secure Disk (MlsDisk) protects the disk I/O for TEEs
https://github.com/asterinas/mlsdisk
Last synced: 17 days ago
JSON representation
Multilayered, Log-structured Secure Disk (MlsDisk) protects the disk I/O for TEEs
- Host: GitHub
- URL: https://github.com/asterinas/mlsdisk
- Owner: asterinas
- License: other
- Created: 2023-06-05T04:54:05.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-05-07T06:19:29.000Z (about 2 years ago)
- Last Synced: 2024-05-07T07:25:40.392Z (about 2 years ago)
- Language: Rust
- Homepage:
- Size: 211 KB
- Stars: 12
- Watchers: 3
- Forks: 2
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE-GPL
Awesome Lists containing this project
README
# MlsDisk
## Introduction
MlsDisk is a **multilayered log-structured secure virtual disk for TEEs**,
which has the following key features:
* **Transparent protection.** As a virtual disk, MlsDisk can _transparently_ protect any file system (e.g., Ext4) that
is stacked upon it and runs inside a Trusted Execution Environment (TEE) from a strong adversary
outside the TEE.
* **Strong security.** MlsDisk promises six security properties:
_confidentiality_, _integrity_, _freshness_, _consistency_, _atomicity_, and _irreversibility_.
For more information, see the section [Security Guarantees](#security-guarantees) below.
* **High performance.** Thanks to its unique multilayered log-structured design,
MlsDisk can deliver an excellent I/O performance that
is close to the theoretically optimal level.
## Overview
MlsDisk targets a typical setting of TEE usage, where applications
are ported into the TEE with no (or few) modifications
thanks to a TEE-aware runtime. For enclave TEEs (e.g., Intel SGX),
one popular choice for such a runtime is library OSes (e.g., [Occlum](https://github.com/occlum/occlum)).
For VM TEEs (e.g., AMD SEV), one can choose off-the-shelf OS kernels like Linux.

As shown in the image above, the TEE runtime is integrated with MlsDisk,
which serves as a secure block device that supports three standard block I/O commands
including `read()`, `write()`, and `sync()`. From the perspective of MlsDisk's users (e.g., file systems),
all data written to or read from MlsDisk is in plaintext.
To serve these I/O requests securely, MlsDisk takes some extra security measures,
including but not limited to encrypting/decrypting the data
transferred to/from the host block device properly.
## Security Guarantees
MlsDisk promises to provide six security guarantees
to its users (e.g., file systems), outlined as follows:
* **Confidentiality** guarantees that the user data submitted by any write
is not leaked and thus prevents tampering attacks.
* **Integrity** promises that the user data returned from any read
are genuinely generated by the user and
thus prevents snooping attacks.
* **Freshness** ensures that the user data returned from any read
are up-to-date and thus prevents rollback attacks.
* **Consistency** ensures that all the security guarantees are held
despite any accidental crashes or crashing attacks.
* **Atomicity** promises that all writes before a sync operation
are persisted in an all-or-nothing manner.
* **Irreversibility** promises the sync operation is irreversible
regardless whether TEE is online or not.
Prior disk I/O protection solutions only provide a subset of MlsDisk's security guarantees.
For example, Linux's [dm-crypt](https://docs.kernel.org/admin-guide/device-mapper/dm-crypt.html) and [dm-integrity](https://docs.kernel.org/admin-guide/device-mapper/dm-crypt.html) only protect confidentiality and integrity, respectively.
Although Linux's [dm-verity](https://docs.kernel.org/admin-guide/device-mapper/verity.html) ensures both integrity and freshness, it is read-only.
As another example, [Intel SGX Protected File System Library](https://www.intel.com/content/www/us/en/developer/articles/technical/overview-of-intel-protected-file-system-library-using-software-guard-extensions.html) protects confidentiality, integrity, freshness, and consistency,
but falls short of atomicity and irreversibility.
## Implementation
MlsDisk is written in Rust.
The core of MlsDisk's design resides in [`core/layers`](core/layers),
showcasing its multilayered log-structured approach.
MlsDisk is also engineered to be portable across different OSes and TEEs,
with platform-specific implementations found in [`core/os`](core/os) and
notably [`linux`](linux/) for Linux integration.
As of this moment, MlsDisk has been integrated into two OSes.
* Integrated into Linux based on [Rust-for-Linux](https://github.com/Rust-for-Linux),
which is for use in VM TEEs like [AMD SEV](https://developer.amd.com/sev/) and [Intel TDX](https://www.intel.com/content/www/us/en/developer/articles/technical/intel-trust-domain-extensions.html).
* Integrated into Occlum, a Rust library OS,
which is for use in [Intel SGX](https://www.intel.com/content/www/us/en/developer/tools/software-guard-extensions/overview.html) enclaves.
We plan to release a research paper that
describes the design and implementation
of MlsDisk in the near future.
## Performance
MlsDisk achieves superior performance compared to the state-of-the-art solutions,
thanks to its advanced multilayered log-structured design,
with minimal I/O amplification.
The comparative results under the [Fio](https://github.com/axboe/fio) benchmark
against two other virtual disks are presented below.
| 100GiB data
(MiB/s) | seq-write | rnd-write-4K | **rnd-write-32K** | **rnd-write-256K** | **seq-read** | **rnd-read-4K** | **rnd-read-32K** | **rnd-read-256K** |
| ------------------------------------- | --------- | ------------ | ----------------- | ------------------ | ------------ | --------------- | ---------------- | ----------------- |
| **MlsDisk** | 960 | 605 | 842 | 928 | 1128 | 140 | 446 | 992 |
| **CryptDisk** (encrypt-only baseline) | 982 | 45.5 | 271 | 860 | 1203 | 165 | 489 | 1057 |
| **PfsDisk** (based on SGX-Pfs) | 103 | 19.2 | 57.8 | 86.1 | 340 | 84.7 | 245 | 321 |
For more comprehensive performance evaluation,
please look forward to our upcoming paper.
## License
Except where noted otherwise, the individual files within this package
are licensed as MPL v2.0 license. However, when linked together to form a Linux kernel module,
the resulting Linux kernel module is dual licensed as MPLv2/GPLv2.