Skip to content

Commit 897ca52

Browse files
committed
demo: add SGX EPC stress-ng using Gramine
Signed-off-by: Mikko Ylinen <[email protected]>
1 parent 4fce427 commit 897ca52

File tree

5 files changed

+94
-1
lines changed

5 files changed

+94
-1
lines changed

.github/workflows/lib-build.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ jobs:
3838
- sgx-aesmd-demo
3939
- dlb-dpdk-demo
4040
- dlb-libdlb-demo
41+
- stress-ng-gramine
4142
builder: [buildah, docker]
4243
steps:
4344
- uses: actions/checkout@v4

.github/workflows/lib-e2e.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
images: intel-qat-plugin intel-qat-initcontainer openssl-qat-engine
4444
- name: e2e-sgx
4545
runner: sgx
46-
images: intel-sgx-plugin intel-sgx-initcontainer intel-sgx-admissionwebhook sgx-sdk-demo intel-deviceplugin-operator
46+
images: intel-sgx-plugin intel-sgx-initcontainer intel-sgx-admissionwebhook sgx-sdk-demo intel-deviceplugin-operator stress-ng-gramine
4747

4848
name: ${{ matrix.name }}
4949
runs-on: ${{ matrix.runner }}

demo/stress-ng-gramine/Dockerfile

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM gramineproject/gramine:v1.5
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

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
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+
-Dexecdir=$(shell dirname $(shell which stress-ng)) \
20+
-Darch_libdir=$(ARCH_LIBDIR) \
21+
$< >$@
22+
23+
stress-ng.manifest.sgx: stress-ng.manifest
24+
gramine-sgx-sign \
25+
--manifest stress-ng.manifest \
26+
--output $@
27+
28+
stress-ng.sig: stress-ng.manifest.sgx
29+
30+
stress-ng-edmm.manifest: stress-ng.manifest.template
31+
gramine-manifest \
32+
-Dlog_level=$(GRAMINE_LOG_LEVEL) \
33+
-Dedmm='true' \
34+
-Dexecdir=$(shell dirname $(shell which stress-ng)) \
35+
-Darch_libdir=$(ARCH_LIBDIR) \
36+
$< >$@
37+
38+
stress-ng-edmm.manifest.sgx: stress-ng.manifest
39+
gramine-sgx-sign \
40+
--manifest stress-ng-edmm.manifest \
41+
--output $@
42+
43+
stress-ng-edmm.sig: stress-ng-edmm.manifest.sgx
44+
45+
.PHONY: clean
46+
clean:
47+
$(RM) *.manifest *.manifest.sgx *.token *.sig OUTPUT
48+
49+
.PHONY: distclean
50+
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 = "128M"
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)