Skip to content

Commit

Permalink
[CI] Add new Jenkins pipeline for EDMM testing
Browse files Browse the repository at this point in the history
Signed-off-by: Borys Popławski <borysp@invisiblethingslab.com>
  • Loading branch information
boryspoplawski authored and Dmitrii Kuvaiskii committed Jan 9, 2023
1 parent 75bf81a commit 1b1242f
Show file tree
Hide file tree
Showing 60 changed files with 158 additions and 18 deletions.
9 changes: 8 additions & 1 deletion .ci/lib/stage-build-sgx.jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ stage('build') {
if (env.CC == 'clang') {
env.MESON_OPTIONS += ' -Dmusl=disabled'
}
if (env.RA_TYPE == 'dcap') {
env.MESON_OPTIONS += ' -Ddcap=enabled'
}

if (env.SGX_DRIVER == null) {
env.SGX_DRIVER = 'oot'
}

try {
sh '''
Expand All @@ -26,7 +33,7 @@ stage('build') {
-Ddirect=disabled \
-Dsgx=enabled \
-Dtests=enabled \
-Dsgx_driver=oot \
-Dsgx_driver="$SGX_DRIVER" \
$MESON_OPTIONS
ninja -vC build/
'''
Expand Down
46 changes: 33 additions & 13 deletions .ci/lib/stage-test-sgx.jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ stage('test-sgx') {
.ci/check-no-syscall.sh "$GRAMINE_PKGLIBDIR"/runtime/musl/libc.so
fi
'''

if (env.RA_TYPE == null) {
env.RA_TYPE = 'epid'
}

timeout(time: 5, unit: 'MINUTES') {
sh '''
cd CI-Examples/helloworld
Expand All @@ -16,7 +21,7 @@ stage('test-sgx') {
timeout(time: 5, unit: 'MINUTES') {
sh '''
cd CI-Examples/python
make ${MAKEOPTS} RA_TYPE=epid RA_CLIENT_SPID=${ra_client_spid}
make ${MAKEOPTS} RA_TYPE=$RA_TYPE RA_CLIENT_SPID=${ra_client_spid}
make ${MAKEOPTS} check
'''
}
Expand Down Expand Up @@ -107,27 +112,42 @@ stage('test-sgx') {
timeout(time: 5, unit: 'MINUTES') {
sh '''
cd CI-Examples/ra-tls-mbedtls
if [ "${ra_client_spid}" != "" ] && [ "${ra_client_key}" != "" ]; \
then \
make check_epid RA_TYPE=epid RA_CLIENT_SPID=${ra_client_spid} \
RA_TLS_EPID_API_KEY=${ra_client_key} RA_CLIENT_LINKABLE=0; \
make check_epid_fail RA_TYPE=epid RA_CLIENT_SPID=${ra_client_spid} \
RA_TLS_EPID_API_KEY=${ra_client_key} RA_CLIENT_LINKABLE=0; \
if [ "${RA_TYPE}" = "epid" ]; then \
if [ "${ra_client_spid}" != "" ] && [ "${ra_client_key}" != "" ]; \
then \
make check_epid RA_TYPE=epid RA_CLIENT_SPID=${ra_client_spid} \
RA_TLS_EPID_API_KEY=${ra_client_key} RA_CLIENT_LINKABLE=0; \
make check_epid_fail RA_TYPE=epid RA_CLIENT_SPID=${ra_client_spid} \
RA_TLS_EPID_API_KEY=${ra_client_key} RA_CLIENT_LINKABLE=0; \
else \
echo "Failure: no ra_client_spid and/or ra_client_key!"; \
exit 1; \
fi \
elif [ "${RA_TYPE}" = "dcap" ]; then \
make check_dcap RA_TYPE=dcap; \
make check_dcap_fail RA_TYPE=dcap; \
else \
echo "Failure: no ra_client_spid and/or ra_client_key!"; \
echo "Invalid RA_TYPE env variable: ${RA_TYPE}"; \
exit 1; \
fi
'''
}
timeout(time: 5, unit: 'MINUTES') {
sh '''
cd CI-Examples/ra-tls-secret-prov
if [ "${ra_client_spid}" != "" ] && [ "${ra_client_key}" != "" ]; \
then \
make check_epid RA_TYPE=epid RA_CLIENT_SPID=${ra_client_spid} \
RA_TLS_EPID_API_KEY=${ra_client_key} RA_CLIENT_LINKABLE=0; \
if [ "${RA_TYPE}" = "epid" ]; then \
if [ "${ra_client_spid}" != "" ] && [ "${ra_client_key}" != "" ]; \
then \
make check_epid RA_TYPE=epid RA_CLIENT_SPID=${ra_client_spid} \
RA_TLS_EPID_API_KEY=${ra_client_key} RA_CLIENT_LINKABLE=0; \
else \
echo "Failure: no ra_client_spid and/or ra_client_key!"; \
exit 1; \
fi \
elif [ "${RA_TYPE}" = "dcap" ]; then \
make check_dcap RA_TYPE=dcap; \
else \
echo "Failure: no ra_client_spid and/or ra_client_key!"; \
echo "Invalid RA_TYPE env variable: ${RA_TYPE}"; \
exit 1; \
fi
'''
Expand Down
8 changes: 6 additions & 2 deletions .ci/lib/stage-test.jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
stage('test') {
if (env.RA_TYPE == null) {
env.RA_TYPE = 'epid'
}

timeout(time: 15, unit: 'MINUTES') {
try {
sh '''
Expand All @@ -15,7 +19,7 @@ stage('test') {
try {
sh '''
cd libos/test/regression
RA_TYPE=epid RA_CLIENT_SPID=${ra_client_spid} gramine-test build -v
RA_TYPE=$RA_TYPE RA_CLIENT_SPID=${ra_client_spid} gramine-test build -v
python3 -m pytest -v --junit-xml libos-regression.xml
'''
} finally {
Expand All @@ -31,7 +35,7 @@ stage('test') {
cd libos/test/regression
# For some unknown reason it fails without this clean on sgx-18.04 pipeline
gramine-test clean
RA_TYPE=epid RA_CLIENT_SPID=${ra_client_spid} \
RA_TYPE=$RA_TYPE RA_CLIENT_SPID=${ra_client_spid} \
gramine-test -n tests_musl.toml build -v
python3 -m pytest -v --junit-xml libos-regression-musl.xml
'''
Expand Down
30 changes: 30 additions & 0 deletions .ci/linux-sgx-edmm.jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
node('sgx-edmm') {
checkout scm

env.SGX = '1'
env.SGX_DRIVER = 'upstream'
env.EDMM = '1'
env.RA_TYPE = 'dcap'

load '.ci/lib/config-docker.jenkinsfile'

env.DOCKER_ARGS_SGX += '''
--volume=/usr/include/x86_64-linux-gnu/asm/sgx.h:/usr/include/asm/sgx.h:ro
--add-host host.docker.internal:host-gateway
'''

docker.build(
"local:${env.BUILD_TAG}",
'-f .ci/ubuntu20.04.dockerfile .'
).inside("${env.DOCKER_ARGS_COMMON} ${env.DOCKER_ARGS_SGX}") {
load '.ci/lib/config.jenkinsfile'
load '.ci/lib/config-release.jenkinsfile'

load '.ci/lib/stage-lint.jenkinsfile'
load '.ci/lib/stage-clean-check-prepare.jenkinsfile'
load '.ci/lib/stage-build-sgx.jenkinsfile'
load '.ci/lib/stage-test.jenkinsfile'
load '.ci/lib/stage-test-sgx.jenkinsfile'
load '.ci/lib/stage-clean-check.jenkinsfile'
}
}
12 changes: 12 additions & 0 deletions .ci/ubuntu20.04.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,18 @@ RUN apt-get update && env DEBIAN_FRONTEND=noninteractive apt-get install -y \
zlib1g \
zlib1g-dev

# Needed by DCAP attestation e.g. in "CI-Examples/ra-tls-mbedtls"
RUN curl -fsSL https://download.01.org/intel-sgx/sgx_repo/ubuntu/intel-sgx-deb.key | apt-key add -
RUN echo 'deb [arch=amd64] https://download.01.org/intel-sgx/sgx_repo/ubuntu focal main' > /etc/apt/sources.list.d/intel-sgx.list
RUN apt-get update && env DEBIAN_FRONTEND=noninteractive apt-get install -y \
libsgx-dcap-default-qpl \
libsgx-dcap-quote-verify-dev \
libsgx-urts

# set up PCCS connection configuration
RUN sed -i -e 's/localhost/host.docker.internal/g' /etc/sgx_default_qcnl.conf \
&& sed -i -e 's/"use_secure_cert": true/"use_secure_cert": false/' /etc/sgx_default_qcnl.conf

# Install wrk2 benchmark. This benchmark is used in `benchmark-http.sh`.
RUN git clone https://github.com/giltene/wrk2.git \
&& cd wrk2 \
Expand Down
1 change: 1 addition & 0 deletions CI-Examples/bash/manifest.template
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ fs.mounts = [
]

sgx.debug = true
sgx.edmm_enable = {{ 'true' if env.get('EDMM', '0') == '1' else 'false' }}
sgx.nonpie_binary = true
sgx.enclave_size = "512M"
sgx.max_threads = 4
Expand Down
1 change: 1 addition & 0 deletions CI-Examples/blender/blender.manifest.template
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ fs.mounts = [
]

sgx.debug = true
sgx.edmm_enable = {{ 'true' if env.get('EDMM', '0') == '1' else 'false' }}
sgx.nonpie_binary = true
sys.stack.size = "8M"
sgx.enclave_size = "2048M"
Expand Down
1 change: 1 addition & 0 deletions CI-Examples/busybox/busybox.manifest.template
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ fs.mounts = [
sys.enable_extra_runtime_domain_names_conf = true

sgx.debug = true
sgx.edmm_enable = {{ 'true' if env.get('EDMM', '0') == '1' else 'false' }}

sgx.remote_attestation = "{{ ra_type }}"
sgx.ra_client_spid = "{{ ra_client_spid }}"
Expand Down
1 change: 1 addition & 0 deletions CI-Examples/helloworld/helloworld.manifest.template
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ fs.mounts = [
]

sgx.debug = true
sgx.edmm_enable = {{ 'true' if env.get('EDMM', '0') == '1' else 'false' }}
sgx.nonpie_binary = true

sgx.trusted_files = [
Expand Down
1 change: 1 addition & 0 deletions CI-Examples/lighttpd/lighttpd.manifest.template
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ fs.mounts = [
]

sgx.debug = true
sgx.edmm_enable = {{ 'true' if env.get('EDMM', '0') == '1' else 'false' }}
sgx.nonpie_binary = true
sgx.enclave_size = "256M"
sgx.max_threads = 3
Expand Down
1 change: 1 addition & 0 deletions CI-Examples/memcached/memcached.manifest.template
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ fs.mounts = [
]

sgx.debug = true
sgx.edmm_enable = {{ 'true' if env.get('EDMM', '0') == '1' else 'false' }}
sgx.nonpie_binary = true
sgx.max_threads = 16

Expand Down
1 change: 1 addition & 0 deletions CI-Examples/nginx/nginx.manifest.template
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ fs.mounts = [
]

sgx.debug = true
sgx.edmm_enable = {{ 'true' if env.get('EDMM', '0') == '1' else 'false' }}
sgx.nonpie_binary = true
sgx.enclave_size = "512M"
sgx.max_threads = 4
Expand Down
1 change: 1 addition & 0 deletions CI-Examples/python/python.manifest.template
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ sys.stack.size = "2M"
sys.enable_extra_runtime_domain_names_conf = true

sgx.debug = true
sgx.edmm_enable = {{ 'true' if env.get('EDMM', '0') == '1' else 'false' }}
sgx.nonpie_binary = true
sgx.enclave_size = "1G"
sgx.max_threads = 32
Expand Down
1 change: 1 addition & 0 deletions CI-Examples/ra-tls-mbedtls/client.manifest.template
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ fs.mounts = [
sys.enable_extra_runtime_domain_names_conf = true

sgx.debug = true
sgx.edmm_enable = {{ 'true' if env.get('EDMM', '0') == '1' else 'false' }}
sgx.enclave_size = "512M"
sgx.max_threads = 4

Expand Down
1 change: 1 addition & 0 deletions CI-Examples/ra-tls-mbedtls/server.manifest.template
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ fs.mounts = [
]

sgx.debug = true
sgx.edmm_enable = {{ 'true' if env.get('EDMM', '0') == '1' else 'false' }}

sgx.remote_attestation = "{{ ra_type }}"
sgx.ra_client_spid = "{{ ra_client_spid }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ sys.enable_extra_runtime_domain_names_conf = true

sgx.enclave_size = "512M"
sgx.debug = true
sgx.edmm_enable = {{ 'true' if env.get('EDMM', '0') == '1' else 'false' }}

sgx.remote_attestation = "{{ ra_type }}"
sgx.ra_client_spid = "{{ ra_client_spid }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ sys.enable_extra_runtime_domain_names_conf = true

sgx.enclave_size = "512M"
sgx.debug = true
sgx.edmm_enable = {{ 'true' if env.get('EDMM', '0') == '1' else 'false' }}

sgx.remote_attestation = "{{ ra_type }}"
sgx.ra_client_spid = "{{ ra_client_spid }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ sys.enable_extra_runtime_domain_names_conf = true

sgx.enclave_size = "512M"
sgx.debug = true
sgx.edmm_enable = {{ 'true' if env.get('EDMM', '0') == '1' else 'false' }}

sgx.remote_attestation = "{{ ra_type }}"
sgx.ra_client_spid = "{{ ra_client_spid }}"
Expand Down
7 changes: 7 additions & 0 deletions CI-Examples/redis/redis-server.manifest.template
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ sgx.debug = true
# typical Redis workloads.
sgx.enclave_size = "1024M"

# Enable Enclave Dynamic Memory Management (EDMM) feature based on EDMM
# environment variable. This allows for addition of pages to enclave in runtime,
# instead of allocating them upfront at startup. If this feature is enabled,
# `sgx.enclave_size` above describes a maximal enclave size and can usually be
# increased without negative consequences (it does not impact startup time).
sgx.edmm_enable = {{ 'true' if env.get('EDMM', '0') == '1' else 'false' }}

# Set maximum number of in-enclave threads (somewhat arbitrarily) to 8. Recall
# that SGX v1 requires to specify the maximum number of simultaneous threads at
# enclave creation time.
Expand Down
1 change: 1 addition & 0 deletions CI-Examples/rust/rust-hyper-http-server.manifest.template
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ fs.mounts = [
]

sgx.debug = true
sgx.edmm_enable = {{ 'true' if env.get('EDMM', '0') == '1' else 'false' }}
sgx.nonpie_binary = true

sgx.trusted_files = [
Expand Down
1 change: 1 addition & 0 deletions CI-Examples/sqlite/manifest.template
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ fs.mounts = [
fs.insecure__keys.default = "ffeeddccbbaa99887766554433221100"

sgx.debug = true
sgx.edmm_enable = {{ 'true' if env.get('EDMM', '0') == '1' else 'false' }}
sgx.enclave_size = "256M"
sgx.max_threads = 4

Expand Down
1 change: 1 addition & 0 deletions libos/test/abi/x86_64/manifest.template
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ fs.mounts = [

sgx.nonpie_binary = true
sgx.debug = true
sgx.edmm_enable = {{ 'true' if env.get('EDMM', '0') == '1' else 'false' }}
sgx.max_threads = 4

sgx.trusted_files = [
Expand Down
1 change: 1 addition & 0 deletions libos/test/abi/x86_64/stack_arg.manifest.template
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ fs.mounts = [

sgx.nonpie_binary = true
sgx.debug = true
sgx.edmm_enable = {{ 'true' if env.get('EDMM', '0') == '1' else 'false' }}
sgx.max_threads = 4

sgx.trusted_files = [
Expand Down
1 change: 1 addition & 0 deletions libos/test/abi/x86_64/stack_env.manifest.template
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ fs.mounts = [

sgx.nonpie_binary = true
sgx.debug = true
sgx.edmm_enable = {{ 'true' if env.get('EDMM', '0') == '1' else 'false' }}
sgx.max_threads = 4

sgx.trusted_files = [
Expand Down
1 change: 1 addition & 0 deletions libos/test/fs/manifest.template
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ fs.insecure__keys.default = "ffeeddccbbaa99887766554433221100"

sgx.nonpie_binary = true
sgx.debug = true
sgx.edmm_enable = {{ 'true' if env.get('EDMM', '0') == '1' else 'false' }}
sgx.max_threads = 16

sgx.allowed_files = [
Expand Down
1 change: 1 addition & 0 deletions libos/test/ltp/manifest.template
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ sys.brk.max_size = "32M"
sys.stack.size = "4M"
sgx.nonpie_binary = true
sgx.debug = true
sgx.edmm_enable = {{ 'true' if env.get('EDMM', '0') == '1' else 'false' }}

sgx.allowed_files = [
"file:/tmp",
Expand Down
1 change: 1 addition & 0 deletions libos/test/regression/argv_from_file.manifest.template
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ fs.mounts = [

sgx.nonpie_binary = true
sgx.debug = true
sgx.edmm_enable = {{ 'true' if env.get('EDMM', '0') == '1' else 'false' }}

sgx.allowed_files = [
"file:argv_test_input",
Expand Down
1 change: 1 addition & 0 deletions libos/test/regression/argv_from_manifest.manifest.template
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ fs.mounts = [

sgx.nonpie_binary = true
sgx.debug = true
sgx.edmm_enable = {{ 'true' if env.get('EDMM', '0') == '1' else 'false' }}

sgx.trusted_files = [
"file:{{ gramine.libos }}",
Expand Down
1 change: 1 addition & 0 deletions libos/test/regression/attestation.manifest.template
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ fs.insecure__keys.default = "ffeeddccbbaa99887766554433221100"

sgx.nonpie_binary = true
sgx.debug = true
sgx.edmm_enable = {{ 'true' if env.get('EDMM', '0') == '1' else 'false' }}

sgx.remote_attestation = "{{ env.get('RA_TYPE', 'none') }}"
sgx.ra_client_spid = "{{ env.get('RA_CLIENT_SPID', '') }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ sgx.insecure__protected_files_key = "ffeeddccbbaa99887766554433221100"

sgx.nonpie_binary = true
sgx.debug = true
sgx.edmm_enable = {{ 'true' if env.get('EDMM', '0') == '1' else 'false' }}

sgx.remote_attestation = true
sgx.ra_client_spid = "{{ env.get('RA_CLIENT_SPID', '') }}"
Expand Down
1 change: 1 addition & 0 deletions libos/test/regression/bootstrap_cpp.manifest.template
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ fs.mounts = [
sgx.max_threads = 8
sgx.nonpie_binary = true
sgx.debug = true
sgx.edmm_enable = {{ 'true' if env.get('EDMM', '0') == '1' else 'false' }}

sgx.trusted_files = [
"file:{{ gramine.libos }}",
Expand Down
1 change: 1 addition & 0 deletions libos/test/regression/debug_log_file.manifest.template
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ fs.mounts = [

sgx.nonpie_binary = true
sgx.debug = true
sgx.edmm_enable = {{ 'true' if env.get('EDMM', '0') == '1' else 'false' }}

sgx.trusted_files = [
"file:{{ gramine.libos }}",
Expand Down
Loading

0 comments on commit 1b1242f

Please sign in to comment.