CoRD: Collabora,ve Data Race Detec,on Baris Kasikci, - - PowerPoint PPT Presentation

cord collabora ve data race detec on
SMART_READER_LITE
LIVE PREVIEW

CoRD: Collabora,ve Data Race Detec,on Baris Kasikci, - - PowerPoint PPT Presentation

CoRD: Collabora,ve Data Race Detec,on Baris Kasikci, Cris,an Zamfir, and George Candea School of Computer & Communica3on Sciences Data Races 2 Data Races


slide-1
SLIDE 1

Baris ¡Kasikci, ¡Cris,an ¡Zamfir, ¡and ¡George ¡Candea

School ¡of ¡Computer ¡& ¡Communica3on ¡Sciences

CoRD: ¡Collabora,ve ¡ Data ¡Race ¡Detec,on ¡

slide-2
SLIDE 2

2

Data ¡Races

slide-3
SLIDE 3
  • Accesses ¡to ¡shared ¡memory ¡loca,on

2

Data ¡Races

slide-4
SLIDE 4
  • Accesses ¡to ¡shared ¡memory ¡loca,on
  • By ¡mul3ple ¡threads

2

Data ¡Races

slide-5
SLIDE 5
  • Accesses ¡to ¡shared ¡memory ¡loca,on
  • By ¡mul3ple ¡threads
  • At ¡least ¡one ¡of ¡the ¡accesses ¡is ¡a ¡write

2

Data ¡Races

slide-6
SLIDE 6
  • Accesses ¡to ¡shared ¡memory ¡loca,on
  • By ¡mul3ple ¡threads
  • At ¡least ¡one ¡of ¡the ¡accesses ¡is ¡a ¡write
  • The ¡accesses ¡can ¡happen ¡simultaneously

2

Data ¡Races

slide-7
SLIDE 7

3

Data ¡Races

slide-8
SLIDE 8

3

Data ¡Races

Races ¡are ¡numerous ¡in ¡modern ¡soDware

slide-9
SLIDE 9

3

Data ¡Races

Races ¡are ¡numerous ¡in ¡modern ¡soDware 1000 ¡Races

slide-10
SLIDE 10

Data ¡races

4

slide-11
SLIDE 11

C/C++ POSIX

4

slide-12
SLIDE 12

C/C++ POSIX

Compilers ¡can ¡arbitrarily ¡break ¡racy ¡programs

4

slide-13
SLIDE 13

How ¡to ¡Ensure ¡SoDware ¡is ¡ Race-­‑free?

5

slide-14
SLIDE 14

How ¡to ¡Ensure ¡SoDware ¡is ¡ Race-­‑free?

  • Sta,c ¡race ¡detectors ¡
  • Full ¡path ¡analysis ¡
  • Fast ¡
  • Few ¡false ¡nega3ves ¡
  • Many ¡false ¡posi3ves

5

✔ ✔

×

slide-15
SLIDE 15
  • Dynamic ¡race ¡detectors ¡ ¡
  • Per-­‑run ¡analysis ¡
  • Slow ¡
  • Many ¡false ¡nega3ves ¡
  • Few ¡false ¡posi3ves

×

× ×

How ¡to ¡Ensure ¡SoDware ¡is ¡ Race-­‑free?

  • Sta,c ¡race ¡detectors ¡
  • Full ¡path ¡analysis ¡
  • Fast ¡
  • Few ¡false ¡nega3ves ¡
  • Many ¡false ¡posi3ves

5

✔ ✔

×

slide-16
SLIDE 16
  • Dynamic ¡race ¡detectors ¡ ¡
  • Per-­‑run ¡analysis ¡
  • Slow ¡
  • Many ¡false ¡nega3ves ¡
  • Few ¡false ¡posi3ves

×

× ×

