making crashes reproducible by preserving object …mernst/pubs/reproduce...eclipse bug 30280: 2...

70
ReCrash Making crashes reproducible by preserving object states Shay Artzi, Sunghun Kim*, Michael D. Ernst MIT * now at HKUST

Upload: others

Post on 23-Jul-2020

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

ReCrashMaking crashes reproducible

by preserving object states

Shay Artzi, Sunghun Kim*, Michael D. Ernst

MIT * now at HKUST

Page 2: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

Eclipse bug 30280:2 days to reproduce, 4 minutes to fix

2003-01-27 08:01 User: Eclipse crashed… I have no idea why... Here is the stack trace.

2003-01-27 08:26 Developer: What build are you using? Do you have a testcase to reproduce?

2003-01-27 08:39 Developer: Which JDK are you using?

2003-01-28 13:06 User: I’m running Eclipse 2.1, …I was not able to reproduce the crash.

2003-01-29 04:33 Developer: Reproduced.

2003-01-29 04:37 Developer: Fixed.

Page 3: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

Reproducing crashes

• If a crash can’t be reproduced:

– Hard to fix

– Hard to validate a solution

• Reproducing a crash is hard!

– Nondeterminism

– Configuration and system information

– Steps to reproduce may be complex or long

– In-field detection

– Users rarely provide reproducible bug reports

Page 4: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

Approach 1: Postmortem analysis

Examples: stack trace, core dump

Problems:

• Fault (bug) may be far from failure (exception)– Faulty method may not be in stack trace

• Too much information– Core dump: big; hard to interpret

• Not enough information– Shows effects (final values), not causes

– Need initial values to reproduce the failure

Page 5: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

Approach 2: Record & replay

• Logging: record interactions with environment

• Replay: use log to reproduce the execution

• Checkpoint: replay skips part of the execution

Problems:

• Unrealistic overhead

• Invasive changes to HW/OS/application

Page 6: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

Record & replay for OO programs

• Object-oriented style uses only nearby state

– Unit testing depends on this property

• ReCrash reproduces this nearby state

– Does not replay an execution

– Static and dynamic analyses reduce the size

• Lightweight: efficient, no harness, usable in-field

• Not guaranteed to reproduce every failure

Page 7: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

ReCrash technique

Goal: Convert a crash into a set of unit tests

1. Monitoring: maintain a shadow stack– Contains a copy of each method argument

– On program crash, write the shadow stack to a file

2. Test generation: create many unit tests– For each stack frame, create one unit test:

• Invoke the method using arguments from the shadow stack

• If the test does not reproduce the crash, discard the test

Page 8: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

Maintaining the shadow stack

• On method entry:

– Push a new shadow stack frame

– Copy the actual arguments to the shadow stack

• On non-exceptional method exit:

– Pop the shadow stack frame

• On program failure (top-level exception):

– Write the shadow stack to a file

• Serializes all state referenced by the shadow stack

Page 9: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

Create one JUnit test per stack frame

public void test_resolveType() {

AllocExpr rec = (AllocExpr) shadowStack.getArg(0);

BlockScope arg = (BlockScope) shadowStack.getArg(1);

rec.resolveType(arg);

}

We expect the method to fail as it did at run time

Test case for Eclipse bug 30280

Read arguments from the saved shadow stack

Invoke the method from the stack frame

Page 10: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

Evaluating unit tests

• Run each generated unit test

• Discard the test if it does not reproduce the run-time exception

Page 11: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

How a developer uses the tests

• In a debugger, step through execution and examine fields

• Experiment by modifying the tests

• Verify a fix

• Create a regression test

– Replace deserialized objects by real objects or mock objects

– More readable and robust

Page 12: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

Why create multiple tests?

• Not all tests may reproduce the failure

– Due to state not captured on the shadow stack

• Sockets, files, nondeterminism, distant program state

• Does capture all values that are passed as arguments

• Some tests may not be useful for debugging

Page 13: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

Not every test is useful

Stack trace:NullPointerException

at Class1.toString

at Class2.myMethod

...

Tests:void test_toString() {

Class1 receiver = null;

receiver.toString();

}

void test_myMethod() {

Class2 receiver = (Class2)

shadowStack.getArg(0);

receiver.myMethod();

}

Page 14: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

Other features of ReCrash

• Non-crashing failures

– Add a ReCrash annotation

• Caught exceptions that lead to later failures

• Adding extra information to test cases

– Version number, configuration information

• Reducing the serialized stack

– Size, privacy

Page 15: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

Cost of monitoring

Key cost: copying arguments to shadow stack

Tradeoff: less information in shadow stack lower chance of reproducing failures

1. Depth of copy– Deep, reference, or a hybrid

2. Save less information about each argument– Focus on important fields

3. Monitor fewer methods– Ignore methods not likely to crash or to be useful

Page 16: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

Original program execution

Real stack

Page 17: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

Original program execution

Real stack

R: 17

Page 18: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

Original program execution

Real stack

R: 17

Page 19: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

Original program execution

Real stack

R: 18

