Skip to content
Stress-SGX is a fork of stress-ng that allows to put Intel SGX enclaves under high load.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
debian
example-jobs
mascot
sgx
snapcraft
test
.cproject
.dockerignore
.gitignore
.project
COPYING
Dockerfile
Makefile
Makefile.config
README
README.Android
README.md
TODO
affinity.c
cache.c
config
helper.c
ignite-cpu.c
io-priority.c
job.c
limit.c
log.c
madvise.c
mincore.c
mlock.c
mmap.c
mounts.c
mwc.c
net.c
out-of-memory.c
parse-opts.c
perf-event.c
perf.c
personality.c
sched.c
setting.c
shim.c
smatchify.sh
stress-af-alg.c
stress-affinity.c
stress-aio-linux.c
stress-aio.c
stress-apparmor.c
stress-atomic.c
stress-bigheap.c
stress-bind-mount.c
stress-branch.c
stress-brk.c
stress-bsearch.c
stress-cache.c
stress-cap.c
stress-chdir.c
stress-chmod.c
stress-chown.c
stress-chroot.c
stress-clock.c
stress-clone.c
stress-context.c
stress-copy-file.c
stress-cpu-online.c
stress-cpu.c
stress-crypt.c
stress-cyclic.c
stress-daemon.c
stress-dccp.c
stress-dentry.c
stress-dev.c
stress-dir.c
stress-dirdeep.c
stress-dnotify.c
stress-dup.c
stress-epoll.c
stress-eventfd.c
stress-exec.c
stress-fallocate.c
stress-fanotify.c
stress-fault.c
stress-fcntl.c
stress-fiemap.c
stress-fifo.c
stress-filename.c
stress-flock.c
stress-fork.c
stress-fp-error.c
stress-fstat.c
stress-full.c
stress-funccall.c
stress-futex.c
stress-get.c
stress-getdent.c
stress-getrandom.c
stress-handle.c
stress-hdd.c
stress-heapsort.c
stress-hrtimers.c
stress-hsearch.c
stress-icache.c
stress-icmp-flood.c
stress-inode-flags.c
stress-inotify.c
stress-iomix.c
stress-ioport.c
stress-ioprio.c
stress-iosync.c
stress-itimer.c
stress-kcmp.c
stress-key.c
stress-kill.c
stress-klog.c
stress-lease.c
stress-link.c
stress-locka.c
stress-lockbus.c
stress-lockf.c
stress-lockofd.c
stress-longjmp.c
stress-lsearch.c
stress-madvise.c
stress-malloc.c
stress-matrix.c
stress-membarrier.c
stress-memcpy.c
stress-memfd.c
stress-memrate.c
stress-memthrash.c
stress-mergesort.c
stress-mincore.c
stress-mknod.c
stress-mlock.c
stress-mmap.c
stress-mmapaddr.c
stress-mmapfork.c
stress-mmapmany.c
stress-mq.c
stress-mremap.c
stress-msg.c
stress-msync.c
stress-netdev.c
stress-netlink-proc.c
stress-ng.1
stress-ng.c
stress-ng.h
stress-nice.c
stress-nop.c
stress-null.c
stress-numa.c
stress-oom-pipe.c
stress-opcode.c
stress-open.c
stress-personality.c
stress-physpage.c
stress-pipe.c
stress-poll.c
stress-procfs.c
stress-pthread.c
stress-ptrace.c
stress-pty.c
stress-qsort.c
stress-quota.c
stress-radixsort.c
stress-rawdev.c
stress-rdrand.c
stress-readahead.c
stress-remap-file-pages.c
stress-rename.c
stress-resources.c
stress-rlimit.c
stress-rmap.c
stress-rtc.c
stress-schedpolicy.c
stress-sctp.c
stress-seal.c
stress-seccomp.c
stress-seek.c
stress-sem-sysv.c
stress-sem.c
stress-sendfile.c
stress-sgx-vm.c
stress-sgx.c
stress-shm-sysv.c
stress-shm.c
stress-sigfd.c
stress-sigfpe.c
stress-sigpending.c
stress-sigq.c
stress-sigsegv.c
stress-sigsuspend.c
stress-sleep.c
stress-socket-diag.c
stress-socket-fd.c
stress-socket.c
stress-socketpair.c
stress-softlockup.c
stress-spawn.c
stress-splice.c
stress-stack.c
stress-stackmmap.c
stress-str.c
stress-stream.c
stress-swap.c
stress-switch.c
stress-sync-file.c
stress-sysfs.c
stress-sysinfo.c
stress-tee.c
stress-timer.c
stress-timerfd.c
stress-tlb-shootdown.c
stress-tmpfs.c
stress-tree.c
stress-tsc.c
stress-tsearch.c
stress-udp-flood.c
stress-udp.c
stress-unshare.c
stress-urandom.c
stress-userfaultfd.c
stress-utime.c
stress-vecmath.c
stress-version.h
stress-vforkmany.c
stress-vm-rw.c
stress-vm-splice.c
stress-vm.c
stress-wait.c
stress-wcstr.c
stress-xattr.c
stress-yield.c
stress-zero.c
stress-zlib.c
stress-zombie.c
syscalls.txt
thermal-zone.c
thrash.c
time.c
usr.bin.pulseaudio.eg