How ¡to ¡Ensure ¡SoDware ¡is ¡ Race-­‑free?

  • Sta,c ¡race ¡detectors ¡
  • Full ¡path ¡analysis ¡
  • Fast ¡
  • Few ¡false ¡nega3ves ¡
  • Many ¡false ¡posi3ves

5

Exis,ng ¡detectors ¡have ¡important ¡limita,ons ✔ ✔

×

slide-17
SLIDE 17
  • Dynamic ¡race ¡detectors ¡ ¡
  • Few ¡false ¡posi3ves ¡ ✔

How ¡to ¡Ensure ¡SoDware ¡is ¡ Race-­‑free?

  • Sta,c ¡race ¡detectors ¡
  • Full ¡path ¡analysis ¡
  • Fast ¡
  • Few ¡false ¡nega3ves

6

✔ ✔ ✔

slide-18
SLIDE 18
  • Collabora,ve ¡race ¡detec,on ¡
  • Full ¡path ¡analysis ¡
  • Fast ¡
  • Few ¡false ¡nega3ves ¡
  • Few ¡false ¡posi3ves

7

✔ ✔ ✔

CoRD

slide-19
SLIDE 19
  • Collabora,ve ¡race ¡detec,on ¡
  • Full ¡path ¡analysis ¡
  • Fast ¡
  • Few ¡false ¡nega3ves ¡
  • Few ¡false ¡posi3ves

7

✔ ✔ ✔

CoRD

Sta,cally ¡detect ¡ poten,al ¡races ¡

slide-20
SLIDE 20
  • Collabora,ve ¡race ¡detec,on ¡
  • Full ¡path ¡analysis ¡
  • Fast ¡
  • Few ¡false ¡nega3ves ¡
  • Few ¡false ¡posi3ves

7

✔ ✔ ✔

CoRD

Sta,cally ¡detect ¡ poten,al ¡races ¡ Dynamically ¡validate ¡ detected ¡races

slide-21
SLIDE 21
  • Collabora,ve ¡race ¡detec,on ¡
  • Full ¡path ¡analysis ¡
  • Fast ¡
  • Few ¡false ¡nega3ves ¡
  • Few ¡false ¡posi3ves

7

✔ ✔ ✔

CoRD

Effec,vely ¡detected ¡8 ¡real ¡races ¡in ¡two ¡ real ¡programs ¡with ¡1% ¡overhead ✔

Sta,cally ¡detect ¡ poten,al ¡races ¡ Dynamically ¡validate ¡ detected ¡races

slide-22
SLIDE 22

CoRD ¡Architecture

P P P P virtual clearing house P P P P

Hive

8

CoRD ¡Architecture

slide-23
SLIDE 23

CoRD ¡Architecture

P P P P virtual clearing house

instances ¡of ¡ program ¡P

P P P P

Hive

8

CoRD ¡Architecture

slide-24
SLIDE 24

CoRD ¡Architecture

P P P P virtual clearing house

instances ¡of ¡ program ¡P

P P P P

Hive

Sta,cally ¡detect ¡ poten,al ¡races ¡in ¡P

8

CoRD ¡Architecture

slide-25
SLIDE 25

CoRD ¡Architecture

P P P P virtual clearing house

instances ¡of ¡ program ¡P

P P P P

Hive

pods Sta,cally ¡detect ¡ poten,al ¡races ¡in ¡P

8

CoRD ¡Architecture

slide-26
SLIDE 26

CoRD ¡Architecture

P P P P virtual clearing house

instances ¡of ¡ program ¡P

P P P P

Hive

pods Sta,cally ¡detect ¡ poten,al ¡races ¡in ¡P Dynamically ¡ validate ¡races

8

CoRD ¡Architecture

slide-27
SLIDE 27

P P P P virtual clearing house

