+ All Categories
Home > Documents > ROSAEC Kick-off Workshop ShineVille Resort, Jeju,...

ROSAEC Kick-off Workshop ShineVille Resort, Jeju,...

Date post: 02-Jun-2020
Category:
Upload: others
View: 2 times
Download: 0 times
Share this document with a friend
39
Kyung-Goo Doh Hanyang University, Ansan PLASSE Laboratory ROSAEC Kick-off Workshop ShineVille Resort, Jeju, Nov 22, 2008 Introducing Introducing PLASSE PLASSE Laboratory Laboratory & its Current Research & its Current Research
Transcript
Page 1: ROSAEC Kick-off Workshop ShineVille Resort, Jeju, …rosaec.snu.ac.kr/meet/file/20081121e.pdfKyung-Goo Doh Hanyang University, Ansan PLASSE Laboratory ROSAEC Kick-off Workshop ShineVille

Kyung-Goo DohHanyang University, Ansan PLASSE Laboratory

ROSAEC Kick-off WorkshopShineVille Resort, Jeju, Nov 22, 2008

IntroducingIntroducing

PLASSEPLASSE LaboratoryLaboratory

& its Current Research& its Current Research

Page 2: ROSAEC Kick-off Workshop ShineVille Resort, Jeju, …rosaec.snu.ac.kr/meet/file/20081121e.pdfKyung-Goo Doh Hanyang University, Ansan PLASSE Laboratory ROSAEC Kick-off Workshop ShineVille

Hanyang University, Ansan PLASSE Laboratory

ROSAEC Kick-off WorkshopShineVille Resort, Jeju, Nov 22, 2008

Programming Languages

Application to Software

Security & Engineering

Page 3: ROSAEC Kick-off Workshop ShineVille Resort, Jeju, …rosaec.snu.ac.kr/meet/file/20081121e.pdfKyung-Goo Doh Hanyang University, Ansan PLASSE Laboratory ROSAEC Kick-off Workshop ShineVille

Hanyang University, Ansan PLASSE Laboratory

ROSAEC Kick-off WorkshopShineVille Resort, Jeju, Nov 22, 2008

Current Research Members

professor : 1

research professor : 1

Ph.D. students : 4 (-3) (+1)

M.S. students : 7 (-2) (+?)

on-campus collaborators

domestic collaborators

international collaborators

Page 4: ROSAEC Kick-off Workshop ShineVille Resort, Jeju, …rosaec.snu.ac.kr/meet/file/20081121e.pdfKyung-Goo Doh Hanyang University, Ansan PLASSE Laboratory ROSAEC Kick-off Workshop ShineVille

Hanyang University, Ansan PLASSE Laboratory

ROSAEC Kick-off WorkshopShineVille Resort, Jeju, Nov 22, 2008

Research Directions

Theoretical research

develop theory and methodology

Industrial applications

implement analysis engines and tools

transfer technology to software industry

Page 5: ROSAEC Kick-off Workshop ShineVille Resort, Jeju, …rosaec.snu.ac.kr/meet/file/20081121e.pdfKyung-Goo Doh Hanyang University, Ansan PLASSE Laboratory ROSAEC Kick-off Workshop ShineVille

Hanyang University, Ansan PLASSE Laboratory

ROSAEC Kick-off WorkshopShineVille Resort, Jeju, Nov 22, 2008

Research Theme

Semantics engineering

simple, user-friendly semantics meta-language

String analysis

syntax and semantics analysis for dynamically generated strings

Software security

static/dynamic detection of security vulnerabilities from source code

Software maintenance

extraction of software properties and metrics from source code

Page 6: ROSAEC Kick-off Workshop ShineVille Resort, Jeju, …rosaec.snu.ac.kr/meet/file/20081121e.pdfKyung-Goo Doh Hanyang University, Ansan PLASSE Laboratory ROSAEC Kick-off Workshop ShineVille

Kyung-Goo DohHanyang University, Ansan PLASSE Laboratory

ROSAEC Kick-off WorkshopShineVille Resort, Jeju, Nov 22, 2008

Abstract ParsingJoint work with Hyunha Kim & David A. Schmidt

Page 7: ROSAEC Kick-off Workshop ShineVille Resort, Jeju, …rosaec.snu.ac.kr/meet/file/20081121e.pdfKyung-Goo Doh Hanyang University, Ansan PLASSE Laboratory ROSAEC Kick-off Workshop ShineVille

Hanyang University, Ansan PLASSE Laboratory

ROSAEC Kick-off WorkshopShineVille Resort, Jeju, Nov 22, 2008

“Classic” String Analysis

on statically generated string

(scanning +) parsing

Parser parsed OK

parsing error

string

Page 8: ROSAEC Kick-off Workshop ShineVille Resort, Jeju, …rosaec.snu.ac.kr/meet/file/20081121e.pdfKyung-Goo Doh Hanyang University, Ansan PLASSE Laboratory ROSAEC Kick-off Workshop ShineVille

Hanyang University, Ansan PLASSE Laboratory

ROSAEC Kick-off WorkshopShineVille Resort, Jeju, Nov 22, 2008

Parsing

ParserLstringLparsed OK

parsing error

ParserGenerator

grammarL

Page 9: ROSAEC Kick-off Workshop ShineVille Resort, Jeju, …rosaec.snu.ac.kr/meet/file/20081121e.pdfKyung-Goo Doh Hanyang University, Ansan PLASSE Laboratory ROSAEC Kick-off Workshop ShineVille

