Skip to content

[RFC] Extend the SGX untrusted allocator to support untrusted device memory #291

@guzongmin

Description

@guzongmin
  • Feature Name: untrusted device memory
  • Start Date: 2022-08-22

Summary

Occlum gets the untrusted memory range and registers the untrusted memory range into the SGX untrusted allocator.

Motivation

When supporting the untrusted device, we could get some untrusted memory that is shared with the device. The SGX untrusted allocator could help to manage this area. The application may do mprotect or munmap with the virtual address inside the untrusted area.

Guide-level explanation

The existing sgx-untrusted-alloc crate (https://github.com/occlum/ngo/tree/master/src/libos/crates/sgx-untrusted-alloc) could be extended to support the new feature.

The new interfaces are required:

  1. insert a committed untrusted memory range into the allocator
  2. remove a range of memory from the allocator (If the range is added by the insert interface)

Below is one example:
When an application performs munmap with an untrusted memory address

  1. First, check whether the address is inside the enclave or an outside address.
  2. If the address is an outside address, query the Untrusted Allocator to confirm it is a legal address managed by the allocator
  3. Perform the munmap with the address
  4. If the area is mapped with an untrusted device, remove the range from the allocator

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions