AccTEE: A WebAssembly-based Two-way Sandbox for Trusted R esource - - PowerPoint PPT Presentation

acctee a webassembly based two way sandbox for trusted r
SMART_READER_LITE
LIVE PREVIEW

AccTEE: A WebAssembly-based Two-way Sandbox for Trusted R esource - - PowerPoint PPT Presentation

AccTEE: A WebAssembly-based Two-way Sandbox for Trusted R esource Accounting MIDDLEWARE 2019 , UC Davis David Goltzsche, 1 Manuel Nieke, 1 Thomas Knauth, 2 and Rdiger Kapitza 1 goltzsche@ibr.cs.tu-bs.de @d_goltzsche 1 TU Braunschweig, Germany 2


slide-1
SLIDE 1

AccTEE: A WebAssembly-based Two-way Sandbox for Trusted Resource Accounting

MIDDLEWARE 2019, UC Davis

David Goltzsche,1 Manuel Nieke,1 Thomas Knauth,2 and Rüdiger Kapitza1 goltzsche@ibr.cs.tu-bs.de @d_goltzsche

1TU Braunschweig, Germany 2Intel, United States

slide-2
SLIDE 2

Design of AccTEE Evaluation of AccTEE Related Work Conclusion

Offloading Computations

Offloading computations to remote infrastructure

Cloud Computing Volunteer Computing Client-side Web applications

Reasons:

Remotely available resources Moving computations closer to customers

Usually two entities:

Workload provider Infrastructure provider

2019-12-11 D. Goltzsche, TU Braunschweig, Germany AccTEE, D. Goltzsche et al. Page 2

slide-3
SLIDE 3

Design of AccTEE Evaluation of AccTEE Related Work Conclusion

Offloading Computations

Offloading computations to remote infrastructure

Cloud Computing Volunteer Computing Client-side Web applications

Reasons:

Remotely available resources Moving computations closer to customers

Usually two entities:

Workload provider Infrastructure provider

2019-12-11 D. Goltzsche, TU Braunschweig, Germany AccTEE, D. Goltzsche et al. Page 2

slide-4
SLIDE 4

Design of AccTEE Evaluation of AccTEE Related Work Conclusion

Offloading Computations

Offloading computations to remote infrastructure

Cloud Computing Volunteer Computing Client-side Web applications

Reasons:

Remotely available resources Moving computations closer to customers

Usually two entities:

Workload provider Infrastructure provider

Accounting of consumed resources in some cases

2019-12-11 D. Goltzsche, TU Braunschweig, Germany AccTEE, D. Goltzsche et al. Page 2

slide-5
SLIDE 5

Design of AccTEE Evaluation of AccTEE Related Work Conclusion

Resource Accounting

Cloud Computing

CPU and memory usage, I/O operations

Volunteer Computing

Logging of donated CPU time

Client-side Web applications

No accounting in practice

2019-12-11 D. Goltzsche, TU Braunschweig, Germany AccTEE, D. Goltzsche et al. Page 3

slide-6
SLIDE 6

Design of AccTEE Evaluation of AccTEE Related Work Conclusion

Resource Accounting in Practice

Accounting on different levels

Task level (e.g. for completed tasks) Hardware level (e.g. CPU usage)

Resources always accounted by infrastructure provider

2019-12-11 D. Goltzsche, TU Braunschweig, Germany AccTEE, D. Goltzsche et al. Page 4

slide-7
SLIDE 7

Design of AccTEE Evaluation of AccTEE Related Work Conclusion

Resource Accounting in Practice

Accounting on different levels

Task level (e.g. for completed tasks) Hardware level (e.g. CPU usage)

Resources always accounted by infrastructure provider Current approaches of resource accounting require trust in the infrastructure provider

2019-12-11 D. Goltzsche, TU Braunschweig, Germany AccTEE, D. Goltzsche et al. Page 4

slide-8
SLIDE 8

Design of AccTEE Evaluation of AccTEE Related Work Conclusion

Trust Relationship

Malicious infrastructure provider can …

Spy on provided code or data Fake accounting results (overbilling)

Malicious workload provider can …

Provide crafted workload to destroy execution environment Trick resource accounting

2019-12-11 D. Goltzsche, TU Braunschweig, Germany AccTEE, D. Goltzsche et al. Page 5

slide-9
SLIDE 9

Design of AccTEE Evaluation of AccTEE Related Work Conclusion

Trust Relationship

Malicious infrastructure provider can …

Spy on provided code or data Fake accounting results (overbilling)

Malicious workload provider can …

Provide crafted workload to destroy execution environment Trick resource accounting

Problem: Limited trust between infrastructure and workload provider

2019-12-11 D. Goltzsche, TU Braunschweig, Germany AccTEE, D. Goltzsche et al. Page 5

slide-10
SLIDE 10

Design of AccTEE Evaluation of AccTEE Related Work Conclusion

Outline

Design of AccTEE Evaluation of AccTEE Related Work Conclusion

2019-12-11 D. Goltzsche, TU Braunschweig, Germany AccTEE, D. Goltzsche et al. Page 6

slide-11
SLIDE 11

Design of AccTEE Evaluation of AccTEE Related Work Conclusion

Approach of AccTEE

workload provider infrastructure provider

  • 1. Workload provider provides workload
  • 2. Infrastructure provider executes workload in sandbox
  • 3. Sandbox produces mutually trusted resource usage log

2019-12-11 D. Goltzsche, TU Braunschweig, Germany AccTEE, D. Goltzsche et al. Page 7

slide-12
SLIDE 12

Design of AccTEE Evaluation of AccTEE Related Work Conclusion

Approach of AccTEE

provides workload workload provider infrastructure provider

  • 1. Workload provider provides workload
  • 2. Infrastructure provider executes workload in sandbox
  • 3. Sandbox produces mutually trusted resource usage log

2019-12-11 D. Goltzsche, TU Braunschweig, Germany AccTEE, D. Goltzsche et al. Page 7

slide-13
SLIDE 13

Design of AccTEE Evaluation of AccTEE Related Work Conclusion

Approach of AccTEE

sandbox provides workload workload provider infrastructure provider

  • 1. Workload provider provides workload
  • 2. Infrastructure provider executes workload in sandbox
  • 3. Sandbox produces mutually trusted resource usage log

2019-12-11 D. Goltzsche, TU Braunschweig, Germany AccTEE, D. Goltzsche et al. Page 7

slide-14
SLIDE 14

Design of AccTEE Evaluation of AccTEE Related Work Conclusion

Approach of AccTEE

resource usage log produces log sandbox provides workload workload provider infrastructure provider

  • 1. Workload provider provides workload
  • 2. Infrastructure provider executes workload in sandbox
  • 3. Sandbox produces mutually trusted resource usage log

2019-12-11 D. Goltzsche, TU Braunschweig, Germany AccTEE, D. Goltzsche et al. Page 7

slide-15
SLIDE 15

Design of AccTEE Evaluation of AccTEE Related Work Conclusion

Approach of AccTEE

resource usage log produces log sandbox provides workload workload provider infrastructure provider

  • 1. Workload provider provides workload
  • 2. Infrastructure provider executes workload in sandbox
  • 3. Sandbox produces mutually trusted resource usage log

How do we get an sandbox with mutually trusted resource accounting?

2019-12-11 D. Goltzsche, TU Braunschweig, Germany AccTEE, D. Goltzsche et al. Page 7

slide-16
SLIDE 16

Design of AccTEE Evaluation of AccTEE Related Work Conclusion

AccTEE’s Sandbox

Accountable sandbox is a combination of two sandboxes Execution sandbox

Shields host from workload Shields accounting from workload

Accounting sandbox

Shields workload from host Shields accounting from host

untrusted host accounting sandbox execution sandbox workload

2019-12-11 D. Goltzsche, TU Braunschweig, Germany AccTEE, D. Goltzsche et al. Page 8

slide-17
SLIDE 17

Design of AccTEE Evaluation of AccTEE Related Work Conclusion

Background: WebAssembly (WASM)

A platform independent binary instruction format Initially designed for computations in browsers

Standalone execution emerging

Goal: a safe, fast and portable low-level code Application code is compiled to WASM WebAssembly code executed in sandboxes