Hanyang University, Ansan PLASSE Laboratory

ROSAEC Kick-off WorkshopShineVille Resort, Jeju, Nov 22, 2008

Dynamically Generated String

XMLParser

XMLdocument

(string)parsed

ScriptProgram

input

SQLParser

SQLquery

(string)parsed

DatabaseApplication

input

error

error

Page 10: ROSAEC Kick-off Workshop ShineVille Resort, Jeju, …rosaec.snu.ac.kr/meet/file/20081121e.pdfKyung-Goo Doh Hanyang University, Ansan PLASSE Laboratory ROSAEC Kick-off Workshop ShineVille

Hanyang University, Ansan PLASSE Laboratory

ROSAEC Kick-off WorkshopShineVille Resort, Jeju, Nov 22, 2008

Example: Database Application

This Java program parses and compiles OK.

You can check if the dynamically generated SQL query parses OK at run-time.

Question: Can we statically check if all the SQL queries generated by this program parse OK?

public void printAddresses(String id) throws SQLException {Connection con = DriverManager.getConnection(“students.db”);String q = “SELECT * FROM address”;if (id != 0) q = q + “WHERE studentid=“ + id;ResultSet rs = con.createStatement().executeQuery(q);while (rs.next()) { System.out.println.getString(“addr”)); }

taken from Christensen/Moeller/Schwartzbach’s SAS2003 paper“Precise analysis of string expression” with minor modification

Page 11: ROSAEC Kick-off Workshop ShineVille Resort, Jeju, …rosaec.snu.ac.kr/meet/file/20081121e.pdfKyung-Goo Doh Hanyang University, Ansan PLASSE Laboratory ROSAEC Kick-off Workshop ShineVille

Hanyang University, Ansan PLASSE Laboratory

ROSAEC Kick-off WorkshopShineVille Resort, Jeju, Nov 22, 2008

Previous Approach

Analysis-then-parse

StringFlow

Analysis

string-generating

program

(approximation of generated strings in)

referencecontext-free

grammar

not decidable

!

context-freegrammar

Page 12: ROSAEC Kick-off Workshop ShineVille Resort, Jeju, …rosaec.snu.ac.kr/meet/file/20081121e.pdfKyung-Goo Doh Hanyang University, Ansan PLASSE Laboratory ROSAEC Kick-off Workshop ShineVille

Hanyang University, Ansan PLASSE Laboratory

ROSAEC Kick-off WorkshopShineVille Resort, Jeju, Nov 22, 2008

Previous Approach

Analysis-then-regular_approximation-then-parse

StringFow

Analysis

string-generating

program

(approximation of generated strings in)

reference

context-freegrammar

context-freegrammar

regulargrammar

regularapproximation

loss of context

information!

Page 13: ROSAEC Kick-off Workshop ShineVille Resort, Jeju, …rosaec.snu.ac.kr/meet/file/20081121e.pdfKyung-Goo Doh Hanyang University, Ansan PLASSE Laboratory ROSAEC Kick-off Workshop ShineVille

Hanyang University, Ansan PLASSE Laboratory

ROSAEC Kick-off WorkshopShineVille Resort, Jeju, Nov 22, 2008

Example

Is the string generated at hot spot above conformed to the following reference grammar?

S →

“a” | “[” S “]”

x = “a”;while <cond> dox = “[” + x;x = x + “]”;

print x; hot spot

Page 14: ROSAEC Kick-off Workshop ShineVille Resort, Jeju, …rosaec.snu.ac.kr/meet/file/20081121e.pdfKyung-Goo Doh Hanyang University, Ansan PLASSE Laboratory ROSAEC Kick-off Workshop ShineVille

Hanyang University, Ansan PLASSE Laboratory

ROSAEC Kick-off WorkshopShineVille Resort, Jeju, Nov 22, 2008

Example: Previous String Analyzer

x = “a”;while <cond> dox = “[“ + x;x = x + “]”;

print x;

X0 →

“a”X1 →

X0 | X3X2 →

“[” X1X3 →

X2 “]”X4 →

X1

X0 →

“a”X1 →

X0 X2 | X3X3 →

“[” X3 | X2 →

“]” X2 | X4 →

X1

data-flow equations

=context-free

grammar

regularapproximations

=regular

grammar

[* a ]*

S →

“a” | “[” S “]”

Page 15: ROSAEC Kick-off Workshop ShineVille Resort, Jeju, …rosaec.snu.ac.kr/meet/file/20081121e.pdfKyung-Goo Doh Hanyang University, Ansan PLASSE Laboratory ROSAEC Kick-off Workshop ShineVille

Hanyang University, Ansan PLASSE Laboratory

ROSAEC Kick-off WorkshopShineVille Resort, Jeju, Nov 22, 2008

Abstract Parsing

Simultaneous analysis-and-parsing

statically analyze a program that dynamically generates strings, and, at the same time, parse the generated strings with the LR(k) reference grammar

Abstract parse stacks as abstract string values

encode a generated string’s context-free structure

Page 16: ROSAEC Kick-off Workshop ShineVille Resort, Jeju, …rosaec.snu.ac.kr/meet/file/20081121e.pdfKyung-Goo Doh Hanyang University, Ansan PLASSE Laboratory ROSAEC Kick-off Workshop ShineVille

