Performance is Dead Long Live Performance Ben Zorn

  • Slides: 48
Download presentation
Performance is Dead, Long Live Performance Ben Zorn Microsoft Research

Performance is Dead, Long Live Performance Ben Zorn Microsoft Research

Outline Good news Bad news Good news again! Mystery… Ben Zorn CGO 2010 Keynote

Outline Good news Bad news Good news again! Mystery… Ben Zorn CGO 2010 Keynote 2

1990 s A Great Decade for Performance! • Stock market booming • Itanium processor

1990 s A Great Decade for Performance! • Stock market booming • Itanium processor shipping • Processor performance growing exponentially (Moore’s Law) • Compiler research booming Ben Zorn CGO 2010 Keynote 3

NASDAQ Booming 6000 5000 4000 3000 2000 1000 0 1/3/1995 1/3/1996 1/3/1997 1/3/1998 1/3/1999

NASDAQ Booming 6000 5000 4000 3000 2000 1000 0 1/3/1995 1/3/1996 1/3/1997 1/3/1998 1/3/1999 1/3/2000 Ben Zorn CGO 2010 Keynote 1/3/2001 1/3/2002 1/3/2003 4

New Processors Had High Expectations Itanium Sales Forecasts Source: CNET Networks from data provided

New Processors Had High Expectations Itanium Sales Forecasts Source: CNET Networks from data provided by Sun and IDC (12/7/2005) Ben Zorn CGO 2010 Keynote 5

SPECint 2006 CPU Performance 100. 00 1. 00 0. 10 intel 486 intel pentium

SPECint 2006 CPU Performance 100. 00 1. 00 0. 10 intel 486 intel pentium 2 intel pentium 3 intel pentium 4 intel itanium Alpha 21064 Alpha 21164 Alpha 21264 Sparc Super. Sparc 64 Mips HP PA Power PC AMD K 6 AMD K 7 AMD x 86 -64 IBM Power 0. 01 88 89 90 91 92 93 94 95 96 97 98 99 00 01 02 03 04 05 06 07 08 09 Year of Introduction Numbers courtesy of Mark Horowitz, Ofer Shacham Ben Zorn CGO 2010 Keynote 6

Performance Papers Dominate PLDI 35 Papers Published 30 25 20 Correctness Other 15 Performance

Performance Papers Dominate PLDI 35 Papers Published 30 25 20 Correctness Other 15 Performance 10 5 0 19861988198919901991199219931994199519961997199819992000 Ben Zorn CGO 2010 Keynote 7

Some Cynics: Proebsting’s Law • Proebsting's Law: Compiler Advances Double Computing Power Every 18

Some Cynics: Proebsting’s Law • Proebsting's Law: Compiler Advances Double Computing Power Every 18 Years “…This means that while hardware computing horsepower increases at roughly 60%/year, compiler optimizations contribute only 4%. Basically, compiler optimization work makes only marginal contributions. ” http: //research. microsoft. com/en-us/um/people/toddpro/papers/law. htm Ben Zorn CGO 2010 Keynote 8

The Bubble Bursts 6000 5000 4000 3000 2000 1000 0 1/3/1995 1/3/1996 1/3/1997 1/3/1998

The Bubble Bursts 6000 5000 4000 3000 2000 1000 0 1/3/1995 1/3/1996 1/3/1997 1/3/1998 1/3/1999 1/3/2000 Ben Zorn CGO 2010 Keynote 1/3/2001 1/3/2002 1/3/2003 9

Itanium Sales Lag Source: CNET Networks from data provided by Sun and IDC (12/7/2005)

Itanium Sales Lag Source: CNET Networks from data provided by Sun and IDC (12/7/2005) Ben Zorn CGO 2010 Keynote http: //news. cnet. com/2300 -1006_3 -5873647. html 10

Uniprocessor Performance Flattens 4%/year sounding pretty good Numbers courtesy of Mark Horowitz, Ofer Shacham

Uniprocessor Performance Flattens 4%/year sounding pretty good Numbers courtesy of Mark Horowitz, Ofer Shacham Ben Zorn CGO 2010 Keynote 11

PLDI Performance Paper Decline 50 45 35 30 25 Correctness 20 Other Performance 15

