capeprivacy / tf-trusted

tf-trusted allows you to run TensorFlow models in secure enclaves
https://capeprivacy.com/
Apache License 2.0
87 stars 11 forks source link

Audit TF Trusted to remove unneeded exits and system calls #9

Open justin1121 opened 5 years ago

justin1121 commented 5 years ago

Whenever exits (e.g. print statements) or other system calls happen it causes the SGX program to be slower than it needs to be. We can audit the code to make sure we remove all prints and other obvious system calls. To discover system calls that might be occurring that we're not aware of, inside TF Lite for example, we can use strace to investigate further. Here's a quick tutorial explaining how to use strace https://www.youtube.com/watch?v=EG0ihttnEJI.

Another route to take is to look deeper into sgx switchless code. This makes it so that CPU doesn't need to switch from enclave mode to unprotected mode when calling exits or system calls. Figuring out if Asylo supports this by default would be a good place to start. More information on switchless in SGX can be found here https://github.com/intel/linux-sgx/tree/master/SampleCode/Switchless and here https://github.com/intel/linux-sgx/tree/master/sdk/switchless.