Hanyang University, Ansan PLASSE Laboratory

ROSAEC Kick-off WorkshopShineVille Resort, Jeju, Nov 22, 2008

Architecture of Abstract Parsing

String-flowAnalyzer

AbstractParserdata-flow

equations

string-generatingprogram

parsing table

ParserGenerator

referencegrammar

parsedOK

parsingerror

hot spot

Our abstract parser solves data-flow equations in the domain of abstract stack.

Page 17: ROSAEC Kick-off Workshop ShineVille Resort, Jeju, …rosaec.snu.ac.kr/meet/file/20081121e.pdfKyung-Goo Doh Hanyang University, Ansan PLASSE Laboratory ROSAEC Kick-off Workshop ShineVille

Hanyang University, Ansan PLASSE Laboratory

ROSAEC Kick-off WorkshopShineVille Resort, Jeju, Nov 22, 2008

LR(0) ParsingGoto Controller for parser built from LR(0)-items for the reference grammar, S →

“a” | “[” S “]”

. S

S →

. “[” S “]”

S →

. “a”

s0 s1

s2

s3

s4s5

S →

“[” . S “]”

S →

. “[” S “]”

S →

. “a”

S →

“[” S . “]”

S →

“[” S “]” .S →

“a” .→

S .

S

S“[”

“[”

“]”“a”

“a”

Parse of input sequence, [[a]]

parse stack (top at right)s0s0 s1s0 s1 s1s0 s1 s1 s2s0 s1 s1s0 s1 s1 s3s0 s1 s1 s3 s4s0 s1s0 s1 s3s0 s1 s3 s4s0s0 s5

input sequence (front at left)[[a]] shift

[a]] shifta]] shift

]] reduce: S → “a”S]] shift

]] shift] reduce: S → “[” S “]”

S] shift] shift

reduce: S → “[” S “]”S shift

(done)

Page 18: ROSAEC Kick-off Workshop ShineVille Resort, Jeju, …rosaec.snu.ac.kr/meet/file/20081121e.pdfKyung-Goo Doh Hanyang University, Ansan PLASSE Laboratory ROSAEC Kick-off Workshop ShineVille

Hanyang University, Ansan PLASSE Laboratory

ROSAEC Kick-off WorkshopShineVille Resort, Jeju, Nov 22, 2008

Abstract Parsing: Example 1