1 ¡Google ¡chrome ¡blog. ¡hFp://chrome.blogspot. ¡ch/2012_06_01_archive.html ¡ ¡ 2 ¡hFps://plus.google.com/114250946512808775436/posts/VaQu9sNxJuY, ¡2012 ¡ 3 ¡R. ¡Cozza ¡et ¡al, ¡Market ¡Share: ¡Mobile ¡Devices ¡by ¡Region ¡and ¡Country, ¡Gartner, ¡Feb ¡2012 ¡ 4 ¡hFp://arstechnica.com/informa3on-­‑technology/2009/10/windows-­‑7-­‑had-­‑8-­‑million-­‑testers-­‑biggest-­‑beta-­‑ever/

9

slide-28
SLIDE 28

P P P P virtual clearing house

computers ¡ running ¡Chrome ¡1

300 ¡Million

1 ¡Google ¡chrome ¡blog. ¡hFp://chrome.blogspot. ¡ch/2012_06_01_archive.html ¡ ¡ 2 ¡hFps://plus.google.com/114250946512808775436/posts/VaQu9sNxJuY, ¡2012 ¡ 3 ¡R. ¡Cozza ¡et ¡al, ¡Market ¡Share: ¡Mobile ¡Devices ¡by ¡Region ¡and ¡Country, ¡Gartner, ¡Feb ¡2012 ¡ 4 ¡hFp://arstechnica.com/informa3on-­‑technology/2009/10/windows-­‑7-­‑had-­‑8-­‑million-­‑testers-­‑biggest-­‑beta-­‑ever/

9

slide-29
SLIDE 29

P P P P virtual clearing house

computers ¡ running ¡Chrome ¡1

300 ¡Million

servers ¡owned ¡ by ¡Google ¡2

1.8 ¡Million

1 ¡Google ¡chrome ¡blog. ¡hFp://chrome.blogspot. ¡ch/2012_06_01_archive.html ¡ ¡ 2 ¡hFps://plus.google.com/114250946512808775436/posts/VaQu9sNxJuY, ¡2012 ¡ 3 ¡R. ¡Cozza ¡et ¡al, ¡Market ¡Share: ¡Mobile ¡Devices ¡by ¡Region ¡and ¡Country, ¡Gartner, ¡Feb ¡2012 ¡ 4 ¡hFp://arstechnica.com/informa3on-­‑technology/2009/10/windows-­‑7-­‑had-­‑8-­‑million-­‑testers-­‑biggest-­‑beta-­‑ever/

9

slide-30
SLIDE 30

P P P P virtual clearing house

computers ¡ running ¡Chrome ¡1

300 ¡Million

servers ¡owned ¡ by ¡Google ¡2

1.8 ¡Million

1 ¡Google ¡chrome ¡blog. ¡hFp://chrome.blogspot. ¡ch/2012_06_01_archive.html ¡ ¡ 2 ¡hFps://plus.google.com/114250946512808775436/posts/VaQu9sNxJuY, ¡2012 ¡ 3 ¡R. ¡Cozza ¡et ¡al, ¡Market ¡Share: ¡Mobile ¡Devices ¡by ¡Region ¡and ¡Country, ¡Gartner, ¡Feb ¡2012 ¡ 4 ¡hFp://arstechnica.com/informa3on-­‑technology/2009/10/windows-­‑7-­‑had-­‑8-­‑million-­‑testers-­‑biggest-­‑beta-­‑ever/

mobile ¡devices
 ¡bought ¡in ¡2011 ¡3

1.8 ¡Billion

9

slide-31
SLIDE 31

P P P P virtual clearing house

computers ¡ running ¡Chrome ¡1

300 ¡Million

servers ¡owned ¡ by ¡Google ¡2

1.8 ¡Million

1 ¡Google ¡chrome ¡blog. ¡hFp://chrome.blogspot. ¡ch/2012_06_01_archive.html ¡ ¡ 2 ¡hFps://plus.google.com/114250946512808775436/posts/VaQu9sNxJuY, ¡2012 ¡ 3 ¡R. ¡Cozza ¡et ¡al, ¡Market ¡Share: ¡Mobile ¡Devices ¡by ¡Region ¡and ¡Country, ¡Gartner, ¡Feb ¡2012 ¡ 4 ¡hFp://arstechnica.com/informa3on-­‑technology/2009/10/windows-­‑7-­‑had-­‑8-­‑million-­‑testers-­‑biggest-­‑beta-­‑ever/

