22
Background Existing Memory Model New Memory Model Closing A Memory Model for Expanded LLVM Semantics in Isabelle Presented by: David Bergvelt University of Illinois Friday 6 November 2015

Bergvelt memory model presentation

Embed Size (px)

Citation preview

Page 1: Bergvelt memory model presentation

Background Existing Memory Model New Memory Model Closing

A Memory Model for Expanded LLVM Semanticsin Isabelle

Presented by: David Bergvelt

University of Illinois

Friday 6 November 2015

Page 2: Bergvelt memory model presentation

Background Existing Memory Model New Memory Model Closing

Background

Page 3: Bergvelt memory model presentation

Background Existing Memory Model New Memory Model Closing

From last time

Expand LLVM semantics in Isabelle to allow complex datastructures

getelementptr is used to index through structures

Page 4: Bergvelt memory model presentation

Background Existing Memory Model New Memory Model Closing

From last time

Expand LLVM semantics in Isabelle to allow complex datastructures

getelementptr is used to index through structures

Page 5: Bergvelt memory model presentation

Background Existing Memory Model New Memory Model Closing

getelementptr

getelementptr

Allows us to index through structures by performing addresscalculation

Pass in pointer and list of indices

Inbounds checking

Works as general memory traversal tool when inboundschecking is disabledInt to pointer, pointer to int bitcasting ”flavor”

Problem: how do we perform inbounds checks?

Page 6: Bergvelt memory model presentation

Background Existing Memory Model New Memory Model Closing

getelementptr

getelementptr

Allows us to index through structures by performing addresscalculation

Pass in pointer and list of indices

Inbounds checking

Works as general memory traversal tool when inboundschecking is disabledInt to pointer, pointer to int bitcasting ”flavor”

Problem: how do we perform inbounds checks?

Page 7: Bergvelt memory model presentation

Background Existing Memory Model New Memory Model Closing

getelementptr

getelementptr

Allows us to index through structures by performing addresscalculation

Pass in pointer and list of indices

Inbounds checking

Works as general memory traversal tool when inboundschecking is disabledInt to pointer, pointer to int bitcasting ”flavor”

Problem: how do we perform inbounds checks?

Page 8: Bergvelt memory model presentation

Background Existing Memory Model New Memory Model Closing

getelementptr

getelementptr

Allows us to index through structures by performing addresscalculation

Pass in pointer and list of indices

Inbounds checking

Works as general memory traversal tool when inboundschecking is disabled

Int to pointer, pointer to int bitcasting ”flavor”

Problem: how do we perform inbounds checks?

Page 9: Bergvelt memory model presentation

Background Existing Memory Model New Memory Model Closing

getelementptr

getelementptr

Allows us to index through structures by performing addresscalculation

Pass in pointer and list of indices

Inbounds checking

Works as general memory traversal tool when inboundschecking is disabledInt to pointer, pointer to int bitcasting ”flavor”

Problem: how do we perform inbounds checks?

Page 10: Bergvelt memory model presentation

Background Existing Memory Model New Memory Model Closing

getelementptr

getelementptr

Allows us to index through structures by performing addresscalculation

Pass in pointer and list of indices

Inbounds checking

Works as general memory traversal tool when inboundschecking is disabledInt to pointer, pointer to int bitcasting ”flavor”

Problem: how do we perform inbounds checks?

Page 11: Bergvelt memory model presentation

Background Existing Memory Model New Memory Model Closing

Existing Memory Model

Page 12: Bergvelt memory model presentation

Background Existing Memory Model New Memory Model Closing

Memory access datatype

Page 13: Bergvelt memory model presentation

Background Existing Memory Model New Memory Model Closing

Base memory model

Page 14: Bergvelt memory model presentation

Background Existing Memory Model New Memory Model Closing

New Memory Model

Page 15: Bergvelt memory model presentation

Background Existing Memory Model New Memory Model Closing

What do we need to change?

Sized memory access datatype

Raw addresses represented as ’a words

to allow for non-inbounds traversal with getelementptr

Page 16: Bergvelt memory model presentation

Background Existing Memory Model New Memory Model Closing

What do we need to change?

Sized memory access datatype

Raw addresses represented as ’a words

to allow for non-inbounds traversal with getelementptr

Page 17: Bergvelt memory model presentation

Background Existing Memory Model New Memory Model Closing

What do we need to change?

Sized memory access datatype

Raw addresses represented as ’a words

to allow for non-inbounds traversal with getelementptr

Page 18: Bergvelt memory model presentation

Background Existing Memory Model New Memory Model Closing

Implementation (Structures)

allocation::(raw_block set)

raw_block = {start::raw_address, length::(’a uword),memory::((’a word) -> value)}

raw_address::(’a word)

Page 19: Bergvelt memory model presentation

Background Existing Memory Model New Memory Model Closing

Implementation (Assumptions)

good_allocation::(allocation->bool)

good_allocation RBS = (for all rb in RBS and all rb2 in RBS,good_rb_pair rb1 rb2)

good_rb_pair::(raw_block -> raw_block->bool)

good_rb_pair rb1 rb2 = (good_block rb1) &((rb1.start = rb2.start) -> (rb1 = rb2)) &((rb1.start < rb2.start) -> (rb1.start+rb1.length <= rb2.start))

good_block::(raw_block -> bool)

good_block rb = ((rb.start + rb.length) < (max uword)) &(rb.length>=1)

Page 20: Bergvelt memory model presentation

Background Existing Memory Model New Memory Model Closing

Closing

Page 21: Bergvelt memory model presentation

Background Existing Memory Model New Memory Model Closing

Thank you!

Sources:

Concrete Semanticshttp://www.concrete-semantics.org/concrete-semantics.pdf

LLVM Language Reference Manualhttp://llvm.org/docs/LangRef.html

Page 22: Bergvelt memory model presentation

Background Existing Memory Model New Memory Model Closing

Thank you!

Sources:

Concrete Semanticshttp://www.concrete-semantics.org/concrete-semantics.pdf

LLVM Language Reference Manualhttp://llvm.org/docs/LangRef.html