Files
Michał Kowalczyk d53729b201 [Pal] Rework manifest loading
This is a major refactor of the way manifests are loaded and handled,
which will be followed by a complete rework of the loader code (which
will include e.g. centralized config).

Changes/fixes:
- Huge part of manifest handling was refactored and untangled.
- Starting without a manifest is now disallowed. This was actually
  accidentally broken for some time and no one complained. It also makes
  little sense in practice and in Graphene's overall design, e.g. it
  conflicts with protected argv.
- Now we only allow starting by giving the executable, not manifest (the
  magic resolution logic was removed).
- Now manifests are sent over pipes between parent and children, instead
  of children finding and loading them on their own. This is a
  preparation for the upcoming centralized manifests change.
- Previously manifests were parsed 2 times on Linux and 3 times on
  Linux-SGX (by untrusted PAL, trusted PAL and LibOS). This is now
  fixed.
- The common `pal_main()` now requires that the backend-specific PAL
  loader loads the manifest before calling it. SGX code already has to
  do it (for proper initialization), so let's unify this interface for
  all PALs.
- Fix for a PAL crash when manifest size was divisible by page size
  (sic!). NULL termination was missing, but most of the time the padding
  to page size saved Graphene from crashing.
2020-12-05 01:46:03 +01:00

32 lines
768 B
Markdown

# Bash example
This directory contains an example for running Bash in Graphene, including
the Makefile and a template for generating the manifest. The application is
tested on Ubuntu 16.04, with both normal Linux and SGX platforms.
# Generating the manifest
## Building for Linux
Run `make` (non-debug) or `make DEBUG=1` (debug) in the directory.
## Building for SGX
Run `make SGX=1` (non-debug) or `make SGX=1 DEBUG=1` (debug) in the directory.
# Running Bash with Graphene
Here's an example of running Bash scripts under Graphene:
Without SGX:
```
./pal_loader ./bash -c "ls"
./pal_loader ./bash -c "cd scripts && bash bash_test.sh 2"
```
With SGX:
```
SGX=1 ./pal_loader ./bash -c "ls"
SGX=1 ./pal_loader ./bash -c "cd scripts && bash bash_test.sh 2"
```