mobile ¡devices
 ¡bought ¡in ¡2011 ¡3

1.8 ¡Billion

9

Windows ¡7 ¡ ¡ beta ¡testers4

8 ¡Million

slide-32
SLIDE 32

Sta,c ¡Race ¡Detec,on

10

slide-33
SLIDE 33

Sta,c ¡Race ¡Detec,on

10

slide-34
SLIDE 34

Sta,c ¡Race ¡Detec,on

10

CFG ¡entry

slide-35
SLIDE 35

Sta,c ¡Race ¡Detec,on

10

CFG ¡entry

slide-36
SLIDE 36

Sta,c ¡Race ¡Detec,on

10

CFG ¡entry main() g() f()

slide-37
SLIDE 37

Sta,c ¡Race ¡Detec,on

10

CFG ¡entry main() g() f()

slide-38
SLIDE 38

Sta,c ¡Race ¡Detec,on

10

CFG ¡entry main() g() f()

slide-39
SLIDE 39

11

slide-40
SLIDE 40

11

slide-41
SLIDE 41

12

Sta,c ¡Race ¡Detec,on

slide-42
SLIDE 42

12

Sta,c ¡Race ¡Detec,on

x = 0

slide-43
SLIDE 43

12

Sta,c ¡Race ¡Detec,on

x = 1 lock(l) unlock(l) Path ¡1 x = 0

slide-44
SLIDE 44

12

Sta,c ¡Race ¡Detec,on

x = 1 lock(l) unlock(l) Path ¡1 x = 2 lock(k) unlock(k) Path ¡2 x = 0

slide-45
SLIDE 45

12

Sta,c ¡Race ¡Detec,on

x = 1 lock(l) unlock(l) Path ¡1 x = 2 lock(k) unlock(k) Path ¡2 LS1 = {l} LS1 = {k} x = 0

slide-46
SLIDE 46

13

LS1 = {l} x = 2 x = 1 LS1 = {k}

Sta,c ¡Race ¡Detec,on

slide-47
SLIDE 47

13

LS1 = {l} x = 2 x = 1 LS1 = {k}

Sta,c ¡Race ¡Detec,on

∩ = ¡{}

slide-48
SLIDE 48

13

LS1 = {l} x = 2 x = 1 LS1 = {k}

Sta,c ¡Race ¡Detec,on

∩ = ¡{}

=> x = 1 and x = 2 are ¡RACING!

slide-49
SLIDE 49

13

LS1 = {l} x = 2 x = 1 LS1 = {k}

Sta,c ¡Race ¡Detec,on

Top-­‑down, ¡flow ¡sensi,ve, ¡interprocedural, ¡lockset-­‑based

∩ = ¡{}

=> x = 1 and x = 2 are ¡RACING!

slide-50
SLIDE 50

Dynamic ¡Race ¡Valida,on

14

Hive

x = 2 x = 1 x = 2 x = 1

slide-51
SLIDE 51

Dynamic ¡Race ¡Valida,on

14

Hive

P Pod ¡2 P Pod ¡1

x = 2 x = 1 x = 2 x = 1

slide-52
SLIDE 52

Dynamic ¡Race ¡Valida,on

14

Hive

P Pod ¡2 P Pod ¡1

x = 2 x = 1 x = 2 x = 1 Time

slide-53
SLIDE 53

Dynamic ¡Race ¡Valida,on

14

Hive

P Pod ¡2 P Pod ¡1

x = 2 x = 1 x = 2 x = 1 Time

e x e c u t e d executed

RACE

slide-54
SLIDE 54

Dynamic ¡Race ¡Valida,on

14