if <cond>then x = “a“;else x = “[” + “a”print x;

X2 (s0 ) = X0 (s0 )

X1 (s0 ) =

X0 (s0 ) = goto(s0 , “a”) = s2 (reduce: S →

“a”)= goto(s0 ,S)= s5

X0 = “a”X1 = “[” · “a”X2 = X0

X1

X1 (s0 ) = (“[” · “a”)(s0 )= goto(s0 , “[”) * “a”= s1 * “a”= s1 · goto(s1 , “a”) = s1 · s2 (reduce: S

“a”)= s1 · goto(s1 , S)= s1 · s3

X2 (s0 ) = ?

. S

S →

. “[” S “]”

S →

. “a”

s0 s1

s2

s3

s4s5

S →

“[” . S “]”

S →

. “[” S “]”

S →

. “a”

S →

“[” S . “]”

S →

“[” S “]” .S →

“a” .→

S .

S

S“[”

“[”

“]”“a”

“a”

Page 19: ROSAEC Kick-off Workshop ShineVille Resort, Jeju, …rosaec.snu.ac.kr/meet/file/20081121e.pdfKyung-Goo Doh Hanyang University, Ansan PLASSE Laboratory ROSAEC Kick-off Workshop ShineVille

Hanyang University, Ansan PLASSE Laboratory

ROSAEC Kick-off WorkshopShineVille Resort, Jeju, Nov 22, 2008

X2 (s0 ) = X0 (s0 )

X1 (s0 ) = {s5 , s1 · s3 }

X0 (s0 ) = goto(s0 , “a”) = s2 (reduce: S →

“a”)= goto(s0 ,S)= s5

X1 (s0 ) = (“[” · “a”)(s0 )= goto(s0 , “[”) * “a”= s1 * “a”= s1 · goto(s1 , “a”) = s1 · s2 (reduce: S

“a”)= s1 · goto(s1 , S)= s1 · s3

if <cond>then x = “a“;else x = “[” + “a”print x;

X0 = “a”X1 = “0” · “a”X2 = X0

X1

X2 (s0 ) = ?

. S

S →

. “[” S “]”

S →

. “a”

s0 s1

s2

s3

s4s5

S →

“[” . S “]”

S →

. “[” S “]”

S →

. “a”

S →

“[” S . “]”

S →

“[” S “]” .S →

“a” .→

S .

S

S“[”

“[”

“]”“a”

“a”

Abstract Parsing: Example 1

Page 20: ROSAEC Kick-off Workshop ShineVille Resort, Jeju, …rosaec.snu.ac.kr/meet/file/20081121e.pdfKyung-Goo Doh Hanyang University, Ansan PLASSE Laboratory ROSAEC Kick-off Workshop ShineVille

Hanyang University, Ansan PLASSE Laboratory

ROSAEC Kick-off WorkshopShineVille Resort, Jeju, Nov 22, 2008

x = “”;while <cond> do

x = x + “[”x = x + “a”;print x;

X3 (s0 ) = (X1 · “a”)(s0 )= X1 (s0 ) * “a”=

X0 = X1 = X0

X2X2 = X1 · “[”X3 = X1 · “a”

X3 (s0 ) = ?

X1 (s0 ) = X0 (s0 )

X2 (s0 ) =

X0 (s0 ) = s0X2 (s0 ) = (X1 · “[”)(s0 )

= X1 (s0 ) * “[”= ㅗ

. S

S →

. “[” S “]”

S →

. “a”

s0 s1

s2

s3

s4s5

S →

“[” . S “]”

S →

. “[” S “]”

S →

. “a”

S →

“[” S . “]”

S →

“[” S “]” .S →

“a” .→

S .

S

S“[”

“[”

“]”“a”

“a”

Abstract Parsing: Example 2

Page 21: ROSAEC Kick-off Workshop ShineVille Resort, Jeju, …rosaec.snu.ac.kr/meet/file/20081121e.pdfKyung-Goo Doh Hanyang University, Ansan PLASSE Laboratory ROSAEC Kick-off Workshop ShineVille

Hanyang University, Ansan PLASSE Laboratory

ROSAEC Kick-off WorkshopShineVille Resort, Jeju, Nov 22, 2008

X3 (s0 ) = (X1 · “a”)(s0 )= X1 (s0 ) * “a”=

X1 (s0 ) = X0 (s0 )

X2 (s0 ) = {s0 }

X0 (s0 ) = s0X2 (s0 ) = (X1 · “[”)(s0 )

= X1 (s0 ) * “[”= ㅗ

. S

S →

. “[” S “]”

S →

. “a”

s0 s1

s2

s3

s4s5

S →

“[” . S “]”

S →

. “[” S “]”

S →

. “a”

S →

“[” S . “]”

S →

“[” S “]” .S →

“a” .→

S .

S

S“[”

“[”

“]”“a”

“a”

Abstract Parsing: Example 2

x = “”;while <cond> do

x = x + “[”x = x + “a”;print x;

X0 = X1 = X0

X2X2 = X1 · “[”X3 = X1 · “a”

X3 (s0 ) = ?

Page 22: ROSAEC Kick-off Workshop ShineVille Resort, Jeju, …rosaec.snu.ac.kr/meet/file/20081121e.pdfKyung-Goo Doh Hanyang University, Ansan PLASSE Laboratory ROSAEC Kick-off Workshop ShineVille

Hanyang University, Ansan PLASSE Laboratory

ROSAEC Kick-off WorkshopShineVille Resort, Jeju, Nov 22, 2008

X3 (s0 ) = (X1 · “a”)(s0 )= X1 (s0 ) * “a”=

X1 (s0 ) = X0 (s0 )

X2 (s0 ) = {s0 }

X0 (s0 ) = s0X2 (s0 ) = (X1 · “[”)(s0 )

= X1 (s0 ) * “[”= s0 * “[”= s0 · goto(s0 , “[”)= s0 · s1

. S

S →

. “[” S “]”

S →

. “a”

s0 s1

s2

s3

s4s5

S →

“[” . S “]”

S →

. “[” S “]”

S →

. “a”

S →

“[” S . “]”

S →

“[” S “]” .S →

“a” .→

S .

S

S“[”

“[”

“]”“a”

“a”

Abstract Parsing: Example 2

x = “”;while <cond> do

x = x + “[”x = x + “a”;print x;

X0 = X1 = X0

X2X2 = X1 · “[”X3 = X1 · “a”

X3 (s0 ) = ?

Page 23: ROSAEC Kick-off Workshop ShineVille Resort, Jeju, …rosaec.snu.ac.kr/meet/file/20081121e.pdfKyung-Goo Doh Hanyang University, Ansan PLASSE Laboratory ROSAEC Kick-off Workshop ShineVille

Hanyang University, Ansan PLASSE Laboratory

ROSAEC Kick-off WorkshopShineVille Resort, Jeju, Nov 22, 2008

X3 (s0 ) = (X1 · “a”)(s0 )= X1 (s0 ) * “a”=

X1 (s0 ) = X0 (s0 )

X2 (s0 ) = {s0 }

{s0 · s1 }= {s0 , s0 · s1 }

X0 (s0 ) = s0X2 (s0 ) = (X1 · “[”)(s0 )

= X1 (s0 ) * “[”= s0 * “[”= s0 · goto(s0 , “[”)= s0 · s1

. S

S →

. “[” S “]”

S →

. “a”

s0 s1

s2

s3

s4s5

S →

“[” . S “]”

S →

. “[” S “]”

S →

. “a”

S →

“[” S . “]”

S →

“[” S “]” .S →

“a” .→

S .

S

S“[”

“[”

“]”“a”

“a”

Abstract Parsing: Example 2

x = “”;while <cond> do

x = x + “[”x = x + “a”;print x;

X0 = X1 = X0

X2X2 = X1 · “[”X3 = X1 · “a”

X3 (s0 ) = ?

Page 24: ROSAEC Kick-off Workshop ShineVille Resort, Jeju, …rosaec.snu.ac.kr/meet/file/20081121e.pdfKyung-Goo Doh Hanyang University, Ansan PLASSE Laboratory ROSAEC Kick-off Workshop ShineVille

Hanyang University, Ansan PLASSE Laboratory

ROSAEC Kick-off WorkshopShineVille Resort, Jeju, Nov 22, 2008

X3 (s0 ) = (X1 · “a”)(s0 )= X1 (s0 ) * “a”=

X1 (s0 ) = X0 (s0 )

X2 (s0 ) = {s0 , s0 · s1 }

X0 (s0 ) = s0X2 (s0 ) = (X1 · “[”)(s0 )

= X1 (s0 ) * “[”= s0 · s1 * “[”= s0 · s1 · goto(s1 , “[”)= s0 · s1 · s1

. S

S →

. “[” S “]”

S →

. “a”

s0 s1

s2

s3

s4s5

S →

“[” . S “]”

S →

. “[” S “]”

S →

. “a”

S →

“[” S . “]”

S →

“[” S “]” .S →

“a” .→

S .

S

S“[”

“[”

“]”“a”

“a”

Abstract Parsing: Example 2

x = “”;while <cond> do

x = x + “[”x = x + “a”;print x;

X0 = X1 = X0

X2X2 = X1 · “[”X3 = X1 · “a”

X3 (s0 ) = ?

Page 25: ROSAEC Kick-off Workshop ShineVille Resort, Jeju, …rosaec.snu.ac.kr/meet/file/20081121e.pdfKyung-Goo Doh Hanyang University, Ansan PLASSE Laboratory ROSAEC Kick-off Workshop ShineVille

Hanyang University, Ansan PLASSE Laboratory

ROSAEC Kick-off WorkshopShineVille Resort, Jeju, Nov 22, 2008

X3 (s0 ) = (X1 · “a”)(s0 )= X1 (s0 ) * “a”=

X1 (s0 ) = X0 (s0 )

X2 (s0 ) = {s0 , s0 · s1 , s0 · s1 · s1 }

X0 (s0 ) = s0X2 (s0 ) = (X1 · “[”)(s0 )

= X1 (s0 ) * “[”= s0 · s1 * “[”= s0 · s1 · goto(s1 , “[”)= s0 · s1 · s1

. S

S →

. “[” S “]”

S →

. “a”

s0 s1

s2

s3

s4s5

S →

“[” . S “]”

S →

. “[” S “]”

S →

. “a”

S →

“[” S . “]”

S →

“[” S “]” .S →

“a” .→

S .

S

S“[”

“[”

“]”“a”

“a”

Abstract Parsing: Example 2

x = “”;while <cond> do

x = x + “[”x = x + “a”;print x;

X0 = X1 = X0

X2X2 = X1 · “[”X3 = X1 · “a”

X3 (s0 ) = ?

Page 26: ROSAEC Kick-off Workshop ShineVille Resort, Jeju, …rosaec.snu.ac.kr/meet/file/20081121e.pdfKyung-Goo Doh Hanyang University, Ansan PLASSE Laboratory ROSAEC Kick-off Workshop ShineVille

Hanyang University, Ansan PLASSE Laboratory

ROSAEC Kick-off WorkshopShineVille Resort, Jeju, Nov 22, 2008

X3 (s0 ) = (X1 · “a”)(s0 )= X1 (s0 ) * “a”=

X1 (s0 ) = X0 (s0 )

X2 (s0 ) = {s0 , s0 · s1 , s0 · s1 · s1 , …}

X0 (s0 ) = s0X2 (s0 ) = (X1 · “[”)(s0 )

= X1 (s0 ) * “[”= s0 · s1 * “[”= s0 · s1 · goto(s1 , “[”)= s0 · s1 · s1

. S

S →

. “[” S “]”

S →

. “a”

s0 s1

s2

s3

s4s5

S →

“[” . S “]”

S →

. “[” S “]”

S →

. “a”

S →

“[” S . “]”

S →

“[” S “]” .S →

“a” .→

S .

S

S“[”

“[”

“]”“a”

“a”

Abstract Parsing: Example 2

x = “”;while <cond> do

x = x + “[”x = x + “a”;print x;

X0 = X1 = X0

X2X2 = X1 · “[”X3 = X1 · “a”

X3 (s0 ) = ?

Page 27: ROSAEC Kick-off Workshop ShineVille Resort, Jeju, …rosaec.snu.ac.kr/meet/file/20081121e.pdfKyung-Goo Doh Hanyang University, Ansan PLASSE Laboratory ROSAEC Kick-off Workshop ShineVille

Hanyang University, Ansan PLASSE Laboratory

ROSAEC Kick-off WorkshopShineVille Resort, Jeju, Nov 22, 2008

X3 (s0 ) = (X1 · “a”)(s0 )= X1 (s0 ) * “a”=

X1 (s0 ) = X0 (s0 )

X2 (s0 ) = {s0 , s0 · s1+}

X0 (s0 ) = s0X2 (s0 ) = (X1 · “[”)(s0 )

= X1 (s0 ) * “[”= s0 · s1 * “[”= s0 · s1 · goto(s1 , “[”)= s0 · s1 · s1

. S

S →

. “[” S “]”

S →

. “a”

s0 s1

s2

s3

s4s5

S →

“[” . S “]”

S →

. “[” S “]”

S →

. “a”

S →

“[” S . “]”

S →

“[” S “]” .S →

“a” .→

S .

S

S“[”

“[”

“]”“a”

“a”

Abstract Parsing: Example 2

x = “”;while <cond> do

x = x + “[”x = x + “a”;print x;

X0 = X1 = X0

X2X2 = X1 · “[”X3 = X1 · “a”

X3 (s0 ) = ?

Page 28: ROSAEC Kick-off Workshop ShineVille Resort, Jeju, …rosaec.snu.ac.kr/meet/file/20081121e.pdfKyung-Goo Doh Hanyang University, Ansan PLASSE Laboratory ROSAEC Kick-off Workshop ShineVille

Hanyang University, Ansan PLASSE Laboratory

ROSAEC Kick-off WorkshopShineVille Resort, Jeju, Nov 22, 2008

X3 (s0 ) = (X1 · “a”)(s0 )= X1 (s0 ) * “a”= {s0 , s0 · s1

+} * “a”

X1 (s0 ) = X0 (s0 )

X2 (s0 ) = {s0 , s0 · s1+}

X0 (s0 ) = s0X2 (s0 ) = (X1 · “[”)(s0 )

= X1 (s0 ) * “[”= s0 · s1 * “[”= s0 · s1 · goto(s1 , “[”)= s0 · s1 · s1

. S

S →

. “[” S “]”

S →

. “a”

s0 s1

s2

s3

s4s5

S →

“[” . S “]”

S →

. “[” S “]”

S →

. “a”

S →

“[” S . “]”

S →

“[” S “]” .S →

“a” .→

S .

S

S“[”

“[”

“]”“a”

“a”

Abstract Parsing: Example 2

x = “”;while <cond> do

x = x + “[”x = x + “a”;print x;

X0 = X1 = X0

X2X2 = X1 · “[”X3 = X1 · “a”

X3 (s0 ) = ?

Page 29: ROSAEC Kick-off Workshop ShineVille Resort, Jeju, …rosaec.snu.ac.kr/meet/file/20081121e.pdfKyung-Goo Doh Hanyang University, Ansan PLASSE Laboratory ROSAEC Kick-off Workshop ShineVille

Hanyang University, Ansan PLASSE Laboratory

ROSAEC Kick-off WorkshopShineVille Resort, Jeju, Nov 22, 2008

X3 (s0 ) = (X1 · “a”)(s0 )= X1 (s0 ) * “a”= {s0 , s0 · s1

+} * “a”= {s0 * “a”, s0 · s1

+ * “a”} =

s0 * “a”= s0 · goto(s0 , “a”) = s0 · s2 [reduce: S

“a”]= s0 · goto(s0 , S)= s0 · s5

s0 · s1+ * “a”

= s0 · s1+ · goto(s1 , “a”)

= s0 · s1+ · s2 [reduce: S

“a”]= s0 · s1

+ · goto(s1 , S) = s0 · s1+ · s3

. S

S →

. “[” S “]”

S →

. “a”

s0 s1

s2

s3

s4s5

S →

“[” . S “]”

S →

. “[” S “]”

S →

. “a”

S →

“[” S . “]”

S →

“[” S “]” .S →

“a” .→

S .

S

S“[”

“[”

“]”“a”

“a”

Abstract Parsing: Example 2

x = “”;while <cond> do

x = x + “[”x = x + “a”;print x;

X0 = X1 = X0

X2X2 = X1 · “[”X3 = X1 · “a”

X3 (s0 ) = ?

Page 30: ROSAEC Kick-off Workshop ShineVille Resort, Jeju, …rosaec.snu.ac.kr/meet/file/20081121e.pdfKyung-Goo Doh Hanyang University, Ansan PLASSE Laboratory ROSAEC Kick-off Workshop ShineVille

Hanyang University, Ansan PLASSE Laboratory

ROSAEC Kick-off WorkshopShineVille Resort, Jeju, Nov 22, 2008

X3 (s0 ) = (X1 · “a”)(s0 )= X1 (s0 ) * “a”= {s0 , s0 · s1

+} * “a”= {s0 * “a”, s0 · s1

+ * “a”} = {s0 · s5 , s0 · s1+ · s3 }

s0 * “a”= s0 · goto(s0 , “a”) = s0 · s2 [reduce: S

“a”]= s0 · goto(s0 , S)= s0 · s5

s0 · s1+ * “a”

= s0 · s1+ · goto(s1 , “a”)

= s0 · s1+ · s2 [reduce: S

“a”]= s0 · s1

+ · goto(s1 , S) = s0 · s1+ · s3

. S

S →

. “[” S “]”

S →

. “a”

s0 s1

s2

s3

s4s5

S →

“[” . S “]”

S →

. “[” S “]”

S →

. “a”

S →

“[” S . “]”

S →

“[” S “]” .S →

“a” .→

S .

S

S“[”

“[”

“]”“a”

“a”

Abstract Parsing: Example 2

x = “”;while <cond> do

x = x + “[”x = x + “a”;print x;

X0 = X1 = X0

X2X2 = X1 · “[”X3 = X1 · “a”

X3 (s0 ) = ?

Page 31: ROSAEC Kick-off Workshop ShineVille Resort, Jeju, …rosaec.snu.ac.kr/meet/file/20081121e.pdfKyung-Goo Doh Hanyang University, Ansan PLASSE Laboratory ROSAEC Kick-off Workshop ShineVille

Hanyang University, Ansan PLASSE Laboratory

ROSAEC Kick-off WorkshopShineVille Resort, Jeju, Nov 22, 2008

X3 (s0 ) = X1 (s0 ) =

X1 (s0 ) = X0 (s0 )

X2 (s0 ) =

X0 (s0 ) = goto(s0 , “a”) = s2

[reduce: S →

“a”]= goto(s0 , S)= s5

X2 (s0 ) = (“[” · X1 · “]”)(s0 )= goto(s0 , “[”) * (X1 · “]”)= s1 * (X1 · “]”)= s1 · X1 (s1 ) * “]”=

. S

S →

. “[” S “]”

S →

. “a”

s0 s1

s2

s3

s4s5

S →

“[” . S “]”

S →

. “[” S “]”

S →

. “a”

S →

“[” S . “]”

S →

“[” S “]” .S →

“a” .→

S .

S

S“[”

“[”

“]”“a”

“a”

Abstract Parsing: Example 3

x = “a”;while <cond> do

x = “[” + x + “]”;print x;

X0 = “a”X1 = X0

X2X2 = “[” · X1 ·“]”X3 = X1

X3 (s0 ) = ?

Page 32: ROSAEC Kick-off Workshop ShineVille Resort, Jeju, …rosaec.snu.ac.kr/meet/file/20081121e.pdfKyung-Goo Doh Hanyang University, Ansan PLASSE Laboratory ROSAEC Kick-off Workshop ShineVille

Hanyang University, Ansan PLASSE Laboratory

ROSAEC Kick-off WorkshopShineVille Resort, Jeju, Nov 22, 2008

X2 (s1 ) = (“[” · X1 · “]”)(s1 )= goto(s1 , “[”) * (X1 · “]”)= s1 * (X1 · “]”)= s1 · X1 (s1 ) * “]”= …= s1 · s3 · s4

X1 (s1 ) = X0 (s1 )

X2 (s1 ) =

X0 (s1 ) = goto(s1 , “a”)= s2

[reduce: S →

“a”]= goto(s1 , S) = s3

. S

S →

. “[” S “]”

S →

. “a”

s0 s1

s2

s3

s4s5

S →

“[” . S “]”

S →

. “[” S “]”

S →

. “a”

S →

“[” S . “]”

S →

“[” S “]” .S →

“a” .→

S .

S

S“[”

“[”

“]”“a”

“a”

Abstract Parsing: Example 3

x = “a”;while <cond> do

x = “[” + x + “]”;print x;

X0 = “a”X1 = X0

X2X2 = “[” · X1 ·“]”X3 = X1

X3 (s0 ) = ?

Page 33: ROSAEC Kick-off Workshop ShineVille Resort, Jeju, …rosaec.snu.ac.kr/meet/file/20081121e.pdfKyung-Goo Doh Hanyang University, Ansan PLASSE Laboratory ROSAEC Kick-off Workshop ShineVille

Hanyang University, Ansan PLASSE Laboratory

ROSAEC Kick-off WorkshopShineVille Resort, Jeju, Nov 22, 2008

X2 (s1 ) = (“[” · X1 · “]”)(s1 )= goto(s1 , “[”) * (X1 · “]”)= s1 * (X1 · “]”)= s1 · X1 (s1 ) * “]”= …= s1 · s3 · s4

X1 (s1 ) = X0 (s1 )

X2 (s1 ) = {s3 , s1 · s3 · s4 }

X0 (s1 ) = goto(s1 , “a”)= s2

[reduce: S →

“a”]= goto(s1 , S) = s3

. S

S →

. “[” S “]”

S →

. “a”

s0 s1

s2

s3

s4s5

S →

“[” . S “]”

S →

. “[” S “]”

S →

. “a”

S →

“[” S . “]”

S →

“[” S “]” .S →

“a” .→

S .

S

S“[”

“[”

“]”“a”

“a”

Abstract Parsing: Example 3

x = “a”;while <cond> do

x = “[” + x + “]”;print x;

X0 = “a”X1 = X0

X2X2 = “[” · X1 ·“]”X3 = X1

X3 (s0 ) = ?

Page 34: ROSAEC Kick-off Workshop ShineVille Resort, Jeju, …rosaec.snu.ac.kr/meet/file/20081121e.pdfKyung-Goo Doh Hanyang University, Ansan PLASSE Laboratory ROSAEC Kick-off Workshop ShineVille

Hanyang University, Ansan PLASSE Laboratory

ROSAEC Kick-off WorkshopShineVille Resort, Jeju, Nov 22, 2008

X3 (s0 ) = X1 (s0 ) =

X1 (s0 ) = X0 (s0 )

X2 (s0 ) =

X0 (s0 ) = goto(s0 , “a”) = s2

[reduce: S →

“a”]= goto(s0 , S)= s5

X2 (s0 ) = (“[” · X1 · “]”)(s0 )= goto(s0 , “[”) * (X1 · “]”)= s1 * (X1 · “]”)= s1 · X1 (s1 ) * “]”= …= s1 · s3 * “]”= s1 · s3 · goto(s3 , “]”)= s1 · s3 · s4 [reduce: S

“[” S ”]”]= goto(s0, S) = s5

Abstract Parsing: Example 3

. S

S →

. “[” S “]”

S →

. “a”

s0 s1

s2

s3

s4s5

S →

“[” . S “]”

S →

. “[” S “]”

S →

. “a”

S →

“[” S . “]”

S →

“[” S “]” .S →

“a” .→

S .

S

S“[”

“[”

“]”“a”

“a”

x = “a”;while <cond> do

x = “[” + x + “]”;print x;

X0 = “a”X1 = X0

X2X2 = “[” · X1 ·“]”X3 = X1

X3 (s0 ) = ?

Page 35: ROSAEC Kick-off Workshop ShineVille Resort, Jeju, …rosaec.snu.ac.kr/meet/file/20081121e.pdfKyung-Goo Doh Hanyang University, Ansan PLASSE Laboratory ROSAEC Kick-off Workshop ShineVille

Hanyang University, Ansan PLASSE Laboratory

ROSAEC Kick-off WorkshopShineVille Resort, Jeju, Nov 22, 2008

X3 (s0 ) = X1 (s0 ) =

X1 (s0 ) = X0 (s0 )

X2 (s0 ) =

X0 (s0 ) = goto(s0 , “a”) = s2

[reduce: S →

“a”]= goto(s0 , S)= s5

X2 (s0 ) = (“[” · X1 · “]”)(s0 )= goto(s0 , “[”) * (X1 · “]”)= s1 · X1 (s1 ) * “]”= …= s1 · s1 · s3 · s4 * “]”

[reduce: S

“[” S “]”]= s1 · goto(s1 , S) * “]”= s1 · s3 * “]”= s1 · s3 · s4 = … = s5

. S

S →

. “[” S “]”

S →

. “a”

s0 s1

s2

s3

s4s5

S →

“[” . S “]”

S →

. “[” S “]”

S →

. “a”

S →

“[” S . “]”

S →

“[” S “]” .S →

“a” .→

S .

S

S“[”

“[”

“]”“a”

“a”

Abstract Parsing: Example 3

x = “a”;while <cond> do

x = “[” + x + “]”;print x;

X0 = “a”X1 = X0

X2X2 = “[” · X1 ·“]”X3 = X1

X3 (s0 ) = ?

Page 36: ROSAEC Kick-off Workshop ShineVille Resort, Jeju, …rosaec.snu.ac.kr/meet/file/20081121e.pdfKyung-Goo Doh Hanyang University, Ansan PLASSE Laboratory ROSAEC Kick-off Workshop ShineVille

Hanyang University, Ansan PLASSE Laboratory

ROSAEC Kick-off WorkshopShineVille Resort, Jeju, Nov 22, 2008

X3 (s0 ) = X1 (s0 ) = s5

X1 (s0 ) = X0 (s0 )

X2 (s0 ) = s5

X0 (s0 ) = goto(s0 , “a”) = s2

[reduce: S →

“a”]= goto(s0 , S)= s5

X2 (s0 ) = (“[” · X1 · “]”)(s0 )= goto(s0 , “[”) * (X1 · “]”)= s1 · X1 (s1 ) * “]”= …= s1 · s1 · s3 · s4 * “]”

[reduce: S

“[” S “]”]= s1 · goto(s1 , S) * “]”= s1 · s3 * “]”= s1 · s3 · s4 = … = s5

. S

S →

. “[” S “]”

S →

. “a”

s0 s1

s2

s3

s4s5

S →

“[” . S “]”

S →

. “[” S “]”

S →

. “a”

S →

“[” S . “]”

S →

“[” S “]” .S →

“a” .→

S .

S

S“[”

“[”

“]”“a”

“a”

Abstract Parsing: Example 3

x = “a”;while <cond> do

x = “[” + x + “]”;print x;

X0 = “a”X1 = X0

X2X2 = “[” · X1 ·“]”X3 = X1

X3 (s0 ) = ?

Page 37: ROSAEC Kick-off Workshop ShineVille Resort, Jeju, …rosaec.snu.ac.kr/meet/file/20081121e.pdfKyung-Goo Doh Hanyang University, Ansan PLASSE Laboratory ROSAEC Kick-off Workshop ShineVille

Hanyang University, Ansan PLASSE Laboratory

ROSAEC Kick-off WorkshopShineVille Resort, Jeju, Nov 22, 2008

Implementation

PHPString-flow

Analyzer

AbstractParserdata-flow

equations

PHPprogram

LALR(1)parsing table

ocamlyacc

referencegrammar

parsedOK

parsingerror

hot spot

Page 38: ROSAEC Kick-off Workshop ShineVille Resort, Jeju, …rosaec.snu.ac.kr/meet/file/20081121e.pdfKyung-Goo Doh Hanyang University, Ansan PLASSE Laboratory ROSAEC Kick-off Workshop ShineVille

Hanyang University, Ansan PLASSE Laboratory

ROSAEC Kick-off WorkshopShineVille Resort, Jeju, Nov 22, 2008

Conclusion

Impact

improve the precision on the syntax analysis of dynamically generated strings

enhance the entire group of work based on previous string- analysis technique.

Future work

Abstract semantic processing on parsed strings.

type checking on dynamically generated strings

static analysis on dynamically generated strings

Page 39: ROSAEC Kick-off Workshop ShineVille Resort, Jeju, …rosaec.snu.ac.kr/meet/file/20081121e.pdfKyung-Goo Doh Hanyang University, Ansan PLASSE Laboratory ROSAEC Kick-off Workshop ShineVille

Kyung-Goo DohHanyang University, Ansan PLASSE Laboratory

ROSAEC Kick-off WorkshopShineVille Resort, Jeju, Nov 22, 2008

Discussion


Recommended