MesaTEE SGX: Redefining AI and Big Data Analysis with ...
Transcript of MesaTEE SGX: Redefining AI and Big Data Analysis with ...
![Page 1: MesaTEE SGX: Redefining AI and Big Data Analysis with ...](https://reader033.fdocuments.us/reader033/viewer/2022051813/628205498bba5253597dd6c6/html5/thumbnails/1.jpg)
MesaTEE SGX: Redefining AI and Big Data Analysis with Intel SGX
Yu Ding
Staff Security Scientist, Baidu X-Lab
May-29-2019
![Page 2: MesaTEE SGX: Redefining AI and Big Data Analysis with ...](https://reader033.fdocuments.us/reader033/viewer/2022051813/628205498bba5253597dd6c6/html5/thumbnails/2.jpg)
About me• https://dingelish.com
• https://github.com/dingelish
• https://github.com/baidu/rust-sgx-sdk• Security Scientist @Baidu X-Lab
• Rust Fans
• Ph.D on Exploit/Mitigation
• Works on Rust-SGX projects
![Page 3: MesaTEE SGX: Redefining AI and Big Data Analysis with ...](https://reader033.fdocuments.us/reader033/viewer/2022051813/628205498bba5253597dd6c6/html5/thumbnails/3.jpg)
MesaTEE SGXRedefining AI and Big Data Analysis with Intel SGX
Intel SGX for Privacy-Preserving Computation
• Background of Intel SGX
• Challenges on building a privacy-preserving software stack based on Intel SGX
Hybrid Memory Safety
• Rule-of-thumb
• Practice on Intel SGX
Towards a Secure and Trustworthy AI/Big Data Analysis framework
• What is trustworthiness?
• Achieving trustworthy AI/Big Data Analysis using Intel SGX
![Page 4: MesaTEE SGX: Redefining AI and Big Data Analysis with ...](https://reader033.fdocuments.us/reader033/viewer/2022051813/628205498bba5253597dd6c6/html5/thumbnails/4.jpg)
MesaTEE SGXRedefining AI and Big Data Analysis with Intel SGX
Intel SGX for Privacy-Preserving Computation
• Background of Intel SGX
• Challenges on building a privacy-preserving software stack based on Intel SGX
Hybrid Memory Safety
• Rule-of-thumb
• Practice on Intel SGX
Towards a Secure and Trustworthy AI/Big Data Analysis framework
• What is trustworthiness?
• Achieving trustworthy AI/Big Data Analysis using Intel SGX
![Page 5: MesaTEE SGX: Redefining AI and Big Data Analysis with ...](https://reader033.fdocuments.us/reader033/viewer/2022051813/628205498bba5253597dd6c6/html5/thumbnails/5.jpg)
MesaTEE SGXRedefining AI and Big Data Analysis with Intel SGX
![Page 6: MesaTEE SGX: Redefining AI and Big Data Analysis with ...](https://reader033.fdocuments.us/reader033/viewer/2022051813/628205498bba5253597dd6c6/html5/thumbnails/6.jpg)
MesaTEE SGXRedefining AI and Big Data Analysis with Intel SGX
![Page 7: MesaTEE SGX: Redefining AI and Big Data Analysis with ...](https://reader033.fdocuments.us/reader033/viewer/2022051813/628205498bba5253597dd6c6/html5/thumbnails/7.jpg)
MesaTEE SGXRedefining AI and Big Data Analysis with Intel SGX
• Cloud Provider
• Data Owner
• Algorithm Provider (can be data owner)
• Don’t trust each other
• Data leaves its owner but still guaranteed to be under control
![Page 8: MesaTEE SGX: Redefining AI and Big Data Analysis with ...](https://reader033.fdocuments.us/reader033/viewer/2022051813/628205498bba5253597dd6c6/html5/thumbnails/8.jpg)
MesaTEE SGXRedefining AI and Big Data Analysis with Intel SGX
• Solution Overview
• Use Intel SGX to establish trust and TEE
• Secure and Trusted Authentication/Authorization
• Secure and Trusted Channel
• Secure and Trusted Execution Environment
• Build system with hybrid memory safety
• Trustworthy AI/Big Data Analysis
![Page 9: MesaTEE SGX: Redefining AI and Big Data Analysis with ...](https://reader033.fdocuments.us/reader033/viewer/2022051813/628205498bba5253597dd6c6/html5/thumbnails/9.jpg)
MesaTEE SGXRedefining AI and Big Data Analysis with Intel SGX
![Page 10: MesaTEE SGX: Redefining AI and Big Data Analysis with ...](https://reader033.fdocuments.us/reader033/viewer/2022051813/628205498bba5253597dd6c6/html5/thumbnails/10.jpg)
MesaTEE SGXRedefining AI and Big Data Analysis with Intel SGX
Intel SGX for Privacy-Preserving Computation
• Background of Intel SGX
• Challenges on building a privacy-preserving software stack based on Intel SGX
Hybrid Memory Safety
• Rule-of-thumb
• Practice on Intel SGX
Towards a Secure and Trustworthy AI/Big Data Analysis framework
• What is trustworthiness?
• Achieving trustworthy AI/Big Data Analysis using Intel SGX
![Page 11: MesaTEE SGX: Redefining AI and Big Data Analysis with ...](https://reader033.fdocuments.us/reader033/viewer/2022051813/628205498bba5253597dd6c6/html5/thumbnails/11.jpg)
Background of Intel SGXApps not protected from privileged code attacks
Intel® Software Guard Extensions(Intel® SGX)Frank McKeen, Intel Labs, April 15, 2015
![Page 12: MesaTEE SGX: Redefining AI and Big Data Analysis with ...](https://reader033.fdocuments.us/reader033/viewer/2022051813/628205498bba5253597dd6c6/html5/thumbnails/12.jpg)
Background of Intel SGXAttack surface without/with Intel SGX Enclaves
Intel® Software Guard Extensions(Intel® SGX)Frank McKeen, Intel Labs, April 15, 2015
![Page 13: MesaTEE SGX: Redefining AI and Big Data Analysis with ...](https://reader033.fdocuments.us/reader033/viewer/2022051813/628205498bba5253597dd6c6/html5/thumbnails/13.jpg)
Background of Intel SGXMemory access control during address translation
Intel® Software Guard Extensions(Intel® SGX)Frank McKeen, Intel Labs, April 15, 2015
![Page 14: MesaTEE SGX: Redefining AI and Big Data Analysis with ...](https://reader033.fdocuments.us/reader033/viewer/2022051813/628205498bba5253597dd6c6/html5/thumbnails/14.jpg)
Background of Intel SGXConfidentiality and Integrity guarantees
Intel® Software Guard Extensions(Intel® SGX)Frank McKeen, Intel Labs, April 15, 2015
![Page 15: MesaTEE SGX: Redefining AI and Big Data Analysis with ...](https://reader033.fdocuments.us/reader033/viewer/2022051813/628205498bba5253597dd6c6/html5/thumbnails/15.jpg)
Background of Intel SGXMeasurement and Attestation
Verify the measurement/signer
Establish trust by Remote Attestation
Sealing and Attestation in Intel® Software Guard Extensions (SGX)Rebekah Leslie-Hurd, Intel® Corporation, January 8th, 2016
![Page 16: MesaTEE SGX: Redefining AI and Big Data Analysis with ...](https://reader033.fdocuments.us/reader033/viewer/2022051813/628205498bba5253597dd6c6/html5/thumbnails/16.jpg)
Background of Intel SGXRemote Attestation
Figure is from “A First Step Towards Leveraging Commodity
Trusted Execution Environments for Network Applications”,
Seongmin Kim et al.
Target Enclave
Quoting Enclave
Challenger Enclave
SGX CPU
Host platformRemote platform
SGX CPU
1. Request2. Calculate
MAC
3. Send MAC
6. Send signature
CMAC
Hash
4. Verify
5. Sign with group key [EPID]
![Page 17: MesaTEE SGX: Redefining AI and Big Data Analysis with ...](https://reader033.fdocuments.us/reader033/viewer/2022051813/628205498bba5253597dd6c6/html5/thumbnails/17.jpg)
Background of Intel SGXShort Summary of Intel SGX
• Provides any application the ability to keep a secret
• Provide capability using new processor instructions
• Application can support multiple enclaves
• Provides integrity and confidentiality
• Resists hardware attacks
• Prevent software access, including privileged software and SMM
• Applications run within OS environment
• Low learning curve for application developers
• Open to all developers Intel® Software Guard Extensions(Intel® SGX)Frank McKeen, Intel Labs, April 15, 2015
![Page 18: MesaTEE SGX: Redefining AI and Big Data Analysis with ...](https://reader033.fdocuments.us/reader033/viewer/2022051813/628205498bba5253597dd6c6/html5/thumbnails/18.jpg)
Background of Intel SGXChallenges on building a privacy-preserving software stack based on Intel SGX
• Hard Limitations of Intel SGX
• No syscall
• No RDTSC
• No CPUID
• 128 Mbytes of EPC memory. Slow page-fault driven memory swapping
• No mprotect
![Page 19: MesaTEE SGX: Redefining AI and Big Data Analysis with ...](https://reader033.fdocuments.us/reader033/viewer/2022051813/628205498bba5253597dd6c6/html5/thumbnails/19.jpg)
Background of Intel SGXChallenges on building a privacy-preserving software stack based on Intel SGX
• Hard Limitations of Intel SGX => Challenges
• No syscall
• No fs/net/env/proc/thread/…
• No RDTSC
• No trusted time. How to verify a TLS certificate?
• No CPUID
• Some crypto libraries needs it for better performance
• 128 Mbytes of EPC memory. Slow page-fault driven memory swapping
• AI? Big data analysis?
• No mprotect: JIT? AOT?
![Page 20: MesaTEE SGX: Redefining AI and Big Data Analysis with ...](https://reader033.fdocuments.us/reader033/viewer/2022051813/628205498bba5253597dd6c6/html5/thumbnails/20.jpg)
Background of Intel SGXChallenges on building a privacy-preserving software stack based on Intel SGX
• Hard Limitations of Intel SGX => Challenges
• No syscall
• No fs/net/env/proc/thread/…
• No RDTSC
• No trusted time. How to verify a TLS certificate?
• No CPUID
• Some crypto libraries needs it for better performance
• 128 Mbytes of EPC memory. Slow page-fault driven memory swapping
• AI? Big data analysis?
• No mprotect: JIT? AOT?
![Page 21: MesaTEE SGX: Redefining AI and Big Data Analysis with ...](https://reader033.fdocuments.us/reader033/viewer/2022051813/628205498bba5253597dd6c6/html5/thumbnails/21.jpg)
Background of Intel SGXChallenges on building a privacy-preserving software stack based on Intel SGX
• Soft Limitations of Intel SGX
• Suffers from memory bugs
• Memory Safety?
• Overflow?
• UAF?
• Data Racing?
• ROP?
COOKIE
BUFFER
BUFFER
BUFFER
SAVED %ebp
RETURN ADDR
![Page 22: MesaTEE SGX: Redefining AI and Big Data Analysis with ...](https://reader033.fdocuments.us/reader033/viewer/2022051813/628205498bba5253597dd6c6/html5/thumbnails/22.jpg)
Background of Intel SGXChallenges on building a privacy-preserving software stack based on Intel SGX
• Soft Limitations of Intel SGX
• Suffers from memory bugs
• Memory Safety?
• Overflow?
• UAF?
• Data Racing?
• ROP?
COOKIE
BUFFER
BUFFER
BUFFER
SAVED %ebp
RETURN ADDR
![Page 23: MesaTEE SGX: Redefining AI and Big Data Analysis with ...](https://reader033.fdocuments.us/reader033/viewer/2022051813/628205498bba5253597dd6c6/html5/thumbnails/23.jpg)
Background of Intel SGXChallenges on building a privacy-preserving software stack based on Intel SGX
• Short Summary
• Challenges
• Re-implement a software stack in Intel SGX environment on a limited foundation
• Require memory safety guarantees
![Page 24: MesaTEE SGX: Redefining AI and Big Data Analysis with ...](https://reader033.fdocuments.us/reader033/viewer/2022051813/628205498bba5253597dd6c6/html5/thumbnails/24.jpg)
MesaTEE SGXRedefining AI and Big Data Analysis with Intel SGX
Intel SGX for Privacy-Preserving Computation
• Background of Intel SGX
• Challenges on building a privacy-preserving software stack based on Intel SGX
Hybrid Memory Safety
• Rule-of-thumb
• Practice on Intel SGX
Towards a Secure and Trustworthy AI/Big Data Analysis framework
• What is trustworthiness?
• Achieving trustworthy AI/Big Data Analysis using Intel SGX
![Page 25: MesaTEE SGX: Redefining AI and Big Data Analysis with ...](https://reader033.fdocuments.us/reader033/viewer/2022051813/628205498bba5253597dd6c6/html5/thumbnails/25.jpg)
Hybrid Memory SafetyProgramming Languages Guarantee Memory Safety
![Page 26: MesaTEE SGX: Redefining AI and Big Data Analysis with ...](https://reader033.fdocuments.us/reader033/viewer/2022051813/628205498bba5253597dd6c6/html5/thumbnails/26.jpg)
Hybrid Memory SafetyThe Software Stack
• Kernel
• Syscall
• Libc, system libs
• Runtime libs
• Applications
![Page 27: MesaTEE SGX: Redefining AI and Big Data Analysis with ...](https://reader033.fdocuments.us/reader033/viewer/2022051813/628205498bba5253597dd6c6/html5/thumbnails/27.jpg)
Hybrid Memory SafetyThe Software Stack
• Kernel
• Syscall
• Libc, system libs
• Runtime libs
• Applications
![Page 28: MesaTEE SGX: Redefining AI and Big Data Analysis with ...](https://reader033.fdocuments.us/reader033/viewer/2022051813/628205498bba5253597dd6c6/html5/thumbnails/28.jpg)
Hybrid Memory SafetyHybrid Memory Safety – Rule-of-thumb
• Unsafe components must not taint safe components, especially
for public APIs and data structures.
• Unsafe components should be as small as possible and
decoupled from safe components.
• Unsafe components should be explicitly marked during
deployment and ready to upgrade.
![Page 29: MesaTEE SGX: Redefining AI and Big Data Analysis with ...](https://reader033.fdocuments.us/reader033/viewer/2022051813/628205498bba5253597dd6c6/html5/thumbnails/29.jpg)
Hybrid Memory SafetyHybrid Memory Safety – MesaPy as an Example
![Page 30: MesaTEE SGX: Redefining AI and Big Data Analysis with ...](https://reader033.fdocuments.us/reader033/viewer/2022051813/628205498bba5253597dd6c6/html5/thumbnails/30.jpg)
Hybrid Memory SafetyHybrid Memory Safety – Practice in SGX
Linux Rust-SGX
Kernel N/A
Syscall OCALL (statically controlled)
Libc Intel – SGX tlibc
Runtime Rust-SGX sgx_tstd/…
![Page 31: MesaTEE SGX: Redefining AI and Big Data Analysis with ...](https://reader033.fdocuments.us/reader033/viewer/2022051813/628205498bba5253597dd6c6/html5/thumbnails/31.jpg)
Hybrid Memory SafetyHybrid Memory Safety – Practice in SGX
Enclave Boundary
sgx_tlibc sgx_trts sgx_tcrypto sgx_tservices
sgx_tstd sgx_trts sgx_tcrypto sgx_tservices
crypto_helperring/rustls/webpki tvm-runtime
Remote attestation Data storage/trans Interpreter
Rusty-machine gbdt-rs tvm worker
![Page 32: MesaTEE SGX: Redefining AI and Big Data Analysis with ...](https://reader033.fdocuments.us/reader033/viewer/2022051813/628205498bba5253597dd6c6/html5/thumbnails/32.jpg)
Hybrid Memory SafetyHybrid Memory Safety – Practice in SGX
liballoc
libstd
libcore
libclibpanic_abort libunwind librustc_demangle
compiler_builtinsglibc
#![no_std]
#![no_core]
![Page 33: MesaTEE SGX: Redefining AI and Big Data Analysis with ...](https://reader033.fdocuments.us/reader033/viewer/2022051813/628205498bba5253597dd6c6/html5/thumbnails/33.jpg)
Hybrid Memory SafetyHybrid Memory Safety – Practice in SGX
liballoc
libstd
libcore
libclibpanic_abort sgx_unwind librustc_demangle
compiler_builtins
sgx_tstdc
sgx_trts
…
#![no_std]
#![no_core]
sgx_libc
sgx_alloc sgx_tprotected_fs
![Page 34: MesaTEE SGX: Redefining AI and Big Data Analysis with ...](https://reader033.fdocuments.us/reader033/viewer/2022051813/628205498bba5253597dd6c6/html5/thumbnails/34.jpg)
MesaTEE SGXRedefining AI and Big Data Analysis with Intel SGX
Intel SGX for Privacy-Preserving Computation
• Background of Intel SGX
• Challenges on building a privacy-preserving software stack based on Intel SGX
Hybrid Memory Safety
• Rule-of-thumb
• Practice on Intel SGX
Towards a Secure and Trustworthy AI/Big Data Analysis framework
• What is trustworthiness?
• Achieving trustworthy AI/Big Data Analysis using Intel SGX
![Page 35: MesaTEE SGX: Redefining AI and Big Data Analysis with ...](https://reader033.fdocuments.us/reader033/viewer/2022051813/628205498bba5253597dd6c6/html5/thumbnails/35.jpg)
Towards a Secure and Trustworthy AI/Big Data Analysis framework
What is trustworthiness?
![Page 36: MesaTEE SGX: Redefining AI and Big Data Analysis with ...](https://reader033.fdocuments.us/reader033/viewer/2022051813/628205498bba5253597dd6c6/html5/thumbnails/36.jpg)
What is trustworthiness?
Towards a Secure and Trustworthy AI/Big Data Analysis framework
![Page 37: MesaTEE SGX: Redefining AI and Big Data Analysis with ...](https://reader033.fdocuments.us/reader033/viewer/2022051813/628205498bba5253597dd6c6/html5/thumbnails/37.jpg)
What is trustworthiness?
Towards a Secure and Trustworthy AI/Big Data Analysis framework
The term Trustworthy Computing (TwC) has been
applied to computing systems that are inherently secure,
available, and reliable. It is particularly associated with
the Microsoft initiative of the same name, launched in
2002.
![Page 38: MesaTEE SGX: Redefining AI and Big Data Analysis with ...](https://reader033.fdocuments.us/reader033/viewer/2022051813/628205498bba5253597dd6c6/html5/thumbnails/38.jpg)
Towards a Secure and Trustworthy AI/Big Data Analysis framework
What is trustworthiness?
Trusted computing
The term is taken from the field of trusted systems and has a
specialized meaning. With Trusted Computing, the computer will
consistently behave in expected ways, and those behaviors will be
enforced by computer hardware and software.
![Page 39: MesaTEE SGX: Redefining AI and Big Data Analysis with ...](https://reader033.fdocuments.us/reader033/viewer/2022051813/628205498bba5253597dd6c6/html5/thumbnails/39.jpg)
Towards a Secure and Trustworthy AI/Big Data Analysis framework
Achieving trustworthy AI/Big Data Analysis using Intel SGX
Gradient-Boosting decision tree
How to achieve trustworthy?
• The running instance started with the static binary I wanted to run
• The static binary is generated from the codes I want to use
• The code I use implements the algorithm honestly
• The compiler is not doing evil
• Data transfer is secure
![Page 40: MesaTEE SGX: Redefining AI and Big Data Analysis with ...](https://reader033.fdocuments.us/reader033/viewer/2022051813/628205498bba5253597dd6c6/html5/thumbnails/40.jpg)
Towards a Secure and Trustworthy AI/Big Data Analysis framework
Achieving trustworthy AI/Big Data Analysis using Intel SGX
Gradient-Boosting decision tree
gbdt-rs
• ~2000 sloc of Rust – Self explain
• Well commented/documented
• 7x faster than XGBoost on 1thread
• Works seamlessly in SGX
• Clean and clear software stack!
9.9
1.5
11.5
1.9
0
2
4
6
8
10
12
14
500K
samples with
1000 features
100K
samples with
600 features
GB
Memory Usage
rust c++
195.60
9.94
241.42
11.89
0.00
50.00
100.00
150.00
200.00
250.00
300.00
500K
samples with
1000
features
100K
samples with
600 features
Seco
nd
s
Training Time
rust c++
![Page 41: MesaTEE SGX: Redefining AI and Big Data Analysis with ...](https://reader033.fdocuments.us/reader033/viewer/2022051813/628205498bba5253597dd6c6/html5/thumbnails/41.jpg)
Towards a Secure and Trustworthy AI/Big Data Analysis framework
Achieving trustworthy AI/Big Data Analysis using Intel SGX
MesaPy SGX
• Ported PyPy with strong bound check
• Disabled all syscalls
• Customized runtime – limited ocall
• Eliminate indeterminism
• Formal verification
• Replace unsafe libraries with Rust crates
![Page 42: MesaTEE SGX: Redefining AI and Big Data Analysis with ...](https://reader033.fdocuments.us/reader033/viewer/2022051813/628205498bba5253597dd6c6/html5/thumbnails/42.jpg)
Towards a Secure and Trustworthy AI/Big Data Analysis framework
Achieving trustworthy AI/Big Data Analysis using Intel SGX
![Page 43: MesaTEE SGX: Redefining AI and Big Data Analysis with ...](https://reader033.fdocuments.us/reader033/viewer/2022051813/628205498bba5253597dd6c6/html5/thumbnails/43.jpg)
Towards a Secure and Trustworthy AI/Big Data Analysis framework
Achieving trustworthy AI/Big Data Analysis using Intel SGX
We are working with Baidu XuperData for applications
![Page 44: MesaTEE SGX: Redefining AI and Big Data Analysis with ...](https://reader033.fdocuments.us/reader033/viewer/2022051813/628205498bba5253597dd6c6/html5/thumbnails/44.jpg)
Towards a Secure and Trustworthy AI/Big Data Analysis framework
Anakin-SGX
0 5 10 15 20 25 30 35 40
SGX
X86-64
NIN_ImageNet (1000 images)
User Sys
![Page 45: MesaTEE SGX: Redefining AI and Big Data Analysis with ...](https://reader033.fdocuments.us/reader033/viewer/2022051813/628205498bba5253597dd6c6/html5/thumbnails/45.jpg)
Q&A
MesaTEE SGX: Redefining AI and Big Data Analysis with Intel SGX
Yu Ding
Security Scientist, Baidu X-Lab