Hive

P Pod ¡2 P Pod ¡1

x = 2 x = 1 x = 2 x = 1 Time

e x e c u t e d executed

RACE

d e a d l

  • c

k executed

RACE ¡CAUSES ¡ DEADLOCK

slide-55
SLIDE 55

Dynamic ¡Race ¡Valida,on

14

Hive

P Pod ¡2 P Pod ¡1

x = 2 x = 1 x = 2 x = 1 Time

e x e c u t e d executed

RACE

e x e c u t e d crash

RACE ¡CAUSES ¡ CRASH

d e a d l

  • c

k executed

RACE ¡CAUSES ¡ DEADLOCK

slide-56
SLIDE 56

Dynamic ¡Race ¡Valida,on

14

Hive

P Pod ¡2 P Pod ¡1

x = 2 x = 1 x = 2 x = 1 Time

e x e c u t e d executed

RACE

e x e c u t e d not ¡executed

LIKELY ¡FP

e x e c u t e d crash

RACE ¡CAUSES ¡ CRASH

d e a d l

  • c

k executed

RACE ¡CAUSES ¡ DEADLOCK

slide-57
SLIDE 57

Dynamic ¡Race ¡Valida,on

14

Hive

P Pod ¡2 P Pod ¡1

x = 2 x = 1 x = 2 x = 1 Time

e x e c u t e d executed

RACE

e x e c u t e d not ¡executed

LIKELY ¡FP

n

  • t

¡ e x e c u t e d not ¡executed

NOT ¡ EXECUTED

e x e c u t e d crash

RACE ¡CAUSES ¡ CRASH

d e a d l

  • c

k executed

RACE ¡CAUSES ¡ DEADLOCK

slide-58
SLIDE 58

Detec,on ¡Results ¡and ¡Efficiency

15

TOTAL RUNTIME ¡ ¡ OVERHEAD

SQLite Pbzip2

RACE LIKELY ¡FP NOT ¡ EXECUTED RACE ¡CAUSES ¡ CRASH RACE ¡CAUSES ¡ DEADLOCK

slide-59
SLIDE 59

Detec,on ¡Results ¡and ¡Efficiency

15

TOTAL RUNTIME ¡ ¡ OVERHEAD

SQLite Pbzip2

88 122 RACE LIKELY ¡FP NOT ¡ EXECUTED RACE ¡CAUSES ¡ CRASH RACE ¡CAUSES ¡ DEADLOCK

slide-60
SLIDE 60

Detec,on ¡Results ¡and ¡Efficiency

15

TOTAL RUNTIME ¡ ¡ OVERHEAD

SQLite Pbzip2

88 122 ¡ ¡0 ¡ ¡ ¡1 RACE LIKELY ¡FP NOT ¡ EXECUTED RACE ¡CAUSES ¡ CRASH RACE ¡CAUSES ¡ DEADLOCK

slide-61
SLIDE 61

Detec,on ¡Results ¡and ¡Efficiency

15

TOTAL RUNTIME ¡ ¡ OVERHEAD

SQLite Pbzip2

88 122 ¡ ¡4 ¡ ¡ ¡0 ¡ ¡0 ¡ ¡ ¡1 RACE LIKELY ¡FP NOT ¡ EXECUTED RACE ¡CAUSES ¡ CRASH RACE ¡CAUSES ¡ DEADLOCK

slide-62
SLIDE 62

Detec,on ¡Results ¡and ¡Efficiency

15

TOTAL RUNTIME ¡ ¡ OVERHEAD

SQLite Pbzip2

88 122 ¡ ¡4 ¡ ¡ ¡0 ¡ ¡0 ¡ ¡ ¡3 ¡ ¡0 ¡ ¡ ¡1 RACE LIKELY ¡FP NOT ¡ EXECUTED RACE ¡CAUSES ¡ CRASH RACE ¡CAUSES ¡ DEADLOCK

slide-63
SLIDE 63