Based on software fault isolation

2019-12-11 D. Goltzsche, TU Braunschweig, Germany AccTEE, D. Goltzsche et al. Page 9

slide-18
SLIDE 18

Design of AccTEE Evaluation of AccTEE Related Work Conclusion

Background: Intel SGX

x86 instruction set extension Creation of trusted execution environments (TEEs) → enclaves Execution and data inside enclaves protected from privileged software Hardware-based memory integrity protection and encryption Only CPU is trusted Remote attestation of enclaves Limitation: enclave page cache (EPC) size application enclave

  • perating system

hardware CPU

2019-12-11 D. Goltzsche, TU Braunschweig, Germany AccTEE, D. Goltzsche et al. Page 10

slide-19
SLIDE 19

Design of AccTEE Evaluation of AccTEE Related Work Conclusion

AccTEE’s Two-way Sandbox

AccTEE combines two sandboxes Execution sandbox

Based on WebAssembly

Accounting sandbox

Based on Intel SGX Code instrumentation for resource accounting

2019-12-11 D. Goltzsche, TU Braunschweig, Germany AccTEE, D. Goltzsche et al. Page 11

slide-20
SLIDE 20

Design of AccTEE Evaluation of AccTEE Related Work Conclusion

AccTEE’s Two-way Sandbox

AccTEE combines two sandboxes Execution sandbox

Based on WebAssembly

Accounting sandbox

Based on Intel SGX Code instrumentation for resource accounting

AccTEE combines SGX and WebAssembly to create a two-way sandbox

2019-12-11 D. Goltzsche, TU Braunschweig, Germany AccTEE, D. Goltzsche et al. Page 11

slide-21
SLIDE 21

Design of AccTEE Evaluation of AccTEE Related Work Conclusion

AccTEE’s Two-way Sandbox

AccTEE combines two sandboxes Execution sandbox

Based on WebAssembly

Accounting sandbox

Based on Intel SGX Code instrumentation for resource accounting

AccTEE combines SGX and WebAssembly to create a two-way sandbox AccTEE instruments WebAssembly code for mutually trusted resource accounting

2019-12-11 D. Goltzsche, TU Braunschweig, Germany AccTEE, D. Goltzsche et al. Page 11

slide-22
SLIDE 22

Design of AccTEE Evaluation of AccTEE Related Work Conclusion

WebAssembly Code Instrumentation

Goal: Count WebAssembly instructions naive instrumentation

Based on basic blocks Counter incremented at end of block

flow-based optimization

Increment by minimum instruction count Update counter based on control flow

loop-based optimization

Identify loop iterators with constant increments Increment counter once after loop

Different instruction costs

AccTEE uses a weighted instruction counter

get_global 12 set_local 3 i32.lt_s i f ( r e s u l t i32 ) get_local 0 i32.load offset=4 e l s e get_local 4 i32.const 255 i32.and end tee_local 4 get_local 1

2019-12-11 D. Goltzsche, TU Braunschweig, Germany AccTEE, D. Goltzsche et al. Page 12

slide-23
SLIDE 23

Design of AccTEE Evaluation of AccTEE Related Work Conclusion

WebAssembly Code Instrumentation

Goal: Count WebAssembly instructions naive instrumentation

Based on basic blocks Counter incremented at end of block

flow-based optimization

Increment by minimum instruction count Update counter based on control flow

loop-based optimization

Identify loop iterators with constant increments Increment counter once after loop

Different instruction costs

AccTEE uses a weighted instruction counter

get_global 12 set_local 3 i32.lt_s <Increment counter by 3> i f ( r e s u l t i32 ) get_local 0 i32.load offset=4 <Increment counter by 2> e l s e get_local 4 i32.const 255 i32.and <Increment counter by 3> end tee_local 4 get_local 1 <Increment counter by 2>

2019-12-11 D. Goltzsche, TU Braunschweig, Germany AccTEE, D. Goltzsche et al. Page 12

slide-24
SLIDE 24

Design of AccTEE Evaluation of AccTEE Related Work Conclusion

WebAssembly Code Instrumentation

