Skip to content

Commit

Permalink
app: create dedicated selftest directory
Browse files Browse the repository at this point in the history
This directory contains bare-metal applications designed to test various
functionalities provided by `libsgxstep` without the need for SGX enclaves.

Also add some documentation cf #48
  • Loading branch information
jovanbulck committed Sep 16, 2024
1 parent fa2a4b5 commit 2734d9e
Show file tree
Hide file tree
Showing 34 changed files with 41 additions and 8 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,5 @@ jobs:
- name: Build SGX-Step sample applications
run: |
source /opt/intel/sgxsdk/environment
for d in $GITHUB_WORKSPACE/app/selftest/*/ ; do echo -e "\n**** $d ****\n" ; cd "$d" ; make ; ldd ./app ; done
for d in $GITHUB_WORKSPACE/app/*/ ; do echo -e "\n**** $d ****\n" ; cd "$d" ; make ; ldd ./app ; done
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ the example applications in the "app" directory.
First, check the APIC and interrupt-descriptor table setup:

```bash
$ cd app/idt
$ cd app/selftest/idt
$ make run # fires interrupts in an infinite loop to stress-test stability; exit with CTRL-C
```

Expand Down Expand Up @@ -282,7 +282,7 @@ access rights on specific code or data pages of interest.

**Note (timer interval).** The exact timer interval value depends on CPU
frequency, and hence remains inherently platform-specific (see also
[app/apic](app/apic) for detailed microbenchmarks assessing the accuracy of
[app/selftest/apic](app/selftest/apic) for detailed microbenchmarks assessing the accuracy of
various APIC timer modes). Configure a suitable value in `/app/bench/main.c`.
We established precise timer intervals for our evaluation platforms (see table
below) by tweaking and observing the NOP microbenchmark enclave instruction
Expand Down
31 changes: 31 additions & 0 deletions app/selftest/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# SGX-Step "Selftest" Applications

This directory contains bare-metal applications designed to test various functionalities provided by `libsgxstep` without the need for SGX enclaves.

## Directory Overview

| Directory | Description |
|------------|-----------------------------------------------------------------------------------------------------------|
| `apic` | Microbenchmarks for timer interrupts via various Advanced Programmable Interrupt Controller (APIC) modes. |
| `apic-ipi` | Microbenchmarks for APIC inter-processor interrupts. |
| `cpl` | Changing the Current Privilege Level (CPL) through calland interrupt GDT/IDT gates. |
| `idt` | Custom handlers for software and timer interrupts via the Interrupt Descriptor Table (IDT). |
| `idt_isr_map` | Stresstest to demonstrate custom IDT handlers can be called across processes. |

## Usage

To run the selftest applications:

1. Navigate to the desired directory.
2. Compile the application:
```bash
make
```
3. Run the application with:
```bash
sudo ./app
```

Reference output is available in the respective README files within each subdirectory.

**Note:** Any crashes during execution may indicate that your machine is not set up correctly for using SGX-Step.
File renamed without changes.
2 changes: 1 addition & 1 deletion app/apic-ipi/Makefile → app/selftest/apic-ipi/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
LIBSGXSTEP_DIR = ../..
LIBSGXSTEP_DIR = ../../..
LIBSGXSTEP = $(LIBSGXSTEP_DIR)/libsgxstep
-include $(LIBSGXSTEP)/Makefile.config

Expand Down
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion app/apic/Makefile → app/selftest/apic/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
LIBSGXSTEP_DIR = ../..
LIBSGXSTEP_DIR = ../../..
LIBSGXSTEP = $(LIBSGXSTEP_DIR)/libsgxstep
-include $(LIBSGXSTEP)/Makefile.config

Expand Down
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion app/cpl/Makefile → app/selftest/cpl/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
LIBSGXSTEP_DIR = ../..
LIBSGXSTEP_DIR = ../../..
LIBSGXSTEP = $(LIBSGXSTEP_DIR)/libsgxstep
-include $(LIBSGXSTEP)/Makefile.config

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion app/idt_isr_map/Makefile → app/selftest/idt/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
LIBSGXSTEP_DIR = ../..
LIBSGXSTEP_DIR = ../../..
LIBSGXSTEP = $(LIBSGXSTEP_DIR)/libsgxstep
-include $(LIBSGXSTEP)/Makefile.config

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion app/idt/main.c → app/selftest/idt/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#define DO_APIC_SW_IRQ 1
#define DO_APIC_TMR_IRQ 1
#define DO_EXEC_PRIV 1
#define NUM 100
#define NUM 10
#define INFINITE_LOOP 1
#define NEMESIS_HIGH 1

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion app/idt/Makefile → app/selftest/idt_isr_map/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
LIBSGXSTEP_DIR = ../..
LIBSGXSTEP_DIR = ../../..
LIBSGXSTEP = $(LIBSGXSTEP_DIR)/libsgxstep
-include $(LIBSGXSTEP)/Makefile.config

Expand Down
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions libsgxstep/Makefile.config
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ ifndef LIBSGXSTEP_SILENT
export LIBSGXSTEP_SILENT=0
endif

LDFLAGS += -z noexecstack
CFLAGS += -DSGX_STEP_PLATFORM=$(SGX_STEP_PLATFORM) -DNO_SGX=$(NO_SGX) -DLIBSGXSTEP_SILENT=$(LIBSGXSTEP_SILENT)

0 comments on commit 2734d9e

Please sign in to comment.