apache / incubator-teaclave

Apache Teaclave (incubating) is an open source universal secure computing platform, making computation on privacy-sensitive data safe and simple.
https://teaclave.apache.org
Apache License 2.0
763 stars 158 forks source link

How solve the runtime error in simulation mode? #437

Open light-ok opened 3 years ago

light-ok commented 3 years ago

Hello,

I had built Teaclave in simulation mode docker run --rm -v $(pwd):/teaclave -w /teaclave \ -it teaclave/teaclave-build-ubuntu-1804-sgx-2.9.1:latest \ bash -c ". /root/.cargo/env && \ . /opt/sgxsdk/environment && \ mkdir -p build && cd build && \ cmake -DTEST_MODE=ON -DSGX_SIM_MODE=ON .. && \ make"

And then I run the command (cd docker && docker-compose -f docker-compose-ubuntu-1804.yml up --build) but it show ERROR: Service 'teaclave-access-control-service' failed to build: ADD failed: stat /var/lib/docker/tmp/docker-builder869057053/release/services/teaclave_frontend_service: no such file or directory

How to sovle the issue for the simulation mode?

My os : Ubuntu 18.04.4 LTS My CPU:Intel(R) Xeon(R) Gold 6266C CPU @ 3.00GHz It does not support Intel SGX.

mssun commented 3 years ago

The teaclave_frontend_service is the output of compilation. Seems that your building was failed. Can you check if there are service binaries generated in the release/services/ direactory?

light-ok commented 3 years ago

The teaclave_frontend_service is the output of compilation. Seems that your building was failed. Can you check if there are service binaries generated in the release/services/ direactory?

When I compiled the project, it shown the error as below:

Caused by:
  process didn't exit successfully: `/teaclave/cmake/scripts/rustc_wrapper.sh --crate-name crc --edition=2018 /teaclave/build/cmake_tomls/sgx_trusted_lib/third_party/crates-sgx/vendor/crc/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C debuginfo=2 -C metadata=39ca99cb54d77a3c -C extra-filename=-39ca99cb54d77a3c --out-dir /teaclave/build/target/trusted/debug/deps -L dependency=/teaclave/build/target/trusted/debug/deps --cap-lints allow --cfg test_mode --cfg sgx_sim` (signal: 9, SIGKILL: kill)
warning: build failed, waiting for other jobs to finish...
error: build failed

The files in release\services is:

# ll release/services
total 696M
drwxr-xr-x 5 root root 4.0K Nov 30 19:31 auditors
-rw-r--r-- 1 root root 1.9K Dec  3 17:57 enclave_info.toml
lrwxrwxrwx 1 root root   32 Nov 30 19:31 fixtures -> /teaclave/release/tests/fixtures
-rw-r--r-- 1 root root 1.4K Dec  3 17:50 runtime.config.toml
-rwxr-xr-x 1 root root  35M Dec  3 17:55 teaclave_access_control_service
-rw-r--r-- 1 root root  64M Dec  3 17:57 teaclave_access_control_service_enclave.signed.so
-rwxr-xr-x 1 root root  35M Dec  3 17:57 teaclave_authentication_service
-rw-r--r-- 1 root root  55M Dec  3 10:44 teaclave_authentication_service_enclave.signed.so
-rwxr-xr-x 1 root root  70M Dec  3 17:57 teaclave_execution_service
-rw-r--r-- 1 root root  86M Dec  3 17:53 teaclave_execution_service_enclave.signed.so
-rwxr-xr-x 1 root root  35M Dec  3 17:57 teaclave_frontend_service
-rw-r--r-- 1 root root  54M Dec  3 17:53 teaclave_frontend_service_enclave.signed.so
-rwxr-xr-x 1 root root  35M Dec  3 17:55 teaclave_management_service
-rw-r--r-- 1 root root  55M Dec  3 17:57 teaclave_management_service_enclave.signed.so
-rwxr-xr-x 1 root root  35M Dec  3 17:57 teaclave_scheduler_service
-rw-r--r-- 1 root root  53M Dec  3 17:52 teaclave_scheduler_service_enclave.signed.so
-rwxr-xr-x 1 root root  35M Dec  3 17:57 teaclave_storage_service
-rw-r--r-- 1 root root  54M Dec  3 10:48 teaclave_storage_service_enclave.signed.so
mssun commented 3 years ago

I see "signal: 9, SIGKILL: kill" in your log. I believe this is cause by the out of memory, resulting compilation failed. Please increase your memory if your are using VM in cloud service or docker in Mac.

light-ok commented 3 years ago

I see "signal: 9, SIGKILL: kill" in your log. I believe this is cause by the out of memory, resulting compilation failed. Please increase your memory if your are using VM in cloud service or docker in Mac.