README.md

Stress-SGX

The latest generation of Intel processors supports Software Guard Extensions (SGX), a set of instructions that implements a Trusted Execution Environment (TEE) right inside the CPU, by means of so-called enclaves. We present Stress-SGX, an easy-to-use stress-test tool to evaluate the performance of SGX-enabled nodes. We build on top of the popular stress-ng tool, while only keeping the workload injectors (stressors) that are meaningful in the SGX context.

Requirements

Because Stress-SGX is based on stress-ng, the same libraries need to be installed. They are:

  • libaio-dev
  • libapparmor-dev
  • libattr1-dev
  • libbsd-dev
  • libcap-dev
  • libgcrypt11-dev
  • libkeyutils-dev
  • libsctp-dev
  • zlib1g-dev

Moreover, the official Intel SGX SDK for Linux needs to be installed in /opt/intel/sgxsdk. We support version 2.0 of the SDK.

To run in hardware enclaves, the SGX driver and Platform Software (PSW) also need to be installed on the system.

How to build

Building Stress-SGX is based on Makefiles. Compiling an optimized, SGX-enabled release can be done using the following command:

make SGX_DEBUG=0 SGX_PRERELEASE=1 SGX_MODE=HW

Running SGX stressors

CPU stressors

SGX CPU stressors are selected in the same way than normal stress-ng CPU stressors. We support the following stress methods in SGX:

ackermann bitops callfunc correlate crc16 dither djb2a double euler explog fft factorial fibonacci float fnv1a gamma gcd gray hamming hanoi hyperbolic idct int64 int32 int16 int8 int64float int64double int64longdouble int32float int32double int32longdouble jenkin jmp ln2 longdouble loop matrixprod nsqrt ocall omega parity phi pi pjw prime psi queens rand rgb sdbm stats sqrt trig union zeta

The following command-line options are used to configure an SGX CPU stress run:

--sgx N         start N SGX enclaves
--sgx-ops N     stop after N sgx cpu bogo operations
--sgx-method M  specify stress sgx method M, default is all

EPC stressors

We also support stressing SGX trusted memory using the vm stressors from stress-ng. The following options configure how to stress the EPC. EPC allocation is static, and is configured in sgx/enclave_vm/trusted/vm.config.xml. This initial allocation only affects the maximal amount of memory that can be stressed, as well as startup times. The actual amount of memory under stress is defined using --sgx-vm-bytes. A key difference compared to stress-ng is that we allocate memory using the TCMalloc implementation shipped with the Intel SGX SDK, while stress-ng uses the mmap system call.

--sgx-vm N         start N SGX enclaves spinning on trusted memory
--sgx-vm-bytes N   allocate N bytes per vm worker (default 32MB)
--sgx-vm-hang N    sleep N seconds before freeing memory
--sgx-vm-keep      redirty memory instead of reallocating
--sgx-vm-ops N     stop after N vm bogo operations
--sgx-vm-method M  specify stress vm method M, default is all

--sgx-vm-method accepts the following methods as parameter:

all flip galpat-0 galpat-1 gray rowhammer incdec inc-nybble rand-set rand-sum read64 ror swap move-inv modulo-x prime-0 prime-1 prime-gray-0 prime-gray-1 prime-incdec walk-0d walk-1d walk-0a walk-1a write64 zero-one

Examples

  • Run a simple CPU stressor on 1 core for 30 seconds in an SGX enclave
./stress-ng --sgx 1 --sgx-method bitops -t 30
  • Run all EPC stressors on 1 core, operating on 30 MB of EPC
./stress-ng --sgx-vm 1 --sgx-vm-bytes 30M
  • Run the fft stressor on all CPU cores in an SGX enclave
./stress-ng --sgx 0 --sgx-method fft
  • Run the fft stressor on all CPU cores in an SGX enclave and collect metrics after 10 seconds
./stress-ng -t 10 --sgx 0 --sgx-method fft --metrics

Ensuring byte-per-byte equivalence of native and SGX code

An enclave compiled using the official SGX SDK will produce a statically-compiled shared library. It is possible to leverage this aspect to guarantee that both native and SGX versions of a stressor execute a perfectly identical binary by dynamically linking this shared object. This optional approach, however, limits Stress-SGX to stressors that are only available in enclave mode.

Selecting the approach is done by compiling the version of Stress-SGX located in the loadso branch. CPU and VM stressors are compatible with this option.

You can’t perform that action at this time.