PLDI Performance Paper Decline 50 45 35 30 25 Correctness 20 Other Performance 15 10 What Happened? 5 0 1986 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 Papers Published 40 Ben Zorn CGO 2010 Keynote 12

Performance is Dead Ben Zorn CGO 2010 Keynote 13

Performance is Dead Ben Zorn CGO 2010 Keynote 13

What Killed Performance? Nimda September 2001 Became largest worm in 22 minutes Code Red

What Killed Performance? Nimda September 2001 Became largest worm in 22 minutes Code Red July 2001 359 k hosts, 1 day Slammer January 2003 Infected 90% of vulnerable hosts in < 10 minutes Ben Zorn CGO 2010 Keynote 14

Companies Shift Gears • Correctness and security a major new focus • Microsoft investments:

Companies Shift Gears • Correctness and security a major new focus • Microsoft investments: – PREfix, PREfast, SDV (Slam), ESP – Large code bases automatically checked for correctness errors (10+ million LOC) • “Combined, the tools [PREfix and PREfast] found 12. 5% of the bugs fixed in Windows Server 2003” – “Righting Software”, Larus et al. , IEEE Software, 2004 Ben Zorn CGO 2010 Keynote 15

Researchers Shift Gears • Ben’s research agenda changes • 1990 s – Predicting object

Researchers Shift Gears • Ben’s research agenda changes • 1990 s – Predicting object lifetime and locality (with David Barrett and Matt Seidl) – Branch Prediction (with Brad Calder et al. ) – Value Prediction (with Martin Burtscher) • 2000 s –tough sounding project names – Die. Hard – with Emery Berger, Gene Novark – Samurai – with Karthik Pattabiraman – Nozzle – with Ben Livshits Ben Zorn CGO 2010 Keynote 16

The New Threat: Exploitable Memory Corruptions • Buffer overflow c char *c = malloc(100);

The New Threat: Exploitable Memory Corruptions • Buffer overflow c char *c = malloc(100); c[101] = ‘a’; a 0 99 • Use after free char *p 1 = malloc(100); char *p 2 = p 1; p 1 free(p 1); p 2[0] = ‘x’; Ben Zorn CGO 2010 Keynote p 2 x 0 99 17

