Taming Transactions: Towards Hardware-Assisted Control Flow - - PowerPoint PPT Presentation

taming transactions towards hardware assisted control
SMART_READER_LITE
LIVE PREVIEW

Taming Transactions: Towards Hardware-Assisted Control Flow - - PowerPoint PPT Presentation

The 19th International Symposium on Research in Attacks, Intrusions and Defenses (RAID 2016) Taming Transactions: Towards Hardware-Assisted Control Flow Integrity using Transactional Memory Marius Muench, Fabio Pagani, Yan Shoshitaishvili,


slide-1
SLIDE 1

Taming Transactions: Towards Hardware-Assisted Control Flow Integrity using Transactional Memory

Marius Muench, Fabio Pagani, Yan Shoshitaishvili, Christopher Kruegel, Giovanni Vigna, and Davide Balzarotti

The 19th International Symposium on Research in Attacks, Intrusions and Defenses (RAID 2016)

slide-2
SLIDE 2

Outline

0100100001100101 0110110001101100 0110111101010111 0110111101110010 0110110001100100

slide-3
SLIDE 3

Control Flow Integrity

  • Abadi et al., ‘05
slide-4
SLIDE 4

Architectural Support Commodity Features

+ ?

Hardware-Assisted CFI

  • HAFIX (Dave et al., ’15)
  • SOFIA (de Clarq et al., ’16)
  • HCFI (Christoulakis et al., ’16)
  • CFImon (Xia et al., ’12)
  • PathArmor (van der Veen et

al., ‘15)

  • CCFI (Mashtizadeh et al, ’15)
slide-5
SLIDE 5

Transactional Memory Herlihy & Moss: “Transactional Memory: Architectural Support for Lock-Free Data Structures” (1993)

slide-6
SLIDE 6

Serializability Atomicity

COMMIT ABORT

Transactions

slide-7
SLIDE 7

Transactional Synchronization eXtensions

XTEST XACQUIRE XRELEASE XBEGIN XEND XABORT

Restricted Transactional Memory Hardware Lock Elision

slide-8
SLIDE 8

XACQUIRE LOCK ADD [rax], 1 ;execute critical section XRELEASE LOCK SUB [rax], 1

Hardware Lock Elision

  • Elides Hardware Locks
  • Prefix Based
  • XACQUIRE, XRELEASE
  • Used instead of LOCK-prefix
  • Backwards compatible
  • Failed Transaction
  • Rollback of changed memory
  • Re-execution with traditional

locking

slide-9
SLIDE 9

XBEGIN __fall_back_path ;execute critical section XEND

Restricted Transactional Memory

  • Marks Code Regions as

Transactional

  • Instruction Based
  • XBEGIN, XEND, XABORT
  • Not backwards compatible
  • Failed Transaction
  • Rollback of changed memory
  • Execution of fall-back path
  • Reason of failure stored in RAX
slide-10
SLIDE 10

Transactional Aborts

  • Conflicts on shared data
  • Different value of elided lock (HLE)
  • Instruction based aborts
  • Imperative

– XABORT, CPUID, PAUSE

  • Implementation dependent

→ Context switch sensitivity

  • Transactional Nesting Limit
  • COMMIT

ABORT

slide-11
SLIDE 11

TSX-based CFI Can we leverage Intel’s TSX to enforce CFI?

16/09/2016 -

slide-12
SLIDE 12

TSX-based CFI

  • Enclose every control-flow transfer with a

transaction

  • Use fall-back paths to verify integrity
  • Focus on label-based approaches
slide-13
SLIDE 13

RTM

  • No labels
  • Clobbered RAX in Fall-

back Path

  • XEND outside of

transaction yields SEGFAULT HLE

  • Elided Lock Value as

Label

  • Virtual Fall-back path

required

TSX-based CFI

slide-14
SLIDE 14

TSX-based CFI: Example

slide-15
SLIDE 15

TSX-based CFI: Example

Enter Transaction

slide-16
SLIDE 16

TSX-based CFI: Example

Enter Transaction Leave Transaction

slide-17
SLIDE 17

TSX-based CFI: Example

Enter Transaction Leave Transaction Verify Presence of XEND Instruction

slide-18
SLIDE 18

TSX-based CFI: Example

Enter Transaction Leave Transaction Continue Normal Execution Verify Presence of XEND Instruction

slide-19
SLIDE 19

TSX-based CFI: Example

Enter Transaction Leave Transaction Continue Normal Execution Terminate Program Verify Presence of XEND Instruction

slide-20
SLIDE 20

Prototype Implementation

slide-21
SLIDE 21

Evaluation

slide-22
SLIDE 22

Conclusion

  • Can we leverage Intel’s TSX to enforce CFI?
  • Yes!
  • We proposed two methods for CFI enforcement:
  • RTM-based
  • HLE-based
  • Interesting side-effects
  • Mediocre performance (for now)
  • Implementation will be released on github:
  • https://github.com/eurecom-s3/tsxcfi
slide-23
SLIDE 23

Intel’s Control Flow Enforcement Technology

  • Preview released in June 2016
  • Backward-Edges: Shadow Stack
  • Forward-Edges: ENDBRANCH Instruction
  • Indirect branch forces CPU to enter WAIT_FOR_ENDBRANCH state
  • Similar to RTM-based CFI
  • No hardware available yet!
slide-24
SLIDE 24

This Slide is Intentionally Left Blank

slide-25
SLIDE 25

Bonus-Example: TSX-based CFI (HLE)

18/09/2016 -

  • p 24

Enter Transaction Leave Transaction Test for Transactional Execution Store Label Verify Presence of Label Terminate Program