Page 20: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

Original program execution

Real stack

R:

R:

A1:

18

Page 21: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

Original program execution

Real stack

R:

R:

A1:

R:

A1:

A2:

18

Page 22: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

1. Depth of copying

Page 23: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

Deep copy

Real stack Shadow stack

Page 24: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

Deep copy

Real stack

R: 17 R: 17

Shadow stack

Page 25: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

Deep copy

Real stack

R: 18 R: 17

Shadow stack

Page 26: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

Deep copy

Real stack

R:

R:

A1:

18 R:

R:

A1:

17

18

Shadow stack

Page 27: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

Deep copy

R:

R:

A1:

R:

A1:

A2:

18 R:

R:

A1:

R:

A1:

A2:

17

18

18

Real stack Shadow stack

Page 28: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

Deep copy

R:

R:

A1:

R:

A1:

A2:

18 R:

R:

A1:

R:

A1:

A2:

17

18

18

Real stack

Multiple copies quadratic cost

Unusable in practice

Shadow stack

Page 29: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

Reference copy

Real stack Shadow stack

Page 30: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

Reference copy

Real stack

R: 17 R:

Shadow stack

Page 31: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

Reference copy

Real stack

R: 18 R:

Shadow stack

Page 32: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

Reference copy

Real stack

R:

R:

A1:

18 R:

R:

A1:

Shadow stack

Page 33: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

Reference copy

Real stack

R:

R:

A1:

R:

A1:

A2:

18 R:

R:

A1:

R:

A1:

A2:

Shadow stack

Page 34: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

Depth-1 copy

Real stack

R:

R:

A1:

R:

A1:

A2:

18 R:

R:

A1:

R:

A1:

A2:

17

18

18

Shadow stack

Page 35: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

2. Ignoring some fields

Page 36: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

Depth-1 copy

Real stack

R:

R:

A1:

R:

A1:

A2:

18 R:

R:

A1:

R:

A1:

A2:

17

18

18

Shadow stack

Page 37: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

Used fields

Real stack

R:

R:

A1:

R:

A1:

A2:

18 R:

R:

A1:

R:

A1:

A2:

17

18

18

Shadow stack

Analysis results

Page 38: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

Depth1 + used fields(= Depth2 – unused fields)

Real stack

R:

R:

A1:

R:

A1:

A2:

18 R:

R:

A1:

R:

A1:

A2:

17

18

18

Shadow stack

Page 39: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

Pure methods

Real stack

R:

R:

A1:

R:

A1:

A2:

18 R:

R:

A1:

R:

A1:

A2:

17

18

18

Shadow stack

Analysis results

Page 40: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

Pure methods

Real stack

R:

R:

A1:

R:

A1:

A2:

18 R:

R:

A1:

A2:

17

18

A1:

R:

Shadow stack

Page 41: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

Immutable objects

Real stack

R:

R:

A1:

R:

A1:

A2:

18 R:

R:

A1:

A2:

17

18

A1:

R:

Shadow stack

Analysis results

Page 42: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

Immutable objects

Real stack

R:

R:

A1:

R:

A1:

A2:

18 R:

R:

A1:

R:

A1:

A2:

17

18

Shadow stack

Page 43: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

3. Ignoring some methods

Page 44: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

Ignored methods

Real stack

R:

R:

A1:

R:

A1:

A2:

18 R:

R:

A1:

A2:

17

R:

A1:18

Shadow stack

Analysis results

Page 45: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

Ignored methods

Real stack

R:

R:

A1:

R:

A1:

A2:

R:

R:

A1:

A2:

1718

Shadow stack

Page 46: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

Methods that are unlikely to be useful

• Trivial methods

• Private methods

• Library methods

• Methods that are unlikely to crash

Page 47: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

Second chance mode

Idea: monitor only methods that are likely to crash

• Initially, monitor no methods

• After a crash, add monitoring for methods in the stack trace

– Can update all clients, not just the one that crashed

• Tradeoffs:

+ Very low overhead (no overhead until a crash)

– Requires a failure to occur twice

Page 48: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

Experimental study

1. Can ReCrash reproduce failures?

2. Are the ReCrash-generated tests useful?

3. How large are the test cases?

4. What is the overhead of running ReCrash?

Page 49: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

Subject programs

Investigated 11 real crashes from:

– BST: .2 KLOC

– SVNKit: 22 KLOC

– Eclipse compiler: 83 KLOC

– Javac-jsr308: 86 KLOC

Page 50: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

Q1: Can ReCrash reproduce failures?Program Failure Candidate

testsReproducible tests

referencecopy

depth 1 + used-fields

deep copy

BST Class cast 3 3 3 3

Class cast 3 3 3 3

Unsupported 3 3 3 3

SVNKit Index bounds 3 3 3 3

Null pointer 2 2 2 2

Null pointer 2 2 2 2

Eclipsec Null pointer 13 0 1 8

Javac-jsr308

Null pointer 17 5 5 5

Illegal arg 23 11 11 11

Null pointer 8 1 1 1

Index bounds 28 11 11 11

Page 51: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

Q1: Can ReCrash reproduce failures?Program Failure Candidate

testsReproducible tests

referencecopy

depth 1 + used-fields

deep copy

BST Class cast 3 3 3 3

Class cast 3 3 3 3

Unsupported 3 3 3 3

SVNKit Index bounds 3 3 3 3

Null pointer 2 2 2 2

Null pointer 2 2 2 2

Eclipsec Null pointer 13 0 1 8

Javac-jsr308

Null pointer 17 5 5 5

Illegal arg 23 11 11 11

Null pointer 8 1 1 1

Index bounds 28 11 11 11

Page 52: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

Q2: Are the ReCrash tests useful?

• Developers found the tests useful

– Developer 1: “You don’t have to wait for the crash to occur again”; also liked multiple tests

– Developer 2: “Using ReCrash, I was able to jump (almost directly) to the necessary breakpoint”

• Developers found the stack trace insufficient

– Unable to reproduce

– The failure may be far removed from the fault

Page 53: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

Q3: How large are the test cases?

• The JUnit test suite uses the shadow stack

• Serializes all reachable parts of the heap

Program Average shadow stack

size (KB)

BST 12

SVNKit 34

Eclipsec 62

Javac-jsr308 422

Page 54: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

Q4: Time overhead of ReCrash

0 0.5 1 1.5 2

Eclipsec

SVNKit

Original

Reference

Depth 1 + used-fields

Second chance

Overhead of instrumented program in the field

Page 55: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

Q4: Memory overhead of ReCrash

Absolute memory overhead: .2M – 4.7 M

Page 56: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

Generating unit tests from system runs

• Test factoring [Saff 2005, Elbaum 2006]

– Developer selects a portion of the program

– System logs interactions with the environment

– Unit test replays execution in a test harness

• Contract-driven development [Leitner 2007]

– Reference copying, intended for durable tests

• Backward-in-time debuggers [Lienhard 2008]

– Heavier-weight logging and checkpoints

Page 57: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

Future work

• Capture more state

– Concurrency, timing, external resources

• Other implementation tradeoffs

– Copy-on-write

– Existing VM hooks

– Logging/debugging techniques

– These are probably orthogonal to ReCrash

Page 58: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

ReCrash converts failures into tests

• ReCrash effectively reproduces failures• Replicates program states

• Generates multiple unit tests

• The unit tests are useful

• Low overhead• Records only relevant parts of an execution

• 4 program analyses; second chance mode

• Can deploy instrumented programs in the field

• Download: http://pag.csail.mit.edu/ReCrash/

Page 59: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

ReCrash converts failures into tests

• ReCrash effectively reproduces failures• Replicates program states

• Generates multiple unit tests

• The unit tests are useful

• Low overhead• Records only relevant parts of an execution

• 4 program analyses; second chance mode

• Can deploy instrumented programs in the field

• Download: http://pag.csail.mit.edu/ReCrash/

Page 60: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have
Page 61: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have
Page 62: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

Maintaining the shadow stack

Real stack

R:

R:

A1:

18 R:

R:

A1:

17

18

Shadow stack

Page 63: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

Maintaining the shadow stack

R:

R:

A1:

R:

A1:

A2:

18 R:

R:

A1:

17

18

Real stack Shadow stack

On method entry

Page 64: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

Maintaining the shadow stack

R:

R:

A1:

R:

A1:

A2:

18 R:

R:

A1:

R:

A1:

A2:

17

18

Real stack Shadow stack

On method entry:

1. Push a new shadow stack frame

Page 65: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

Maintaining the shadow stack

R:

R:

A1:

R:

A1:

A2:

18 R:

R:

A1:

R:

A1:

A2:

17

18

18

Real stack Shadow stack

On method entry:

1. Push a new shadow stack frame

2. Copy the actual arguments to the

shadow stack

Page 66: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

Maintaining the shadow stack

R:

R:

A1:

18 R:

R:

A1:

R:

A1:

A2:

17

18

18

Real stack Shadow stack

On method exit

Page 67: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

Maintaining the shadow stack

R:

R:

A1:

18 R:

R:

A1:

17

18

Real stack Shadow stack

On method exit:

1. Pop shadow stack frame

Page 68: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

Maintaining the shadow stack

R:

R:

A1:

18 R:

R:

A1:

17

18

Real stack Shadow stack

On program failure (top-level exception):

Page 69: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

Shadow stack

Maintaining the shadow stack

R:

R:

A1:

18 R:

R:

A1:

17

18

Real stack

On program failure (top-level exception):

1. Write the shadow stack to a file

Page 70: Making crashes reproducible by preserving object …mernst/pubs/reproduce...Eclipse bug 30280: 2 days to reproduce, 4 minutes to fix 2003-01-27 08:01 User: Eclipse crashed… I have

Shadow stack

Maintaining the shadow stack

R:

R:

A1:

18 R:

R:

A1:

17

18

Real stack

On program failure (top-level exception):

1. Write the shadow stack to a file

Serializes all referenced state