Strategies for Avoiding Memory Corruptions • Rewrite in a safe language (Java, C#, Java.

Strategies for Avoiding Memory Corruptions • Rewrite in a safe language (Java, C#, Java. Script) • Static analysis / safe subset of C or C++ – SAFECode [Adve], etc. • Runtime detection, fail fast – Jones & Lin, CRED [Lam], CCured [Necula], others… • A New Approach: Tolerate Corruption and Continue – Failure oblivious computing [Rinard] (unsound) – Rx, Boundless Memory Blocks, ECC memory – Die. Hard / Exterminator, Samurai Ben Zorn CGO 2010 Keynote 18

Correctness at What Cost? • Heap implementations are/were maximally brittle for performance • Space:

Correctness at What Cost? • Heap implementations are/were maximally brittle for performance • Space: packed as tightly as possible • Time: reuse freed objects as soon as possible – free = push freelist malloc = pop freelist Ben Zorn CGO 2010 Keynote 19

Die. Hard Allocator in a Nutshell • With Emery Berger (PLDI 2006) • Existing

Die. Hard Allocator in a Nutshell • With Emery Berger (PLDI 2006) • Existing heaps are brittle, predictable Normal Heap – Predictable layout is easier for attacker to exploit • Randomize and overprovision the heap – Expansion factor determines how much empty space – Semantics are identical – Allocator is easy to replace Die. Hard Heap • Replication increases benefits • Exterminator extended ideas (PLDI 2007, Novark et al. ) Ben Zorn CGO 2010 Keynote 20

Of Course, Performance Matters Ben Zorn CGO 2010 Keynote 21

Of Course, Performance Matters Ben Zorn CGO 2010 Keynote 21

Die. Hard Impact • Die. Hard (non-replicated) – Windows, Linux version implemented by Emery

Die. Hard Impact • Die. Hard (non-replicated) – Windows, Linux version implemented by Emery Berger – Works in Fire. Fox distribution without any changes – Try it right now! (http: //www. diehard-software. org/) • Robust. Heap – Microsoft internal version implemented by Ted Hart – Prototyped in Microsoft products – Demonstrated to tolerate faults and detect errors • Windows 7 Fault Tolerant Heap (FTH) – Inspired by ideas from Die. Hard/Robustheap – Turns on when application crashes Ben Zorn CGO 2010 Keynote 22

A Benefit of Working at Microsoft… One day I was trying to convince a

A Benefit of Working at Microsoft… One day I was trying to convince a security team that Die. Hard would improve security… They said “What about heap spraying? ” And I said “What’s that? ” (long pause) And they said “Look it up…” Ben Zorn CGO 2010 Keynote 23

Here’s What I Found… http: //www. web 2 secure. com/2009/07/mozilla-firefox-35 -heap-spray. html Common Element:

Here’s What I Found… http: //www. web 2 secure. com/2009/07/mozilla-firefox-35 -heap-spray. html Common Element: All vulnerable applications support Flash 3. 5 July 23, 2009 embedded scripting Firefox languages July 14, 2009 (Java. Script, Action. Script, etc. ) Adobe Acrobat / Reader February 19, 2009 http: //blog. fireeye. com/research/2009/07/actionscript_heap_spray. html Ben Zorn CGO 2010 Keynote 24

Drive-By Heap Spraying Owned! Ben Zorn CGO 2010 Keynote 25

Drive-By Heap Spraying Owned! Ben Zorn CGO 2010 Keynote 25

Drive-By Heap Spraying (2) ASLR prevents the attack Program Heap ok bad PC Creates

Drive-By Heap Spraying (2) ASLR prevents the attack Program Heap ok bad PC Creates the malicious object ok <HTML> <SCRIPT language="text/javascript"> shellcode = unescape("%u 4343%. . . ''); </SCRIPT> Triggers the jump <IFRAME SRC=file: //BBBBBBBBBBBBBBBBB … NAME="CCCCCCCCCCCCCCCCCCCC … ഍ "> </IFRAME> </HTML> Ben Zorn CGO 2010 Keynote 26

Drive-By Heap Spraying (3) Program Heap bad ok bad bad <SCRIPT language="text/javascript"> shellcode =

Drive-By Heap Spraying (3) Program Heap bad ok bad bad <SCRIPT language="text/javascript"> shellcode = unescape("%u 4343%. . . ''); oneblock = unescape("%u 0 C 0 C"); var fullblock = oneblock; while (fullblock. length<0 x 40000) { fullblock += fullblock; } Allocate 1000 s of malicious objects spray. Container = new Array(); for (i=0; i<1000; i++) { spray. Container[i] = fullblock + shellcode; } </SCRIPT> Ben Zorn CGO 2010 Keynote 27

Nozzle – Detecting Heap Spraying • Joint work with Paruj Ratanaworabhan (Kasetsart University) and

Nozzle – Detecting Heap Spraying • Joint work with Paruj Ratanaworabhan (Kasetsart University) and Ben Livshits (Microsoft Research) • Insight: – Spraying creates many objects with malicious content – That gives the heap unique, recognizable characteristics • Approach: – Dynamically scan objects to estimate overall malicious content Ben Zorn CGO 2010 Keynote 28

Nozzle: Classifying Malicious Objects Application Threads Nozzle Threads create object Repeat benign object suspect

Nozzle: Classifying Malicious Objects Application Threads Nozzle Threads create object Repeat benign object suspect new object suspect object scan object and classify benign object suspect object benign object Application Heap Ben Zorn CGO 2010 Keynote benign object 29

Local Malicious Object Detection Is this object dangerous? Code or Data? 000000000000 000000000000 add

Local Malicious Object Detection Is this object dangerous? Code or Data? 000000000000 000000000000 add add [eax], [eax], NOP sled al al • Is this object code? – Code and data look the same on x 86 • Focus on sled detection – Majority of object is sled – Spraying scripts build simple sleds • Is this code a NOP sled? 0101010101 0101010101 and and ah, ah, [edx] [edx] shellcode – Previous techniques do not look at heap – Many heap objects look like NOP sleds – 80% false positive rates using previous techniques • Need stronger local techniques Ben Zorn CGO 2010 Keynote 30

Object Surface Area Calculation • Assume: attacker wants to reach shell code from jump

Object Surface Area Calculation • Assume: attacker wants to reach shell code from jump to any point in object • Goal: find blocks that are likely to be reached via control flow • Strategy: use dataflow analysis to compute “surface area” of each block An example object from visiting google. com Ben Zorn CGO 2010 Keynote 31

Nozzle Effectiveness Normalized Surface Area Application: Web Browser Malicious Page Normal Page Logical time

Nozzle Effectiveness Normalized Surface Area Application: Web Browser Malicious Page Normal Page Logical time (number of allocations/frees) Ben Zorn CGO 2010 Keynote 32

Nozzle Performance Ben Zorn CGO 2010 Keynote 33

Nozzle Performance Ben Zorn CGO 2010 Keynote 33

So, Performance is Dead… % All “Critical” Defects Detected How far can defect detection

So, Performance is Dead… % All “Critical” Defects Detected How far can defect detection and runtime toleration go? How much headroom is left for improvement? 100 50 0 Static analysis, verification DART, safe languages, etc. Testing automation, fuzzing, extreme Future challenges: programming… - Diminishing returns - Scaling verification Testing, code reviews - 3 rd-party library code - Performance implications 1970 1980 1990 Ben Zorn CGO 2010 Keynote 2000 2010 34

Ap ril M , 20 ay 08 Ju , 20 ne 08 , Ju

Ap ril M , 20 ay 08 Ju , 20 ne 08 , Ju 200 A l Se ug y, 2 8 pt us 00 em t, 8 2 Oc ber 008 No tob , 20 ve er 08 De mb , 20 ce er 08 m , 2 Ja ber 008 n , Fe uar 200 br y, 8 ua 20 M ry, 09 ar 20 ch 09 Ap , 20 ril 09 M , 20 ay 09 Ju , 20 ne 09 , Ju 200 A l Se ug y, 2 9 pt us 00 em t, 9 2 Oc ber 009 No tob , 20 ve er 09 De mb , 20 ce er 09 m , 2 Ja ber 009 n , Fe uar 200 br y, 9 ua 20 M ry, 10 ar 20 ch 10 , 2 01 0 What’s Happening Here? Browser Market Share Trends 100. 00% 90. 00% 80. 00% 70. 00% 60. 00% 50. 00% 40. 00% 30. 00% 20. 00% 10. 00% Can we explain this? Security? Reliability? Features? Performance! Ben Zorn CGO 2010 Keynote Other Fire. Fox IE 0. 00% Source: http: //marketshare. hitslink. com/ 35

Long Live Performance! “Safari dominates browser benchmarks” “Browser faceoff: IE vs Firefox vs Opera

Long Live Performance! “Safari dominates browser benchmarks” “Browser faceoff: IE vs Firefox vs Opera vs Safari” “Browser Wars: Ultimate Browser Benchmark…” Performance can make or break a platform http: //news. zdnet. com/2100 -9595_22 -272792. html Kai Schmerer, ZDNet Germany on May 29 th, 2008 http: //www. favbrowser. com/chrome-vs-opera-vsfirefox-vs-internet-explorer-vs-safari/ Ben Zorn CGO 2010 Keynote 36

One Word: Standard for scripting web applications Fast JITs widely available Java. Script Lots

One Word: Standard for scripting web applications Fast JITs widely available Java. Script Lots of code present in all major web sites Support in every browser Ben Zorn CGO 2010 Keynote 37

Understanding Java. Script Behavior With Paruj Ratanaworabhan and Ben Livshits Benchmarks 7 V 8

Understanding Java. Script Behavior With Paruj Ratanaworabhan and Ben Livshits Benchmarks 7 V 8 programs: 8 Sun. Spider programs: • richards • 3 -draytrace • deltablue • access-nbody • crypto • bitops-nsieve • raytrace • controlflow JSMeter Real apps Maps • earley-boyer • crypto-aes • regexp • date-xparb • splay • math-cordic • string-tagcloud Goal: Measure Java. Script in real web applications Approach: Instrument IE runtime Ben Zorn CGO 2010 Keynote 38

1500 Real apps Benchmarks Ben Zorn CGO 2010 Keynote 3 d-raytrace access-nbody bitops-nsieve controlflow

1500 Real apps Benchmarks Ben Zorn CGO 2010 Keynote 3 d-raytrace access-nbody bitops-nsieve controlflow crypto-aes date-xparb math-cordic regexp-dna string-tagcloud 2000 richards deltablue crypto raytrace earley regexp splay amazon bingmap cnn ebay economist facebook gmail googlemap hotmail Source size (kilobytes) Real Apps are Much Bigger 2500 Gmail delivers more than 2 megabytes of source code to your browser 1000 500 0 40

Real Apps have Interesting Behavior: Live Heap over Time (e. Bay) Heap contains mostly

Real Apps have Interesting Behavior: Live Heap over Time (e. Bay) Heap contains mostly functions Heaps repeatedly created, then discarded Ben Zorn CGO 2010 Keynote 41

Code|Objects|Events Real Apps have Different Architectures You stay on the same page during your

Code|Objects|Events Real Apps have Different Architectures You stay on the same page during your entire visit Code loaded once Heap is bigger Every transition loads a new page Code loaded repeatedly Heap is smaller Bing (Web 2. 0) Google (Web 1. 0) Ben Zorn CGO 2010 Keynote 42

The Next 10 Years • Reliability • “Good enough” = cheap • Energy •

The Next 10 Years • Reliability • “Good enough” = cheap • Energy • Concurrency Ben Zorn CGO 2010 Keynote 43

Reliability Threats Silicon Defects (Manufacturing defects and device wear-out) H/W and S/W Design Errors

Reliability Threats Silicon Defects (Manufacturing defects and device wear-out) H/W and S/W Design Errors (Bugs are expensive and expose security holes) Transient Faults due to Cosmic Rays & Alpha Particles (Increase exponentially with number of devices on chip) Manufacturing Defects That Escape Testing Parametric Variability (Uncertainty in device and environment) (Inefficient Burn-in Testing) Intra-die variations in ILD thickness Increased Heating Thermal Runaway Higher Power Dissipation 44 Transistor Leakage Ben Zorn CGO 2010 Keynote Slide courtesy of Todd Austin “Reliable Processor Research @ Umich”

The “Good Enough” Revolution Source: WIRED Magazine (Sep 2009) – Robert Kapps • Observation:

The “Good Enough” Revolution Source: WIRED Magazine (Sep 2009) – Robert Kapps • Observation: People prefer “cheap and good enough” over “costly and near-perfect” • Examples: Flip video cameras, Skype, etc. • Conclusion: • Engineer for imperfect result at low cost • Projects: Green (Chilimbi, MSR), Perforation (Rindard, MIT), Flicker (Pattabiraman, UBC) Ben Zorn CGO 2010 Keynote 45

Total Electricity Use (billions k. Wh/year) Energy 0. 8% of 2005 world electricity sales

Total Electricity Use (billions k. Wh/year) Energy 0. 8% of 2005 world electricity sales Coo 1. 2% of 2005 US electricity sales Cooling and auxiliary equipment US High-end servers Mid-range servers Volume servers World “Estimating Total Power Consumption by Servers in the U. S. and the World”, Jonathan G. Koomey, LBL Report, Feb. 2007 Ben Zorn CGO 2010 Keynote 46

Conclusions • Performance was and continues to be critical – Correctness and security neglected

Conclusions • Performance was and continues to be critical – Correctness and security neglected until 2000 s • What is being optimized changes – Energy usage – Concurrency – Cost effectiveness – Constrained devices • Improvements in next 10 years harder – Proebsting’s Law: Accurate? Acceptable? Ben Zorn CGO 2010 Keynote 47

Acknowledgements • CGO Organizers (especially Kim Hazelwood and David Kaeli) • Todd Austin, U.

Acknowledgements • CGO Organizers (especially Kim Hazelwood and David Kaeli) • Todd Austin, U. Michigan • Alex David, Deborah Robinson – Microsoft • Mark Horowitz, Ofer Shacham – Stanford • CJ Newburn, Shubu Mukherjee – Intel • Karthik Pattabiraman – UBC • DBLP Computer Science Bibliography – Universität Trier Ben Zorn CGO 2010 Keynote 48

Questions? Ben Zorn CGO 2010 Keynote 49

Questions? Ben Zorn CGO 2010 Keynote 49