[Examples] Don't use unsupported "Rules with Grouped Targets" in Make

This commit is a result of debugging a rare race condition during build
of some of our examples, which resulted in "enclave EINIT failed -
Invalid measurement" error.

It turns out that Make in versions that doesn't support the `&:`
operator ("Rules with Grouped Targets") silently ignores it and calls
the recipe for each target separately, without even a warning.

Signed-off-by: Michał Kowalczyk <mkow@invisiblethingslab.com>
This commit is contained in:
Michał Kowalczyk
2021-02-16 04:00:13 +01:00
parent 81b96f4178
commit 94caf7987e
4 changed files with 24 additions and 6 deletions

View File

@@ -59,7 +59,12 @@ blender.manifest: blender.manifest.template trusted-libs | $(RUN_DIR)
$<; \
cat trusted-libs) > $@
blender.sig blender.manifest.sgx &: $(BLENDER_DIR)/blender blender.manifest \
# Make on Ubuntu <= 20.04 doesn't support "Rules with Grouped Targets" (`&:`),
# we need to hack around.
blender.sig blender.manifest.sgx: sgx_outputs
.INTERMEDIATE: sgx_outputs
sgx_outputs: $(BLENDER_DIR)/blender blender.manifest \
$(GRAPHENE_DIR)/Runtime/libpal-Linux-SGX.so | $(RUN_DIR)
$(GRAPHENE_DIR)/Pal/src/host/Linux-SGX/signer/pal-sgx-sign \
-output blender.manifest.sgx \

View File

@@ -54,9 +54,12 @@ trusted-libs: ../common_tools/get_deps.sh
$<; \
cat trusted-libs) > $@
# Rules to generate the SGX-specific manifest (.manifest.sgx), the enclave signature (.sig), and the
# enclave initialization token (.token).
gcc.sig gcc.manifest.sgx &: gcc.manifest
# Make on Ubuntu <= 20.04 doesn't support "Rules with Grouped Targets" (`&:`),
# we need to hack around.
gcc.sig gcc.manifest.sgx: sgx_outputs
.INTERMEDIATE: sgx_outputs
sgx_outputs: gcc.manifest
$(GRAPHENEDIR)/Pal/src/host/Linux-SGX/signer/pal-sgx-sign \
-libpal $(GRAPHENEDIR)/Runtime/libpal-Linux-SGX.so \
-key $(SGX_SIGNER_KEY) \

View File

@@ -49,7 +49,12 @@ include ../../Scripts/Makefile.configs
-e 's|$$(ARCH_LIBDIR)|'"$(ARCH_LIBDIR)"'|g' \
$< > $@
pytorch.sig pytorch.manifest.sgx &: pytorch.manifest
# Make on Ubuntu <= 20.04 doesn't support "Rules with Grouped Targets" (`&:`),
# we need to hack around.
pytorch.sig pytorch.manifest.sgx: sgx_outputs
.INTERMEDIATE: sgx_outputs
sgx_outputs: pytorch.manifest
$(GRAPHENEDIR)/Pal/src/host/Linux-SGX/signer/pal-sgx-sign \
-libpal $(GRAPHENEDIR)/Runtime/libpal-Linux-SGX.so \
-key $(SGX_SIGNER_KEY) \

View File

@@ -89,7 +89,12 @@ redis-server.manifest: redis-server.manifest.template
# EINITTOKEN must be generated on the machine where the application will run, not where it was
# built.
redis-server.sig redis-server.manifest.sgx &: redis-server.manifest $(SRCDIR)/src/redis-server
# Make on Ubuntu <= 20.04 doesn't support "Rules with Grouped Targets" (`&:`),
# we need to hack around.
redis-server.sig redis-server.manifest.sgx: sgx_outputs
.INTERMEDIATE: sgx_outputs
sgx_outputs: redis-server.manifest $(SRCDIR)/src/redis-server
$(GRAPHENEDIR)/Pal/src/host/Linux-SGX/signer/pal-sgx-sign \
-libpal $(GRAPHENEDIR)/Runtime/libpal-Linux-SGX.so \
-key $(SGX_SIGNER_KEY) \