Skip to content

Commit 0d1003c

Browse files
committed
demo: add SGX EPC stress-ng using Gramine
Signed-off-by: Mikko Ylinen <[email protected]>
1 parent 3ec0de5 commit 0d1003c

File tree

4 files changed

+95
-0
lines changed

4 files changed

+95
-0
lines changed

.github/workflows/lib-build.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ jobs:
4343
- sgx-aesmd-demo
4444
- dlb-dpdk-demo
4545
- dlb-libdlb-demo
46+
- stress-ng-gramine
4647
builder: [buildah, docker]
4748
steps:
4849
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4

demo/stress-ng-gramine/Dockerfile

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM gramineproject/gramine:1.7-jammy
2+
3+
RUN apt-get update \
4+
&& env DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
5+
stress-ng \
6+
make
7+
8+
COPY * /stress-ng/
9+
WORKDIR /stress-ng
10+
11+
RUN gramine-sgx-gen-private-key && \
12+
make SGX=1
13+
ENTRYPOINT ["/usr/bin/gramine-sgx"]

demo/stress-ng-gramine/build/Makefile

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
ARCH_LIBDIR ?= /lib/x86_64-linux-gnu
2+
3+
ifeq ($(DEBUG),1)
4+
GRAMINE_LOG_LEVEL = debug
5+
else
6+
GRAMINE_LOG_LEVEL = error
7+
endif
8+
9+
.PHONY: all
10+
all: stress-ng.manifest stress-ng-edmm.manifest
11+
ifeq ($(SGX),1)
12+
all: stress-ng.manifest.sgx stress-ng.sig stress-ng-edmm.manifest.sgx stress-ng-edmm.sig
13+
endif
14+
15+
stress-ng.manifest: stress-ng.manifest.template
16+
gramine-manifest \
17+
-Dlog_level=$(GRAMINE_LOG_LEVEL) \
18+
-Dedmm='false' \
19+
-Denclave_size=128M \
20+
-Dexecdir=$(shell dirname $(shell which stress-ng)) \
21+
-Darch_libdir=$(ARCH_LIBDIR) \
22+
$< >$@
23+
24+
stress-ng.manifest.sgx: stress-ng.manifest
25+
gramine-sgx-sign \
26+
--manifest stress-ng.manifest \
27+
--output $@
28+
29+
stress-ng.sig: stress-ng.manifest.sgx
30+
31+
stress-ng-edmm.manifest: stress-ng.manifest.template
32+
gramine-manifest \
33+
-Dlog_level=$(GRAMINE_LOG_LEVEL) \
34+
-Dedmm='true' \
35+
-Denclave_size=128G \
36+
-Dexecdir=$(shell dirname $(shell which stress-ng)) \
37+
-Darch_libdir=$(ARCH_LIBDIR) \
38+
$< >$@
39+
40+
stress-ng-edmm.manifest.sgx: stress-ng.manifest
41+
gramine-sgx-sign \
42+
--manifest stress-ng-edmm.manifest \
43+
--output $@
44+
45+
stress-ng-edmm.sig: stress-ng-edmm.manifest.sgx
46+
47+
.PHONY: clean
48+
clean:
49+
$(RM) *.manifest *.manifest.sgx *.token *.sig OUTPUT
50+
51+
.PHONY: distclean
52+
distclean: clean
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
loader.entrypoint = "file:{{ gramine.libos }}"
2+
libos.entrypoint = "{{ execdir }}/stress-ng"
3+
4+
loader.log_level = "{{ log_level }}"
5+
loader.insecure__use_cmdline_argv = true
6+
7+
loader.env.LD_LIBRARY_PATH = "/lib:{{ arch_libdir }}:/usr{{ arch_libdir }}"
8+
loader.env.PATH = "{{ execdir }}"
9+
10+
fs.mounts = [
11+
{ path = "/lib", uri = "file:{{ gramine.runtimedir() }}" },
12+
{ path = "{{ arch_libdir }}", uri = "file:{{ arch_libdir }}" },
13+
{ path = "/usr/lib", uri = "file:/usr/lib" },
14+
{ path = "/stress-ng", uri = "file:/stress-ng" },
15+
{ path = "{{ execdir }}", uri = "file:{{ execdir }}" },
16+
]
17+
18+
sgx.debug = false
19+
sgx.edmm_enable = {{ edmm }}
20+
sgx.enclave_size = "{{ enclave_size }}"
21+
sgx.max_threads = 6
22+
23+
sgx.trusted_files = [
24+
"file:{{ gramine.libos }}",
25+
"file:{{ execdir }}/",
26+
"file:{{ gramine.runtimedir() }}/",
27+
"file:{{ arch_libdir }}/",
28+
"file:/usr/{{ arch_libdir }}/",
29+
]

0 commit comments

Comments
 (0)