Goal: Count WebAssembly instructions naive instrumentation

Based on basic blocks Counter incremented at end of block

flow-based optimization

Increment by minimum instruction count Update counter based on control flow

loop-based optimization

Identify loop iterators with constant increments Increment counter once after loop

Different instruction costs

AccTEE uses a weighted instruction counter

get_global 12 set_local 3 i32.lt_s i f ( r e s u l t i32 ) get_local 0 i32.load offset=4 e l s e get_local 4 i32.const 255 i32.and <Increment counter by 1> end tee_local 4 get_local 1 <Increment counter by 7>

2019-12-11 D. Goltzsche, TU Braunschweig, Germany AccTEE, D. Goltzsche et al. Page 12

slide-25
SLIDE 25

Design of AccTEE Evaluation of AccTEE Related Work Conclusion

AccTEE’s Workflow

Application code (C, C++, Rust, …) WebAssembly Instrumentation Enclave (IE) Instrumented WebAssembly Instrumentation Evidence Accounting Enclave (AE) Resource Usage Log

  • 1. Workload provider compiles application to WebAssembly
  • 2. WebAssembly is instrumented inside Instrumentation Enclave

Instrumentation evidence Instrumented WebAssembly code

  • 3. Accounting Enclave verifies evidence and executes WebAssembly code
  • 4. Result: mutually trusted resource usage log

2019-12-11 D. Goltzsche, TU Braunschweig, Germany AccTEE, D. Goltzsche et al. Page 13

slide-26
SLIDE 26

Design of AccTEE Evaluation of AccTEE Related Work Conclusion

Example Use Cases

Function-as-a-Service

Trusted resource accounting in data centers

Volunteer Computing

Trusted resource accounting at clients

Client-side web applications

Trusted resource accounting in browsers e.g. for replacing micro payments

2019-12-11 D. Goltzsche, TU Braunschweig, Germany AccTEE, D. Goltzsche et al. Page 14

slide-27
SLIDE 27

Design of AccTEE Evaluation of AccTEE Related Work Conclusion

PolyBench/C Benchmark Suite

2mm 3mm adi atax bicg cholesky correlation covariance deriche doitgen durbin fdtd-2d gemm gemver gesummv gramschmidt heat-3d jacobi-1d jacobi-2d lu ludcmp mvt nussinov seidel-2d symm syr2k syrk trisolv trmm 1 2 3 4 Normalised runtime ◭lower is better WASM WASM-SGX WASM-SGX instrumented

Overhead for WASM: 10% Overhead for WASM-SGX: 2.1× (EPC exhaustion) Instrumentation overhead over WASM-SGX: 4% on average

2019-12-11 D. Goltzsche, TU Braunschweig, Germany AccTEE, D. Goltzsche et al. Page 15

slide-28
SLIDE 28

Design of AccTEE Evaluation of AccTEE Related Work Conclusion

WebAssembly Instruction Weights

20 40 60 80 100 20 40 60 80 Percentage of WebAssembly Instructions [%] Cycles per instruction ◭lower is better WebAssembly Instruction

74% of instructions need < 10 cycles 2% of instructions (e.g. f32.sqrt) > 50 cycles

2019-12-11 D. Goltzsche, TU Braunschweig, Germany AccTEE, D. Goltzsche et al. Page 16

slide-29
SLIDE 29

Design of AccTEE Evaluation of AccTEE Related Work Conclusion

WebAssembly Instruction Weights

20 40 60 80 100 20 40 60 80 Percentage of WebAssembly Instructions [%] Cycles per instruction ◭lower is better WebAssembly Instruction

74% of instructions need < 10 cycles 2% of instructions (e.g. f32.sqrt) > 50 cycles

2019-12-11 D. Goltzsche, TU Braunschweig, Germany AccTEE, D. Goltzsche et al. Page 16

slide-30
SLIDE 30

Design of AccTEE Evaluation of AccTEE Related Work Conclusion

WebAssembly Instruction Weights

20 40 60 80 100 20 40 60 80 Percentage of WebAssembly Instructions [%] Cycles per instruction ◭lower is better WebAssembly Instruction

