Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update version due to libunwind update #234

Merged
merged 1 commit into from
May 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

61 changes: 13 additions & 48 deletions doc/FORTANIX-SGX-ABI.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# Fortanix SGX ABI v0.3.0
# Fortanix SGX ABI v0.3.2

This document describes the ABI of SGX enclaves built using `libenclave`.

## ABI version compatibility

| ABI version | Rust std version | enclave-runner version |
| -----------:| ----------------:| ----------------------:|
| 0.3.1 | TBD | 0.1.0 |
| 0.3.0 | 15a2607.. | 0.1.0 |
| 0.3.2 | 50f3d6e.. | 0.1.0~0.3.1 |
| 0.3.1 | bd47d68.. | 0.1.0~0.3.1 |
| 0.3.0 | 15a2607.. | 0.1.0~0.3.1 |

| ABI version | libenclave version | enclave-interface version |
| -----------:| ------------------:| -------------------------:|
Expand All @@ -18,84 +19,48 @@ This document describes the ABI of SGX enclaves built using `libenclave`.
| 0.1.3 | 0.1.0-0.1.3 | 0.1.0-0.1.1 |
| 0.1.0 | 0.1.0-0.1.3 | 0.1.0-0.1.1 |

## Changelog
### Changelog

### Version 0.3.2
#### Version 0.3.2

* *No semantic changes.*
* More changes to allow building as a crates.io dependency of `std`.

### Version 0.3.1
#### Version 0.3.1

* *No semantic changes.*
* Changes to allow building as a crates.io dependency of `std`.

### Version 0.3.0
#### Version 0.3.0

* Return values are now two registers wide instead of one.
* No longer distinguish between “panic exit” and “usercall exit”. Panic
signalling is now done at the API level.
* Renamed “libenclave ABI” to “Fortanix SGX ABI”.
* TLS size and contents updated.

### Version 0.2.3
#### Version 0.2.3

* TLS size and contents updated.

### Version 0.2.2
#### Version 0.2.2

* TLS size updated. Debug TLS size is now the same as non-debug size.

### Version 0.2.1
#### Version 0.2.1

* AEX debug handler removed.

### Version 0.2.0
#### Version 0.2.0

* Usercall register saving semantics changed. The enclave no longer
distinguishes between normal enters and usercall enters for purposes of
saving user register state.

### Version 0.1.3
#### Version 0.1.3

* TLS size and contents updated.

## Thread settings

This section describes the requirements on the SGX thread control structure
(TCS), thread local storage (TLS) and thread stacks.

### TCS

- `NSSA` should be set to 1.
- `OGSBASGX` should point to a thread-specific memory region (e.g. TLS) of at
least 112 bytes.

### TLS

The memory region pointed to by `OGSBASGX` should be initialized as follows:

- Offset `0x0`: Top-of-Stack offset from image base.
- Offset `0x8`: `1` if this is an executable and this is a secondary TCS, `0`
otherwise.
- Offsets `0x10`, `0x18`, `0x20`: `0`
- Other offsets: uninitialized.

## Globals

This section describes the requirements for various global constants in the SGX
binary.

- `HEAP_BASE`. Size 8 bytes. The base address (relative to enclave start) of
the heap area, little-endian.
- `HEAP_SIZE`. Size 8 bytes. The heap size in bytes, little-endian.
- `ENCLAVE_SIZE`. Size 8 bytes. The enclave size in bytes, little-endian.
- `CFGDATA_BASE`. Size 8 bytes. The base address (relative to enclave start) of
the enclave configuration area, little-endian.
- `RELA`. Size 8 bytes. Value of the RELA entry in the dynamic table.
- `RELACOUNT`. Size 8 bytes. Value of the RELACOUNT entry in the dynamic table.
- `DEBUG`. Size 1 byte. Non-zero if debugging is enabled, zero otherwise.

## Enclave calling convention

Upon `EENTER`, besides the standard SGX control registers, parameters are
Expand Down
72 changes: 72 additions & 0 deletions doc/FORTANIX-SGX-ELF.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Fortanix SGX ELF specification

ELF is only an intermediate stage for the Fortanix SGX toolchain. Compatibility
is maintained at the source code and SGXS ABI level (see
[FORTANIX-SGX-ABI.md](FORTANIX-SGX-ABI.md)).

Nonetheless, this document describes the intermediate ELF format. This is for
reference purposes only, third parties should *not* rely on this format.

## ELF compatibility level

The compatibility level is contained in an ELF note section named
`.note.x86_64-fortanix-unknown-sgx`, note type `NT_VERSION` with name
`toolchain-version`. The contents of the note is a 32-bit little-endian number.

| toolchain-version | fortanix-sgx-tools version | Rust std version |
| -----------------:| --------------------------:|-----------------:|
| 1 | 0.4.0 | TBD |
| 0 | 0.1.0~0.4.0 | 33e6df4.. |

### Changelog

#### Version 1

* Updated libunwind integration for new libunwind version

## Thread settings

This section describes the requirements on the SGX thread control structure
(TCS), thread local storage (TLS) and thread stacks.

### TCS

- `NSSA` should be set to 1.
- `OGSBASGX` should point to a thread-specific memory region (e.g. TLS) of at
least 112 bytes.

### TLS

The memory region pointed to by `OGSBASGX` should be initialized as follows:

- Offset `0x0`: Top-of-Stack offset from image base.
- Offset `0x8`: `1` if this is an executable and this is a secondary TCS, `0`
otherwise.
- Offsets `0x10`, `0x18`, `0x20`: `0`
- Other offsets: uninitialized.

## Globals

This section describes the requirements for various global constants in the SGX
binary.

- `HEAP_BASE`. Size 8 bytes. The base address (relative to enclave start) of
the heap area, little-endian.
- `HEAP_SIZE`. Size 8 bytes. The heap size in bytes, little-endian.
- `ENCLAVE_SIZE`. Size 8 bytes. The enclave size in bytes, little-endian.
- `CFGDATA_BASE`. Size 8 bytes. The base address (relative to enclave start) of
the enclave configuration area, little-endian.
- `RELA`. Size 8 bytes. Value of the RELA entry in the dynamic table.
- `RELACOUNT`. Size 8 bytes. Value of the RELACOUNT entry in the dynamic table.
- `DEBUG`. Size 1 byte. Non-zero if debugging is enabled, zero otherwise.
jethrogb marked this conversation as resolved.
Show resolved Hide resolved
- `TEXT_BASE`. Size 8 bytes. The base address (relative to enclave start) of
the enclave text section.
- `TEXT_SIZE`. Size 8 bytes. The size in bytes of the enclave text section.
- `EH_FRM_HDR_OFFSET`. Size 8 bytes. The base address (relative to enclave
start) of the ELF section named '.eh_frame_hdr'.
- `EH_FRM_HDR_LEN`. Size 8 bytes. The size in bytes of the ELF section named
'.eh_frame_hdr'.
- `EH_FRM_OFFSET`. Size 8 bytes. The base address (relative to enclave start)
of the ELF section named '.eh_frame'.
- `EH_FRM_LEN`. Size 8 bytes. The size in bytes of the ELF section named
'.eh_frame'.
2 changes: 1 addition & 1 deletion fortanix-sgx-tools/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "fortanix-sgx-tools"
version = "0.3.1"
version = "0.4.0"
authors = ["Fortanix, Inc."]
license = "MPL-2.0"
description = """
Expand Down