Quick start

Quick start without SGX support

  1. Clone the Graphene repository:

    git clone https://github.com/oscarlab/graphene.git
    
  2. Build Graphene:

    sudo apt-get install -y build-essential autoconf gawk bison wget python3
    cd graphene
    make
    meson build -Ddirect=enabled -Dsgx=disabled
    ninja -C build
    sudo ninja -C build install
    
  3. Build and run helloworld:

    cd LibOS/shim/test/regression
    make
    graphene-direct helloworld
    
  4. For more complex examples, see Examples directory.

Quick start with SGX support

Graphene requires several features from your system:

  • the FSGSBASE feature of recent processors must be enabled in the Linux kernel,
  • the Intel SGX driver must be built in the Linux kernel,
  • Intel SGX SDK/PSW and (optionally) Intel DCAP must be installed.

If your system doesn’t meet these requirements, please refer to more detailed descriptions in Building.

  1. Ensure that Intel SGX is enabled on your platform:

    lsmod | grep sgx
    ps ax | grep [a]esm_service
    

The first command should list isgx (or sgx) and the second command should list the process status of aesm_service.

  1. Clone the Graphene repository:

    git clone https://github.com/oscarlab/graphene.git
    cd graphene
    
  2. Prepare a signing key:

    openssl genrsa -3 -out Pal/src/host/Linux-SGX/signer/enclave-key.pem 3072
    
  3. Build Graphene and Graphene-SGX:

    sudo apt-get install -y \
       build-essential autoconf gawk bison wget python3 libcurl4-openssl-dev \
       python3-protobuf libprotobuf-c-dev protobuf-c-compiler python3-pip
    python3 -m pip install toml>=0.10
    make
    make ISGX_DRIVER_PATH="" SGX=1                  # this assumes Linux 5.11+
    meson build -Ddirect=enabled -Dsgx=enabled
    ninja -C build
    sudo ninja -C build install
    
  4. Set vm.mmap_min_addr=0 in the system (only required for the legacy SGX driver and not needed for newer DCAP/in-kernel drivers):

    sudo sysctl vm.mmap_min_addr=0
    

    Note that this is an inadvisable configuration for production systems.

  5. Build and run helloworld:

    cd LibOS/shim/test/regression
    make SGX=1
    make SGX=1 sgx-tokens
    graphene-sgx helloworld
    

Running sample applications

We prepared and tested several applications to demonstrate Graphene and Graphene-SGX usability. These applications can be found in the Examples folder in the repository, each containing a short README with instructions how to test it. We recommend starting with simpler, thoroughly documented examples like Memcached and Redis, to understand manifest options and features of Graphene.