Detec,on ¡Results ¡and ¡Efficiency

15

TOTAL RUNTIME ¡ ¡ OVERHEAD

SQLite Pbzip2

88 122 ¡ ¡4 ¡ ¡ ¡0 ¡ ¡0 ¡ ¡ ¡3 ¡ ¡0 ¡ ¡ ¡1 ¡ ¡37 ¡ ¡ ¡63 RACE LIKELY ¡FP NOT ¡ EXECUTED RACE ¡CAUSES ¡ CRASH RACE ¡CAUSES ¡ DEADLOCK

slide-64
SLIDE 64

Detec,on ¡Results ¡and ¡Efficiency

15

TOTAL RUNTIME ¡ ¡ OVERHEAD

SQLite Pbzip2

88 122 ¡ ¡4 ¡ ¡ ¡0 ¡ ¡0 ¡ ¡ ¡3 ¡ ¡0 ¡ ¡ ¡1 ¡ ¡37 ¡ ¡ ¡63 ¡48 ¡ ¡ ¡54 RACE LIKELY ¡FP NOT ¡ EXECUTED RACE ¡CAUSES ¡ CRASH RACE ¡CAUSES ¡ DEADLOCK

slide-65
SLIDE 65

Detec,on ¡Results ¡and ¡Efficiency

15

TOTAL RUNTIME ¡ ¡ OVERHEAD

SQLite Pbzip2

88 122 ¡ ¡4 ¡ ¡ ¡0 ¡ ¡0 ¡ ¡ ¡3 ¡ ¡0 ¡ ¡ ¡1 ¡ ¡37 ¡ ¡ ¡63 ¡48 ¡ ¡ ¡54 0.99% 0.91% RACE LIKELY ¡FP NOT ¡ EXECUTED RACE ¡CAUSES ¡ CRASH RACE ¡CAUSES ¡ DEADLOCK

slide-66
SLIDE 66

Detec,on ¡Results ¡and ¡Efficiency

15

TOTAL RUNTIME ¡ ¡ OVERHEAD

Effec,ve ¡and ¡low ¡overhead

SQLite Pbzip2

88 122 ¡ ¡4 ¡ ¡ ¡0 ¡ ¡0 ¡ ¡ ¡3 ¡ ¡0 ¡ ¡ ¡1 ¡ ¡37 ¡ ¡ ¡63 ¡48 ¡ ¡ ¡54 0.99% 0.91% RACE LIKELY ¡FP NOT ¡ EXECUTED RACE ¡CAUSES ¡ CRASH RACE ¡CAUSES ¡ DEADLOCK

slide-67
SLIDE 67

CoRD ThreadSani,zer

Comparison ¡to ¡Other ¡Detectors

16

0.99% 0.91% 972% 3,001%

SQLite Pbzip2

  • Dynamic ¡detectors ¡have ¡high ¡overhead
slide-68
SLIDE 68

CoRD ThreadSani,zer

Comparison ¡to ¡Other ¡Detectors

16

0.99% 0.91% 972% 3,001%

SQLite Pbzip2

  • Sta,c ¡detectors ¡have ¡false ¡posi,ves ¡and ¡

don’t ¡provide ¡any ¡classifica,on

  • Dynamic ¡detectors ¡have ¡high ¡overhead
slide-69
SLIDE 69

Summary

  • Collabora,ve ¡race ¡detec,on ¡
  • Sta3cally ¡detect ¡races ¡
  • Dynamically ¡validate ¡them ¡
  • Effec,ve ¡
  • Detected ¡8 ¡real ¡races ¡in ¡2 ¡real ¡programs ¡
  • Efficient ¡
  • Has ¡< ¡1% ¡overhead

17

slide-70
SLIDE 70

Roadmap

  • Synthesizing ¡fixes ¡
  • Privacy ¡implica,ons ¡
  • Extension ¡to ¡other ¡types ¡of ¡bugs

18