74% of instructions need < 10 cycles 2% of instructions (e.g. f32.sqrt) > 50 cycles

2019-12-11 D. Goltzsche, TU Braunschweig, Germany AccTEE, D. Goltzsche et al. Page 16

slide-31
SLIDE 31

Design of AccTEE Evaluation of AccTEE Related Work Conclusion

Function-as-a-Service (FaaS) Use Case

64 128 512 1024 20 40

37.7 36.7 22.3 9.4 17.5 17 10.5 3.7 17.4 16.9 10.1 3.4 2.5 1.9 2 1.3

Square Image Size [pixel] Throughput [req/s] higher is better◮ WASM WASM-SGX WASM-SGX instr. JS

Benchmark: Image resize FaaS function Accounting overhead is negligible Between 3× and 9× faster than JavaScript baseline

2019-12-11 D. Goltzsche, TU Braunschweig, Germany AccTEE, D. Goltzsche et al. Page 17

slide-32
SLIDE 32

Design of AccTEE Evaluation of AccTEE Related Work Conclusion

Related Work

Combination of Google Native Client (NaCl) and SGX enclaves

MiniBox (ATC’14), Ryoan (OSDI’16) No platform independence No resource accounting

S-FaaS (CCSW’19) Trustworthy and Accountable FaaS

Combines SGX and hyper-threading CPU time measured by dedicated timer thread Wastes an entire core to count CPU cycles

2019-12-11 D. Goltzsche, TU Braunschweig, Germany AccTEE, D. Goltzsche et al. Page 18

slide-33
SLIDE 33

Design of AccTEE Evaluation of AccTEE Related Work Conclusion

Related Work

Combination of Google Native Client (NaCl) and SGX enclaves

MiniBox (ATC’14), Ryoan (OSDI’16) No platform independence No resource accounting

S-FaaS (CCSW’19) Trustworthy and Accountable FaaS

Combines SGX and hyper-threading CPU time measured by dedicated timer thread Wastes an entire core to count CPU cycles

AccTEE is the first two-way sandbox based on SGX and WebAssembly enabling mutually trusted resource accounting

2019-12-11 D. Goltzsche, TU Braunschweig, Germany AccTEE, D. Goltzsche et al. Page 18

slide-34
SLIDE 34

Design of AccTEE Evaluation of AccTEE Related Work Conclusion

Conclusion

AccTEE’s contributions: Implements two-way sandbox Mutually trusted resource accounting

Instrumentation of WebAssembly code Platform independent

More contributions in the paper

Volunteer Computing use case Accounting of I/O and memory usage

2019-12-11 D. Goltzsche, TU Braunschweig, Germany AccTEE, D. Goltzsche et al. Page 19

slide-35
SLIDE 35

Design of AccTEE Evaluation of AccTEE Related Work Conclusion

Conclusion

AccTEE’s contributions: Implements two-way sandbox Mutually trusted resource accounting

Instrumentation of WebAssembly code Platform independent

More contributions in the paper

Volunteer Computing use case Accounting of I/O and memory usage

Thank you for your time! Questions? goltzsche@ibr.cs.tu-bs.de @d_goltzsche

2019-12-11 D. Goltzsche, TU Braunschweig, Germany AccTEE, D. Goltzsche et al. Page 19

slide-36
SLIDE 36

Design of AccTEE Evaluation of AccTEE Related Work Conclusion 2019-12-11 D. Goltzsche, TU Braunschweig, Germany AccTEE, D. Goltzsche et al. Page 20

slide-37
SLIDE 37

Design of AccTEE Evaluation of AccTEE Related Work Conclusion

Side-channel Attacks against Intel SGX Enclaves

Side-channel attacks against SGX:

Spectre Attacks: Exploiting Speculative Execution (S&P’19) Foreshadow: Extracting the Keys to the Intel SGX Kingdom with Transient Out-of-Order Execution (USENIX Security’18) ZombieLoad: Cross-Privilege-Boundary Data Sampling (2019)

All side-channels are not exclusive to SGX! All fixed by microcode updates at cost of transition performance

2019-12-11 D. Goltzsche, TU Braunschweig, Germany AccTEE, D. Goltzsche et al. Page 21