Now, I have compiled successfully.

[ 96%] Building sgxapp-teaclave_execution_service
   Compiling indexmap v1.3.2
   Compiling h2 v0.2.2
   Compiling hyper v0.13.3
   Compiling hyper-tls v0.4.1
   Compiling reqwest v0.10.4
   Compiling teaclave_file_agent v0.1.0 (/teaclave/build/cmake_tomls/sgx_untrusted_app/file_agent)
   Compiling teaclave_execution_service v0.1.0 (/teaclave/build/cmake_tomls/sgx_untrusted_app/services/execution/app)
    Finished dev [unoptimized + debuginfo] target(s) in 15.37s
[ 96%] Built target sgxapp-teaclave_execution_service
[100%] Building sgxapp-teaclave_functional_tests
    Finished dev [unoptimized + debuginfo] target(s) in 0.16s
[100%] Built target sgxapp-teaclave_functional_tests

But I run the command (cd docker && docker-compose -f docker-compose-ubuntu-1804.yml up --build) but it also show

ERROR: Service 'teaclave-access-control-service' failed to build: ADD failed: stat /var/lib/docker/tmp/docker-builder869057053/release/services/teaclave_frontend_service: no such file or directory
mssun commented 3 years ago

Can you confirm the teaclave_frontend_service file is successfully generated?

master-davidlee commented 3 years ago

I met a similar error image and this is my release/services image and I successed compiled image

mssun commented 3 years ago

Ok, yours is different. The docker-compose reports an error. There are something wrong with the docker-compose-ubuntu-1804-sgx-sim-mode.yml file.

Here is a patch. I'll create a PR to solve this issue. Thanks.

diff --git a/docker/docker-compose-ubuntu-1804-sgx-sim-mode.yml b/docker/docker-compose-ubuntu-1804-sgx-sim-mode.yml
index b0f25aa..5b5895d 100644
--- a/docker/docker-compose-ubuntu-1804-sgx-sim-mode.yml
+++ b/docker/docker-compose-ubuntu-1804-sgx-sim-mode.yml
@@ -20,7 +20,7 @@ services:
       - AS_URL
       - TEACLAVE_LOG
     entrypoint: ./teaclave_authentication_service
-    container_name: teaclave-authentication-service
+    container_name: teaclave-authentication-service-sgx-sim-mode
     networks:
       api:
       internal:
@@ -44,8 +44,8 @@ services:
       - TEACLAVE_LOG
     entrypoint: ./teaclave_frontend_service
     depends_on:
-      - teaclave-management-service
-    container_name: teaclave-frontend-service
+      - teaclave-management-service-sgx-sim-mode
+    container_name: teaclave-frontend-service-sgx-sim-mode
     networks:
       api:
       internal:
@@ -67,9 +67,9 @@ services:
       - TEACLAVE_LOG
     entrypoint: ./teaclave_management_service
     depends_on:
-      - teaclave-storage-service
-      - teaclave-access-control-service
-    container_name: teaclave-management-service
+      - teaclave-storage-service-sgx-sim-mode
+      - teaclave-access-control-service-sgx-sim-mode
+    container_name: teaclave-management-service-sgx-sim-mode
     networks:
       internal:

@@ -89,7 +89,7 @@ services:
       - AS_URL
       - TEACLAVE_LOG
     entrypoint: ./teaclave_storage_service
-    container_name: teaclave-storage-service
+    container_name: teaclave-storage-service-sgx-sim-mode
     networks:
       internal:

@@ -108,7 +108,7 @@ services:
       - AS_ALGO
       - AS_URL
       - TEACLAVE_LOG
-    container_name: teaclave-access-control-service
+    container_name: teaclave-access-control-service-sgx-sim-mode
     entrypoint: ./teaclave_access_control_service
     networks:
       internal:
@@ -129,9 +129,9 @@ services:
       - AS_URL
       - TEACLAVE_LOG
     entrypoint: ./teaclave_execution_service
-    container_name: teaclave-execution-service
+    container_name: teaclave-execution-service-sgx-sim-mode
     depends_on:
-      - teaclave-scheduler-service
+      - teaclave-scheduler-service-sgx-sim-mode
     networks:
       internal:
       fs:
@@ -152,9 +152,9 @@ services:
       - AS_URL
       - TEACLAVE_LOG
     entrypoint: ./teaclave_scheduler_service
-    container_name: teaclave-scheduler-service
+    container_name: teaclave-scheduler-service-sgx-sim-mode
     depends_on:
-      - teaclave-storage-service
+      - teaclave-storage-service-sgx-sim-mode
     networks:
       internal: