Cross-‑Architecture ¡Li/er ¡Synthesis ¡ Rijnard ¡van ¡Tonder ¡and ¡Claire ¡Le ¡Goues ¡ ¡ ¡
Cross-‑Architecture ¡Li/er ¡Synthesis ¡ Rijnard ¡van ¡Tonder ¡and ¡Claire ¡Le ¡Goues ¡ ¡ ¡
What ¡is ¡a ¡Li/er? ¡ 3 ¡
What ¡is ¡a ¡Li/er? ¡ x86 ¡ ARM ¡ … ¡ Lower ¡level ¡code ¡ 4 ¡
What ¡is ¡a ¡Li/er? ¡ x86 ¡ ARM ¡ … ¡ Lower ¡level ¡code ¡ Architecture-‑speci3ic ¡ 5 ¡
What ¡is ¡a ¡Li/er? ¡ x86 ¡ Intermediate ¡ ARM ¡ Representa@on ¡ … ¡ 6 ¡
What ¡is ¡a ¡Li/er? ¡ x86 ¡ Intermediate ¡ ARM ¡ Representa@on ¡ … ¡ Higher ¡level ¡code ¡ 7 ¡
What ¡is ¡a ¡Li/er? ¡ x86 ¡ Intermediate ¡ ARM ¡ Representa@on ¡ … ¡ Higher ¡level ¡code ¡ Architecture-‑agnostic ¡ 8 ¡
Why ¡Li/ers? ¡ 9 ¡
Why ¡Li/ers? ¡ • Binary ¡analysis ¡ 10 ¡
Why ¡Li/ers? ¡ • Binary ¡analysis ¡ • Simpler ¡semantic ¡abstraction ¡ – E.g., ¡symbolic ¡execution ¡ 11 ¡
Why ¡Li/ers? ¡ • Binary ¡analysis ¡ • Simpler ¡semantic ¡abstraction ¡ – E.g., ¡symbolic ¡execution ¡ • Reuse ¡analysis ¡components ¡ – Control ¡3low ¡graph ¡construction ¡ – Single ¡Static ¡Assignment ¡(SSA) ¡conversion ¡ 12 ¡
Compilers ¡and ¡Decompilers ¡ • Compilers ¡lose ¡information ¡ – Translation ¡is ¡not ¡a ¡bijection ¡ ¡ 13 ¡
Compilers ¡and ¡Decompilers ¡ • Compilers ¡lose ¡information ¡ – Translation ¡is ¡not ¡a ¡bijection ¡ • Decompilers ¡recover ¡more ¡features ¡ – Often ¡architecture-‑speci3ic ¡(e.g., ¡ABI) ¡ 14 ¡
The ¡Problem: ¡ Transla?ng ¡Mul?ple ¡Architectures ¡ x86 ¡ Intermediate ¡ ARM ¡ Representa@on ¡ … ¡ Manual ¡ 15 ¡
The ¡Problem: ¡ Transla?ng ¡Mul?ple ¡Architectures ¡ x86 ¡ Intermediate ¡ ARM ¡ Representa@on ¡ … ¡ Manual ¡ 1000s ¡of ¡manual ¡pages ¡ 16 ¡
Our ¡Goal: ¡ Automate ¡across ¡Architectures ¡ x86 ¡ Intermediate ¡ ARM ¡ Representa@on ¡ … ¡ 17 ¡
Our ¡Goal: ¡ Automate ¡across ¡Architectures ¡ x86 ¡ [1] ¡ Intermediate ¡ ARM ¡ Representa@on ¡ … ¡ 18 ¡ [1] ¡Stra@fied ¡synthesis: ¡automa@cally ¡learning ¡the ¡x86-‑64 ¡instruc@on ¡set. ¡Heule ¡et ¡al. ¡
Our ¡Goal: ¡ Automate ¡across ¡Architectures ¡ x86 ¡ Intermediate ¡ ARM ¡ Representa@on ¡ … ¡ Cross-‑Architecture ¡reuse ¡ 19 ¡
Our ¡Goal: ¡ Automate ¡across ¡Architectures ¡ x86 ¡ Intermediate ¡ ARM ¡ Representa@on ¡ … ¡ Bug-‑3inding ¡Analyses ¡“for ¡free” ¡ 20 ¡
Our ¡Goal: ¡ Automate ¡across ¡Architectures ¡ x86 ¡ Intermediate ¡ ARM ¡ Representa@on ¡ … ¡ Data3low ¡framework ¡ Bug-‑3inding ¡Analyses ¡“for ¡free” ¡ VC ¡Generation ¡ Taint ¡analysis ¡ 21 ¡
What ¡We ¡Do ¡ 22 ¡
What ¡We ¡Do ¡ • IR ¡translation ¡as ¡a ¡Syntax-‑Guided ¡Synthesis ¡ problem ¡ 23 ¡
What ¡We ¡Do ¡ • IR ¡translation ¡as ¡a ¡Syntax-‑Guided ¡Synthesis ¡ problem ¡ ¡∀x ¡. ¡φ(x, ¡P(x)) ¡ ¡ 24 ¡
What ¡We ¡Do ¡ • IR ¡translation ¡as ¡a ¡Syntax-‑Guided ¡Synthesis ¡ problem ¡ ¡∀x ¡. ¡φ(x, ¡P(x)) ¡ ¡ ≡ ¡∀x ¡. ¡oracle(x) ¡= ¡P(x) ¡ 25 ¡
What ¡We ¡Do ¡ • IR ¡translation ¡as ¡a ¡Syntax-‑Guided ¡Synthesis ¡ problem ¡ ¡∀x ¡. ¡φ(x, ¡P(x)) ¡ ¡ ≡ ¡∀x ¡. ¡oracle(x) ¡= ¡P(x) ¡ Correctness ¡speci3ication ¡ 26 ¡
What ¡We ¡Do ¡ • IR ¡translation ¡as ¡a ¡Syntax-‑Guided ¡Synthesis ¡ problem ¡ ¡∀x ¡. ¡φ(x, ¡P(x)) ¡ ¡ ≡ ¡∀x ¡. ¡oracle(x) ¡= ¡P(x) ¡ Dynamic ¡Input/Output ¡Pairs ¡ 27 ¡
What ¡We ¡Do ¡ • IR ¡translation ¡as ¡a ¡Syntax-‑Guided ¡Synthesis ¡ problem ¡ ¡∀x ¡. ¡φ(x, ¡P(x)) ¡ ¡ ≡ ¡∀x ¡. ¡oracle(x) ¡= ¡P(x) ¡ Dynamic ¡Input/Output ¡Pairs ¡ IR ¡Sketches ¡ 28 ¡
What ¡We ¡Do ¡ • IR ¡translation ¡as ¡a ¡Syntax-‑Guided ¡Synthesis ¡ problem ¡ ¡∀x ¡. ¡φ(x, ¡P(x)) ¡ ¡ ≡ ¡∀x ¡. ¡oracle(x) ¡= ¡P(x) ¡ Key ¡Insight: ¡ Learn ¡IR ¡Sketches ¡from ¡ existing ¡Lifter ¡Productions ¡ IR ¡Sketches ¡ 29 ¡
Learning ¡Sketch ¡Templates: ¡Example ¡ 30 ¡
Learning ¡Sketch ¡Templates: ¡Example ¡ ARM ¡ add ¡R3, ¡R0 ¡ 31 ¡
Learning ¡Sketch ¡Templates: ¡Example ¡ ARM ¡ add ¡R3, ¡R0 ¡ SOURCE ¡ Na?ve ¡Instruc?on ¡ 32 ¡
Learning ¡Sketch ¡Templates: ¡Example ¡ ARM ¡ add ¡R3, ¡R0 ¡ SOURCE ¡ Na?ve ¡Instruc?on ¡ Op ¡codes ¡and ¡register ¡names ¡ 33 ¡
Learning ¡Sketch ¡Templates: ¡Example ¡ ARM ¡ LIFT ¡ add ¡R3, ¡R0 ¡ SOURCE ¡ Na?ve ¡Instruc?on ¡ Manual ¡translation ¡rules ¡ 34 ¡
Learning ¡Sketch ¡Templates: ¡Example ¡ ARM ¡ LIFT ¡ add ¡R3, ¡R0 ¡ SOURCE ¡ Na?ve ¡Instruc?on ¡ Manual ¡translation ¡rules ¡ Intel ¡x86: ¡1500-‑page ¡manual ¡ ARM: ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡1000-‑page ¡manual ¡ 35 ¡
Learning ¡Sketch ¡Templates: ¡Example ¡ ARM ¡ LIFT ¡ add ¡R3, ¡R0 ¡ R3 ¡:= ¡R3 ¡+ ¡R0 ¡ SOURCE ¡ TARGET ¡ IR ¡Instruc?on ¡ Na?ve ¡Instruc?on ¡ 36 ¡
Learning ¡Sketch ¡Templates: ¡Example ¡ ARM ¡ LIFT ¡ add ¡R3, ¡R0 ¡ R3 ¡:= ¡R3 ¡+ ¡R0 ¡ SOURCE ¡ TARGET ¡ IR ¡Instruc?on ¡ Na?ve ¡Instruc?on ¡ IR ¡with ¡operational ¡semantics ¡ 37 ¡
Learning ¡Sketch ¡Templates: ¡Example ¡ ARM ¡ LIFT ¡ add ¡R3, ¡R0 ¡ R3 ¡:= ¡R3 ¡+ ¡R0 ¡ IR ¡SKETCH ¡ _ ¡:= ¡_ ¡+ ¡_ ¡ 38 ¡
Learning ¡Sketch ¡Templates: ¡Example ¡ ARM ¡ LIFT ¡ add ¡R3, ¡R0 ¡ R3 ¡:= ¡R3 ¡+ ¡R0 ¡ IR ¡SKETCH ¡ _ ¡:= ¡_ ¡+ ¡_ ¡ Create ¡sketches ¡from ¡concrete ¡expressions ¡ 39 ¡
Learning ¡Sketch ¡Templates: ¡Example ¡ • Learn ¡templates ¡from ¡lifter ¡output ¡for ¡a ¡ supported ¡architecture ¡to ¡synthesize ¡one ¡ for ¡an ¡ unsupported ¡architecture ¡ 40 ¡
Learning ¡Sketch ¡Templates: ¡Example ¡ IR ¡ ARM ¡ LIFT ¡ add ¡R3, ¡R0 ¡ R3 ¡:= ¡R3 ¡+ ¡R0 ¡ IR ¡SKETCH ¡ _ ¡:= ¡_ ¡+ ¡_ ¡ Create ¡sketches ¡from ¡concrete ¡expressions ¡ 41 ¡
Learning ¡Sketch ¡Templates: ¡Example ¡ IR ¡ ARM ¡ LIFT ¡ add ¡R3, ¡R0 ¡ R3 ¡:= ¡R3 ¡+ ¡R0 ¡ IR ¡SKETCH ¡ _ ¡:= ¡_ ¡+ ¡_ ¡ MIPS ¡ add ¡$1, ¡$2 ¡ 42 ¡
Learning ¡Sketch ¡Templates: ¡Example ¡ IR ¡ ARM ¡ LIFT ¡ add ¡R3, ¡R0 ¡ R3 ¡:= ¡R3 ¡+ ¡R0 ¡ IR ¡SKETCH ¡ _ ¡:= ¡_ ¡+ ¡_ ¡ MIPS ¡ add ¡$1, ¡$2 ¡ Unsupported ¡ Architecture ¡ 43 ¡
Learning ¡Sketch ¡Templates: ¡Example ¡ IR ¡ ARM ¡ LIFT ¡ add ¡R3, ¡R0 ¡ R3 ¡:= ¡R3 ¡+ ¡R0 ¡ IR ¡SKETCH ¡ _ ¡:= ¡_ ¡+ ¡_ ¡ MIPS ¡ IR ¡ add ¡$1, ¡$2 ¡ $1 ¡:= ¡$1 ¡+ ¡$2 ¡ Unsupported ¡ Architecture ¡ 44 ¡
Learning ¡Sketch ¡Templates: ¡Example ¡ IR ¡SKETCH ¡ _ ¡:= ¡_ ¡+ ¡_ ¡ MIPS ¡ IR ¡ add ¡$1, ¡$2 ¡ $1 ¡:= ¡$1 ¡+ ¡$2 ¡ Unsupported ¡ Architecture ¡ 45 ¡
Learning ¡Sketch ¡Templates: ¡Example ¡ IR ¡SKETCH ¡ _ ¡:= ¡_ ¡+ ¡_ ¡ MIPS ¡ IR ¡ add ¡$1, ¡$2 ¡ $1 ¡:= ¡$1 ¡+ ¡$2 ¡ SYNTHESIS ¡ Unsupported ¡ Architecture ¡ 46 ¡
Learning ¡Sketch ¡Templates: ¡Example ¡ IR ¡SKETCH ¡ _ ¡:= ¡_ ¡+ ¡_ ¡ MIPS ¡ IR ¡ add ¡$1, ¡$2 ¡ $1 ¡:= ¡$1 ¡+ ¡$2 ¡ SYNTHESIS ¡ Unsupported ¡ I/O ¡from ¡execu@ng ¡ add ¡$1, ¡$2 ¡ Architecture ¡ 47 ¡
Learning ¡Sketch ¡Templates: ¡Example ¡ IR ¡SKETCH ¡ _ ¡:= ¡_ ¡+ ¡_ ¡ MIPS ¡ IR ¡ add ¡$1, ¡$2 ¡ $1 ¡:= ¡$1 ¡+ ¡$2 ¡ SYNTHESIS ¡ Unsupported ¡ I/O ¡from ¡execu@ng ¡ add ¡$1, ¡$2 ¡ Architecture ¡ 48 ¡
Recommend
More recommend