Don t let data Go astray

Size: px
Start display at page:

Download "Don t let data Go astray"

Transcription

1 Don t let data Go astray A Context-Sensitive Taint Analysis for Concurrent Programs in Go Volker Stolz Bergen University College, Norway & University of Oslo, Norway 28 th Nordic Workshop on Programming Theory (NWPT 16) 1 st November 2016 Supported by the bilateral Norwegian/German project GoRETech Go Runtime Enforcement Techniques & EU COST Action IC1402 ARVI Applied Runtime Verification

2 Don t let data Go astray Violet Ka I Pun Martin Steffen Volker Stolz Anna-Katharina Wickert Eric Bodden Michael Eichberg

3 Motivation Taint analysis: data flow analysis Secure information flow Prevent untrusted/sensitive data from reaching sensitive locations Examples (the usual suspects): SQL injection (user input flows unfiltered into SQL query) leaks (clear-text password ending up in log/debugging output) Volker Stolz Don t let data Go astray NWPT 16 1 / 20

4 The Go language I Backed by Google I imperative (C-programmers should be able to read it) I object-oriented (maybe... ) I concurrent (goroutines) I structurally typed I garbage collected; dynamic race checker I higher-order functions and closures Volker Stolz Don t let data Go astray NWPT 16 2 / 20

5 What are methods? procedures functions methods methods are specific functions Example: add1 / add2 not that much different from each other type Number struct { n int } func add1 (x Number, y Number) func (x Number) add2 (y Number) int { return x.n+y.n } method function with special first argument f (o, v) vs. o.f (v) elsewhere often: special keyword for first argument: this (or self) Volker Stolz Don t let data Go astray NWPT 16 3 / 20

6 Higher-order functions known from functional languages languages with higher-order functions functions as first-class data func add (x int) (func (int) int) { return func ( y int ) ( int ) { return y + x } } add : int (int int) = λx :int.λy :int.x + y Volker Stolz Don t let data Go astray NWPT 16 4 / 20

7 Deferred functions Each function/method can be called: 1 conventionally 2 deferred 3 asynchronously (see later) Also in Apple s Swift language func main () { defer fmt. Println ( 1 ) fmt. Println ( 2 ) } Deferred call (guaranteed to be) executed when the surrounding function body returns Eval d for side-effect only, returned value irrelevant Deferred calls can be nested, too Volker Stolz Don t let data Go astray NWPT 16 5 / 20

8 Concurrency in Go Go s concurrency mantra Don t communicate by sharing memory, share memory by communicating! Go concurrency goroutines + channels claimed to be easy first-class, typed channels Volker Stolz Don t let data Go astray NWPT 16 6 / 20

9 Channels named pipes FIFO, bounded, non-lossy communication crucial data type with synchronization power taking a back-seat: locks mutexes monitors semaphores... channels: first-class data channels can send (references to) channels inspired by CSP (and CCS, and, actually π) directed channels Volker Stolz Don t let data Go astray NWPT 16 7 / 20

10 Channels Simple example: synchronized channel for strings package main import fmt func main () { messages := make ( chan string, 0 ) } go func () { messages ping } () msg := messages fmt. Println (msg) Volker Stolz Don t let data Go astray NWPT 16 8 / 20

11 Back to Taint Analysis... Identifies flows of private information to untrusted places Terminology: Source (produce tainted data) Sink (consumer of data) Flow (from source to sink) Both given as user-defined sets of methods (Q: How to untaint data? Sanitizers, future work) Volker Stolz Don t let data Go astray NWPT 16 9 / 20

12 Abstract syntax Abstract syntax captures essence of Go Gory details in SSA representation in implementation s ::= x := e x.f := e if v then s else s defer((λx.s) v) go s x y x y return v s ; s e ::= v v v makechan v ::= x x.f () true false λx.s Volker Stolz Don t let data Go astray NWPT / 20

13 Lattice for Taint Analysis Simple lattice: uninitialized / untainted / tainted / both Volker Stolz Don t let data Go astray NWPT / 20

14 Standing on the Shoulders... Existing Go compiler infrastructure: SSA representation Basic blocks / call-graph Points-to analysis à la Andersen Interprocedural, context-sensitive analysis: Padhye / Khedker, SOAP@PLDI 2013 standard worklist algorithm w/ calling context & value Volker Stolz Don t let data Go astray NWPT / 20

15 Standing on the Shoulders... Existing Go compiler infrastructure: SSA representation Basic blocks / call-graph Points-to analysis à la Andersen Interprocedural, context-sensitive analysis: Padhye / Khedker, SOAP@PLDI 2013 standard worklist algorithm w/ calling context & value... or their toes? Volker Stolz Don t let data Go astray NWPT / 20

16 Our analysis example main() h(f *os.file) (c string, r int) n 1 c 1 n 3 a := Hello World b := g(a) fmt.print(b) // sink f, := os.openfile(./pw.txt ) n 4 n 5 b := make([]byte, 8) r, = f.read(b) c = string(b[:]) return c 2 s, n := h(f) n 6 fmt.print(s) for n > 0 // sink c 3 s, n = h(f) c 4 t := g(s) n 8 fmt.print(t) // sink g(a string) (b string) n 9 exit n 2 n 7 b = a return Volker Stolz Don t let data Go astray NWPT / 20

17 Our analysis example main() h(f *os.file) (c string, r int) n 1 c 1 n 3 a := Hello World b := g(a) fmt.print(b) // sink f, := os.openfile(./pw.txt ) n 4 n 5 b := make([]byte, 8) r, = f.read(b) c = string(b[:]) return c 2 s, n := h(f) n 6 c 3 fmt.print(s) for n > 0 s, n = h(f) // sink Untainted c 4 t := g(s) n 8 fmt.print(t) // sink g(a string) (b string) n 9 exit n 2 n 7 b = a return Volker Stolz Don t let data Go astray NWPT / 20

18 Our analysis example main() h(f *os.file) (c string, r int) n 1 c 1 n 3 a := Hello World b := g(a) fmt.print(b) // sink f, := os.openfile(./pw.txt ) n 4 n 5 b := make([]byte, 8) r, = f.read(b) c = string(b[:]) return c 2 n 6 c 3 s, n := h(f) fmt.print(s) for n > 0 s, n = h(f) // sink Tainted Untainted c 4 t := g(s) n 8 fmt.print(t) // sink g(a string) (b string) n 9 exit n 2 n 7 b = a return Volker Stolz Don t let data Go astray NWPT / 20

19 Channel Handling Q: Can we handle flow through channels in the same framework? n 1 x := Hello World n 2 ch := make(chan, string) c 1 go f(ch) fn 1 func f(ch chan string) n 3 sink(x) fn 2 y := ch n 4 x = tainted fn 3 sink(y) n 5 ch x n 6... Volker Stolz Don t let data Go astray NWPT / 20

20 Channel Handling Q: Can we handle flow through channels in the same framework? n 1 x := Hello World n 2 ch := make(chan, string) c 1 go f(ch) fn 1 func f(ch chan string) TA(n 5 ) ch = [ch S(x)] n 3 sink(x) fn 2 y := ch n 4 x = tainted fn 3 sink(y) n 5 ch x n 6... A: Add feedback from writes to reads Overapproximation; only feed back taint value of channel along this edge Volker Stolz Don t let data Go astray NWPT / 20

21 Our analysis Nielson-style data-flow analysis (monotone framework) Analysis info of a node = transfer function of node applied to (union over all incoming flows) TA(l) = Φ(S, N l ) where S = {TA(l ) (l, l) flow (P)} and N l nodes(p). Volker Stolz Don t let data Go astray NWPT / 20

22 Our analysis Assignments, from/to struct members, calls: Φ(S, [x := e] l ) = φ(s, x, e, l) Volker Stolz Don t let data Go astray NWPT / 20

23 Our analysis Assignments, from/to struct members, calls: Φ(S, [x := e] l ) = φ(s, x, e, l) φ(s, x, y.f, l) = S[x {TA(l ) y [y := e] l [y ch] l f.a. (l : y ) aliases(l : y)}] φ(s, x.f, y.f, l) = S[x.f {TA(l ) [y := e] l [y ch] l y f.a. (l : y ) aliases(l : y)}] φ(s, x, v 1 v 2, l) = { S[x 1] if v1 is a source S[x Φ v 1 exit ] otherwise aliases(l : u) produced by existing context-insensitive pta. tainting a struct-member taints the entire struct same for slices & built-in key/value map data structure Volker Stolz Don t let data Go astray NWPT / 20

24 Our analysis Assignments, from/to struct members, calls: Φ(S, [x := e] l ) = φ(s, x, e, l) φ(s, x, y.f, l) = S[x {TA(l ) y [y := e] l [y ch] l f.a. (l : y ) aliases(l : y)}] φ(s, x, v 1 v 2, l) = { S[x 1] if v1 is a source S[x Φ v 1 exit ] otherwise aliases(l : u) produced by existing context-insensitive pta. tainting a struct-member taints the entire struct same for slices & built-in key/value map data structure Volker Stolz Don t let data Go astray NWPT / 20

25 Channel Handling Φ(S, [x ch] l ) = S[ch S(x)] Φ(S, [x ch] l ) = S[x A] where A = {TA(l ) ch [x ch ] l } f.a. (l : ch ) aliases(l : ch) existing pta knows about channels we lose information about ordering of messages in channels (even in obvious cases) Volker Stolz Don t let data Go astray NWPT / 20

26 Sanitizers & Monitoring Taint analysis with only sources and sinks too restrictive Certain operations untaint data: SQL injections: filter out dangerous characters Password example: data flowing through hash-function sanitized Natural extension through third set of operations: sanitizers Interesting questions: Where to report tainted flow at runtime (early/late) Minimize taint-tagging at runtime Automated placement of sanitizers to repair programs (for C : Livshits, POPL 13) Volker Stolz Don t let data Go astray NWPT / 20

27 Practical Evaluation Extensive list of sources & sinks from Eric s security projects Test suite with hand-crafted examples: Runtime bounded by lattice height, calling contexts Real-world case study: well... fine-grained analysis descends into imported packages (fmt.print) case study requires domain specific properties (and by now everyone is avoiding SQL injections... ) SSA-based infrastructure requires setup that actually compiles (git clone github.com/random/goproject not enough) High-profile targets: Docker, Dropbox, Android development Volker Stolz Don t let data Go astray NWPT / 20

28 Summary: Challenge in Go Traditional data-flow analysis, for a newer language Information flow: sources to sinks (via sanitizers) mixes problems from C (structs, pointers) with problems from π-calculus (channels) combination of off-the-shelf components (SSA representation & pta from Go compiler infrastructure, vasco interprocedural analysis) 1 More research is needed on... : fine tune white-list/black-list for imports or: precompute & cache standard libraries? collect (performance) data on real-world Go code 1 E. Bodden, K. I Pun, M. Steffen, V. Stolz, A.-K. Wickert Information Flow Analysis for Go, ISoLA Volker Stolz Don t let data Go astray NWPT / 20

29 Summary: Challenge in Go Traditional data-flow analysis, for a newer language Information flow: sources to sinks (via sanitizers) mixes problems from C (structs, pointers) with problems from π-calculus (channels) combination of off-the-shelf components (SSA representation & pta from Go compiler infrastructure, vasco interprocedural analysis) 1 More research is needed on... : fine tune white-list/black-list for imports or: precompute & cache standard libraries? collect (performance) data on real-world Go code 1 E. Bodden, K. I Pun, M. Steffen, V. Stolz, A.-K. Wickert Information Flow Analysis for Go, ISoLA Volker Stolz Don t let data Go astray NWPT / 20

The Go Programming Language. Frank Roberts

The Go Programming Language. Frank Roberts The Go Programming Language Frank Roberts frank.roberts@uky.edu - C++ (1983), Java (1995), Python (1991): not modern - Java is 18 years old; how has computing changed in 10? - multi/many core - web programming

More information

Let s Go! Akim D le, Etienne Renault, Roland Levillain. June 8, TYLA Let s Go! June 8, / 58

Let s Go! Akim D le, Etienne Renault, Roland Levillain. June 8, TYLA Let s Go! June 8, / 58 Let s Go! Akim Demaille, Etienne Renault, Roland Levillain June 8, 2017 TYLA Let s Go! June 8, 2017 1 / 58 Table of contents 1 Overview 2 Language Syntax 3 Closure 4 Typed functional programming and Polymorphism

More information

New Parallel Programming Languages for Optimization Research

New Parallel Programming Languages for Optimization Research New Parallel Programming Languages for Optimization Research John W. Chinneck, Stephane Ernst Systems and Computer Engineering Carleton University, Ottawa, Canada Motivation Challenges for optimization

More information

Introduzione a Go e RPC in Go

Introduzione a Go e RPC in Go Università degli Studi di Roma Tor Vergata Dipartimento di Ingegneria Civile e Ingegneria Informatica Introduzione a Go e RPC in Go Corso di Sistemi Distribuiti e Cloud Computing A.A. 2017/18 Valeria Cardellini

More information

Go for Java Developers

Go for Java Developers Go for Java Developers Stoyan Rachev May 26-27 16, Sofia 1 Agenda Introduction Variables and Control Flow Types and Data Structures Functions Methods and Interfaces Concurrency Conclusion 2 What is Go?

More information

05-concurrency.txt Tue Sep 11 10:05: , Fall 2012, Class 05, Sept. 11, 2012 Randal E. Bryant

05-concurrency.txt Tue Sep 11 10:05: , Fall 2012, Class 05, Sept. 11, 2012 Randal E. Bryant 05-concurrency.txt Tue Sep 11 10:05:32 2012 1 15-440, Fall 2012, Class 05, Sept. 11, 2012 Randal E. Bryant All code available in: /afs/cs.cmu.edu/academic/class/15440-f12/code/class05 Managing Concurrency

More information

CS558 Programming Languages

CS558 Programming Languages CS558 Programming Languages Fall 2016 Lecture 3a Andrew Tolmach Portland State University 1994-2016 Formal Semantics Goal: rigorous and unambiguous definition in terms of a wellunderstood formalism (e.g.

More information

Go Cheat Sheet. Operators. Go in a Nutshell. Declarations. Basic Syntax. Hello World. Functions. Comparison. Arithmetic. Credits

Go Cheat Sheet. Operators. Go in a Nutshell. Declarations. Basic Syntax. Hello World. Functions. Comparison. Arithmetic. Credits Credits Go Cheat Sheet Most example code taken from A Tour of Go, which is an excellent introduction to Go. If you're new to Go, do that tour. Seriously. Original HTML Cheat Sheet by Ariel Mashraki (a8m):

More information

A Deterministic Concurrent Language for Embedded Systems

A Deterministic Concurrent Language for Embedded Systems SHIM:A A Deterministic Concurrent Language for Embedded Systems p. 1/28 A Deterministic Concurrent Language for Embedded Systems Stephen A. Edwards Columbia University Joint work with Olivier Tardieu SHIM:A

More information

The Awesomeness of Go. Igor Lankin DevFest Karlsruhe, Nov 2016

The Awesomeness of Go. Igor Lankin DevFest Karlsruhe, Nov 2016 The Awesomeness of Go Igor Lankin DevFest Karlsruhe, Nov 2016 Igor Lankin Software Developer @ inovex C#, Java, Java Script, full-time GO (waipu.tv ) 2 What is Go? 3 An Awesome Programming Language 4 Imagine

More information

What Came First? The Ordering of Events in

What Came First? The Ordering of Events in What Came First? The Ordering of Events in Systems @kavya719 kavya the design of concurrent systems Slack architecture on AWS systems with multiple independent actors. threads in a multithreaded program.

More information

Static Deadlock Detection for Go by Global Session Graph Synthesis. Nicholas Ng & Nobuko Yoshida Department of Computing Imperial College London

Static Deadlock Detection for Go by Global Session Graph Synthesis. Nicholas Ng & Nobuko Yoshida Department of Computing Imperial College London Static Deadlock Detection for Go by Global Session Graph Synthesis Nicholas Ng & Nobuko Yoshida Department of Computing Imperial College London Contributions Static deadlock detection tool dingo-hunter

More information

Go Tutorial. Arjun Roy CSE 223B, Spring 2017

Go Tutorial. Arjun Roy CSE 223B, Spring 2017 Go Tutorial Arjun Roy arroy@eng.ucsd.edu CSE 223B, Spring 2017 Administrative details TA Office Hours: EBU3B B250A, Tuesday 5-7PM TA Email: arroy@eng.ucsd.edu All labs due by 2359 PDT. Lab 1 due: 4/13/2017.

More information

Go Forth and Code. Jonathan Gertig. CSC 415: Programing Languages. Dr. Lyle

Go Forth and Code. Jonathan Gertig. CSC 415: Programing Languages. Dr. Lyle J o n a t h a n G e r t i g P a g e 1 Go Forth and Code Jonathan Gertig CSC 415: Programing Languages Dr. Lyle 2013 J o n a t h a n G e r t i g P a g e 2 Go dogs Go or A Brief History of Go 6 years ago

More information

Static Program Analysis Part 1 the TIP language

Static Program Analysis Part 1 the TIP language Static Program Analysis Part 1 the TIP language http://cs.au.dk/~amoeller/spa/ Anders Møller & Michael I. Schwartzbach Computer Science, Aarhus University Questions about programs Does the program terminate

More information

Go Tutorial. To do. A brief, gentle intro to Go. Next Networking. q Today

Go Tutorial. To do. A brief, gentle intro to Go. Next Networking. q Today Go Tutorial To do q Today A brief, gentle intro to Go q Next Networking About Go Developed by Google Webpage: https://golang.org/ Concurrency was a priority in the language design A bit of a mix between

More information

go get my/vulnerabilities Green threads are not eco friendly threads

go get my/vulnerabilities Green threads are not eco friendly threads go get my/vulnerabilities Green threads are not eco friendly threads 1 Who ( Web Mobile ) penetration tester Code reviewer Programmer Roberto Clapis @empijei 2 Go Google s language Born in 2007 (quite

More information

A Deterministic Concurrent Language for Embedded Systems

A Deterministic Concurrent Language for Embedded Systems A Deterministic Concurrent Language for Embedded Systems Stephen A. Edwards Columbia University Joint work with Olivier Tardieu SHIM:A Deterministic Concurrent Language for Embedded Systems p. 1/30 Definition

More information

Compiler Structure. Data Flow Analysis. Control-Flow Graph. Available Expressions. Data Flow Facts

Compiler Structure. Data Flow Analysis. Control-Flow Graph. Available Expressions. Data Flow Facts Compiler Structure Source Code Abstract Syntax Tree Control Flow Graph Object Code CMSC 631 Program Analysis and Understanding Fall 2003 Data Flow Analysis Source code parsed to produce AST AST transformed

More information

Concurrency in Go 9/22/17

Concurrency in Go 9/22/17 Concurrency in Go 9/22/17 Outline Mapreduce (15 mins) Two synchronization mechanisms Locks (15 mins) Channels (20 mins) Application: Word count Hello my love. I love you, my dear. Goodbye. hello: 1, my:

More information

Erlang and Go (CS262a, Berkeley Fall 2016) Philipp Moritz

Erlang and Go (CS262a, Berkeley Fall 2016) Philipp Moritz Erlang and Go (CS262a, Berkeley Fall 2016) Philipp Moritz The Problem Distributed computation is hard! State Hard to do recovery, dependency on order of execution Concurrency and Synchronization Hard to

More information

Field Analysis. Last time Exploit encapsulation to improve memory system performance

Field Analysis. Last time Exploit encapsulation to improve memory system performance Field Analysis Last time Exploit encapsulation to improve memory system performance This time Exploit encapsulation to simplify analysis Two uses of field analysis Escape analysis Object inlining April

More information

Lecture 22 Go http://xkcd.com/979/ Go developed ~2007 at Google by Robert Griesemer, Rob Pike, Ken Thompson open sourced in 2009 compiled, statically typed very fast compilation C-like syntax garbage collection

More information

developed ~2007 by Robert Griesemer, Rob Pike, Ken Thompson open source

developed ~2007 by Robert Griesemer, Rob Pike, Ken Thompson open source Go developed ~2007 by Robert Griesemer, Rob Pike, Ken Thompson open source compiled, statically typed syntax looks sort of like C garbage collection built-in concurrency no classes or type inheritance

More information

Ripple: Reflection Analysis for Android Apps in Incomplete Information Environments

Ripple: Reflection Analysis for Android Apps in Incomplete Information Environments Ripple: Reflection Analysis for Android Apps in Incomplete Information Environments Yifei Zhang, Tian Tan, Yue Li and Jingling Xue Programming Languages and Compilers Group University of New South Wales

More information

William Kennedy. Brian Ketelsen Erik St. Martin Steve Francia FOREWORD BY MANNING WITH

William Kennedy. Brian Ketelsen Erik St. Martin Steve Francia FOREWORD BY MANNING WITH SAMPLE CHAPTER William Kennedy WITH FOREWORD BY Brian Ketelsen Erik St. Martin Steve Francia MANNING Go in Action by William Kennedy with Brian Ketelsen and Erik St. Martin Chapter 2 Copyright 2015 Manning

More information

CS558 Programming Languages

CS558 Programming Languages CS558 Programming Languages Winter 2017 Lecture 4a Andrew Tolmach Portland State University 1994-2017 Semantics and Erroneous Programs Important part of language specification is distinguishing valid from

More information

Advanced Compiler Design. CSE 231 Instructor: Sorin Lerner

Advanced Compiler Design. CSE 231 Instructor: Sorin Lerner Advanced Compiler Design CSE 231 Instructor: Sorin Lerner Let s look at a compiler if ( ) { x := ; } else { y := ; } ; Parser Compiler Compiler Optimizer Code Gen Exec Let s look at a compiler Compiler

More information

Wanted: Students to participate in a user study

Wanted: Students to participate in a user study Wanted: Students to participate in a user study Requirements: Know how to use the Eclipse IDE Knowledge in Java development Knowledge of static analysis is not required, but it is a plus Time: 2-3 hours

More information

CYSE 411/AIT681 Secure Software Engineering Topic #16. Static Analysis

CYSE 411/AIT681 Secure Software Engineering Topic #16. Static Analysis CYSE 411/AIT681 Secure Software Engineering Topic #16. Static Analysis Instructor: Dr. Kun Sun 1 Static Analysis for Secure Development Introduction Static analysis: What, and why? Basic analysis Example:

More information

4/9/18. CYSE 411/AIT681 Secure Software Engineering. Static Analysis for Secure Development. Current Practice for Software Assurance

4/9/18. CYSE 411/AIT681 Secure Software Engineering. Static Analysis for Secure Development. Current Practice for Software Assurance ... register char *q; char inp[maxline]; char cmdbuf[maxline]; extern ENVELOPE BlankEnvelope; extern void help P((char *)); extern void settime P((ENVELOPE *)); extern bool enoughdiskspace P((long)); extern

More information

A Deterministic Concurrent Language for Embedded Systems

A Deterministic Concurrent Language for Embedded Systems A Deterministic Concurrent Language for Embedded Systems Stephen A. Edwards Columbia University Joint work with Olivier Tardieu SHIM:A Deterministic Concurrent Language for Embedded Systems p. 1/38 Definition

More information

Simply-Typed Lambda Calculus

Simply-Typed Lambda Calculus #1 Simply-Typed Lambda Calculus #2 Back to School What is operational semantics? When would you use contextual (small-step) semantics? What is denotational semantics? What is axiomatic semantics? What

More information

CS 5523 Operating Systems: Midterm II - reivew Instructor: Dr. Tongping Liu Department Computer Science The University of Texas at San Antonio

CS 5523 Operating Systems: Midterm II - reivew Instructor: Dr. Tongping Liu Department Computer Science The University of Texas at San Antonio CS 5523 Operating Systems: Midterm II - reivew Instructor: Dr. Tongping Liu Department Computer Science The University of Texas at San Antonio Fall 2017 1 Outline Inter-Process Communication (20) Threads

More information

C#: framework overview and in-the-small features

C#: framework overview and in-the-small features Chair of Software Engineering Carlo A. Furia, Marco Piccioni, Bertrand Meyer C#: framework overview and in-the-small features Chair of Software Engineering Carlo A. Furia, Marco Piccioni, Bertrand Meyer

More information

Detection of Bugs and Code Smells through Static Analysis of Go Source Code

Detection of Bugs and Code Smells through Static Analysis of Go Source Code Detection of Bugs and Code Smells through Static Analysis of Go Source Code Christian Bergum Bergersen Master s Thesis Autumn 2016 Detection of Bugs and Code Smells through Static Analysis of Go Source

More information

Recap: Functions as first-class values

Recap: Functions as first-class values Recap: Functions as first-class values Arguments, return values, bindings What are the benefits? Parameterized, similar functions (e.g. Testers) Creating, (Returning) Functions Iterator, Accumul, Reuse

More information

Optimizing for Bugs Fixed

Optimizing for Bugs Fixed Optimizing for Bugs Fixed The Design Principles behind the Clang Static Analyzer Anna Zaks, Manager of Program Analysis Team @ Apple What is This Talk About? LLVM/clang project Overview of the Clang Static

More information

A Gentle Introduction to Program Analysis

A Gentle Introduction to Program Analysis A Gentle Introduction to Program Analysis Işıl Dillig University of Texas, Austin January 21, 2014 Programming Languages Mentoring Workshop 1 / 24 What is Program Analysis? Very broad topic, but generally

More information

Runtime Checking for Program Verification Systems

Runtime Checking for Program Verification Systems Runtime Checking for Program Verification Systems Karen Zee, Viktor Kuncak, and Martin Rinard MIT CSAIL Tuesday, March 13, 2007 Workshop on Runtime Verification 1 Background Jahob program verification

More information

Simple Overflow. #include <stdio.h> int main(void){ unsigned int num = 0xffffffff;

Simple Overflow. #include <stdio.h> int main(void){ unsigned int num = 0xffffffff; Simple Overflow 1 #include int main(void){ unsigned int num = 0xffffffff; printf("num is %d bits long\n", sizeof(num) * 8); printf("num = 0x%x\n", num); printf("num + 1 = 0x%x\n", num + 1); }

More information

Secure Programming Lecture 15: Information Leakage

Secure Programming Lecture 15: Information Leakage Secure Programming Lecture 15: Information Leakage David Aspinall 21st March 2017 Outline Overview Language Based Security Taint tracking Information flow security by type-checking Summary Recap We have

More information

Advanced Programming Methods. Introduction in program analysis

Advanced Programming Methods. Introduction in program analysis Advanced Programming Methods Introduction in program analysis What is Program Analysis? Very broad topic, but generally speaking, automated analysis of program behavior Program analysis is about developing

More information

Static Program Analysis Part 9 pointer analysis. Anders Møller & Michael I. Schwartzbach Computer Science, Aarhus University

Static Program Analysis Part 9 pointer analysis. Anders Møller & Michael I. Schwartzbach Computer Science, Aarhus University Static Program Analysis Part 9 pointer analysis Anders Møller & Michael I. Schwartzbach Computer Science, Aarhus University Agenda Introduction to points-to analysis Andersen s analysis Steensgaards s

More information

COMP-520 GoLite Tutorial

COMP-520 GoLite Tutorial COMP-520 GoLite Tutorial Alexander Krolik Sable Lab McGill University Winter 2019 Plan Target languages Language constructs, emphasis on special cases General execution semantics Declarations Types Statements

More information

Closures. Mooly Sagiv. Michael Clarkson, Cornell CS 3110 Data Structures and Functional Programming

Closures. Mooly Sagiv. Michael Clarkson, Cornell CS 3110 Data Structures and Functional Programming Closures Mooly Sagiv Michael Clarkson, Cornell CS 3110 Data Structures and Functional Programming Summary 1. Predictive Parsing 2. Large Step Operational Semantics (Natural) 3. Small Step Operational Semantics

More information

CS3733: Operating Systems

CS3733: Operating Systems Outline CS3733: Operating Systems Topics: Synchronization, Critical Sections and Semaphores (SGG Chapter 6) Instructor: Dr. Tongping Liu 1 Memory Model of Multithreaded Programs Synchronization for coordinated

More information

GO SHORT INTERVIEW QUESTIONS EXPLAINED IN COLOR

GO SHORT INTERVIEW QUESTIONS EXPLAINED IN COLOR GO SHORT INTERVIEW QUESTIONS EXPLAINED IN COLOR REVISION 1 HAWTHORNE-PRESS.COM Go Short Interview Questions Explained in Color Published by Hawthorne-Press.com 916 Adele Street Houston, Texas 77009, USA

More information

CSE 403: Software Engineering, Fall courses.cs.washington.edu/courses/cse403/16au/ Static Analysis. Emina Torlak

CSE 403: Software Engineering, Fall courses.cs.washington.edu/courses/cse403/16au/ Static Analysis. Emina Torlak CSE 403: Software Engineering, Fall 2016 courses.cs.washington.edu/courses/cse403/16au/ Static Analysis Emina Torlak emina@cs.washington.edu Outline What is static analysis? How does it work? Free and

More information

Static Program Analysis Part 7 interprocedural analysis

Static Program Analysis Part 7 interprocedural analysis Static Program Analysis Part 7 interprocedural analysis http://cs.au.dk/~amoeller/spa/ Anders Møller & Michael I. Schwartzbach Computer Science, Aarhus University Interprocedural analysis Analyzing the

More information

Static Analysis. Current Practice (cont d) 4/9/18. If You re Worried about Security. CYSE 411/AIT681 Secure Software Engineering. What more can we do?

Static Analysis. Current Practice (cont d) 4/9/18. If You re Worried about Security. CYSE 411/AIT681 Secure Software Engineering. What more can we do? ... register char *q; char inp[maxline]; char cmdbuf[maxline]; extern ENVELOPE BlankEnvelope; extern void help P((char *)); extern void settime P((ENVELOPE *)); extern bool enoughdiskspace P((long)); extern

More information

Advances in Programming Languages

Advances in Programming Languages Advances in Programming Languages Lecture 18: Concurrency and More in Rust Ian Stark School of Informatics The University of Edinburgh Friday 24 November 2016 Semester 1 Week 10 https://blog.inf.ed.ac.uk/apl16

More information

Code Reviews. James Walden Northern Kentucky University

Code Reviews. James Walden Northern Kentucky University Code Reviews James Walden Northern Kentucky University Topics 1. Types of Reviews 2. Code Review Process 3. Checklists 4. Prioritizing Code to Review Code Reviews Inspection of source code by one or more

More information

CS558 Programming Languages

CS558 Programming Languages CS558 Programming Languages Fall 2017 Lecture 3a Andrew Tolmach Portland State University 1994-2017 Binding, Scope, Storage Part of being a high-level language is letting the programmer name things: variables

More information

CS 4120 Lecture 31 Interprocedural analysis, fixed-point algorithms 9 November 2011 Lecturer: Andrew Myers

CS 4120 Lecture 31 Interprocedural analysis, fixed-point algorithms 9 November 2011 Lecturer: Andrew Myers CS 4120 Lecture 31 Interprocedural analysis, fixed-point algorithms 9 November 2011 Lecturer: Andrew Myers These notes are not yet complete. 1 Interprocedural analysis Some analyses are not sufficiently

More information

CSCI-GA Scripting Languages

CSCI-GA Scripting Languages CSCI-GA.3033.003 Scripting Languages 12/02/2013 OCaml 1 Acknowledgement The material on these slides is based on notes provided by Dexter Kozen. 2 About OCaml A functional programming language All computation

More information

Inheritance STL. Entity Component Systems. Scene Graphs. Event Systems

Inheritance STL. Entity Component Systems. Scene Graphs. Event Systems Inheritance STL Entity Component Systems Scene Graphs Event Systems Event Systems Motivation: Decoupling events from where they are sent and where they are processed. It facilitates communication between

More information

Static Vulnerability Analysis

Static Vulnerability Analysis Static Vulnerability Analysis Static Vulnerability Detection helps in finding vulnerabilities in code that can be extracted by malicious input. There are different static analysis tools for different kinds

More information

9/21/17. Outline. Expression Evaluation and Control Flow. Arithmetic Expressions. Operators. Operators. Notation & Placement

9/21/17. Outline. Expression Evaluation and Control Flow. Arithmetic Expressions. Operators. Operators. Notation & Placement Outline Expression Evaluation and Control Flow In Text: Chapter 6 Notation Operator evaluation order Operand evaluation order Overloaded operators Type conversions Short-circuit evaluation of conditions

More information

PHP Personal Home Page PHP: Hypertext Preprocessor (Lecture 35-37)

PHP Personal Home Page PHP: Hypertext Preprocessor (Lecture 35-37) PHP Personal Home Page PHP: Hypertext Preprocessor (Lecture 35-37) A Server-side Scripting Programming Language An Introduction What is PHP? PHP stands for PHP: Hypertext Preprocessor. It is a server-side

More information

Scientific GPU computing with Go A novel approach to highly reliable CUDA HPC 1 February 2014

Scientific GPU computing with Go A novel approach to highly reliable CUDA HPC 1 February 2014 Scientific GPU computing with Go A novel approach to highly reliable CUDA HPC 1 February 2014 Arne Vansteenkiste Ghent University Real-world example (micromagnetism) DyNaMat LAB @ UGent: Microscale Magnetic

More information

Closures. Mooly Sagiv. Michael Clarkson, Cornell CS 3110 Data Structures and Functional Programming

Closures. Mooly Sagiv. Michael Clarkson, Cornell CS 3110 Data Structures and Functional Programming Closures Mooly Sagiv Michael Clarkson, Cornell CS 3110 Data Structures and Functional Programming t ::= x x. t t t Call-by-value big-step Operational Semantics terms variable v ::= values abstraction x.

More information

C++ Concurrency in Action

C++ Concurrency in Action C++ Concurrency in Action Practical Multithreading ANTHONY WILLIAMS 11 MANNING Shelter Island contents preface xv acknowledgments xvii about this booh xix about the cover illustration xxii ~1 Hello, world

More information

High Performance Computing Course Notes Shared Memory Parallel Programming

High Performance Computing Course Notes Shared Memory Parallel Programming High Performance Computing Course Notes 2009-2010 2010 Shared Memory Parallel Programming Techniques Multiprocessing User space multithreading Operating system-supported (or kernel) multithreading Distributed

More information

Securing Software Applications Using Dynamic Dataflow Analysis. OWASP June 16, The OWASP Foundation

Securing Software Applications Using Dynamic Dataflow Analysis. OWASP June 16, The OWASP Foundation Securing Software Applications Using Dynamic Dataflow Analysis Steve Cook OWASP June 16, 2010 0 Southwest Research Institute scook@swri.org (210) 522-6322 Copyright The OWASP Foundation Permission is granted

More information

Functional Programming Patterns And Their Role Instructions

Functional Programming Patterns And Their Role Instructions Functional Programming Patterns And Their Role Instructions In fact, the relabelling function is precisely the same as before! Phil Wadler's Chapter 7 of The Implementation of Functional Programming Languages.

More information

CS558 Programming Languages

CS558 Programming Languages CS558 Programming Languages Winter 2017 Lecture 7b Andrew Tolmach Portland State University 1994-2017 Values and Types We divide the universe of values according to types A type is a set of values and

More information

GO CONCURRENCY BASICS AND PATTERNS EXPLAINED IN COLOR

GO CONCURRENCY BASICS AND PATTERNS EXPLAINED IN COLOR GO CONCURRENCY BASICS AND PATTERNS EXPLAINED IN COLOR REVISION 1 HAWTHORNE-PRESS.COM Go Concurrency Basics Explained In Color Published by Hawthorne-Press.com 916 Adele Street Houston, Texas 77009, USA

More information

Multiprocessors 2007/2008

Multiprocessors 2007/2008 Multiprocessors 2007/2008 Abstractions of parallel machines Johan Lukkien 1 Overview Problem context Abstraction Operating system support Language / middleware support 2 Parallel processing Scope: several

More information

Review: Easy Piece 1

Review: Easy Piece 1 CS 537 Lecture 10 Threads Michael Swift 10/9/17 2004-2007 Ed Lazowska, Hank Levy, Andrea and Remzi Arpaci-Dussea, Michael Swift 1 Review: Easy Piece 1 Virtualization CPU Memory Context Switch Schedulers

More information

6.858 Quiz 2 Review. Android Security. Haogang Chen Nov 24, 2014

6.858 Quiz 2 Review. Android Security. Haogang Chen Nov 24, 2014 6.858 Quiz 2 Review Android Security Haogang Chen Nov 24, 2014 1 Security layers Layer Role Reference Monitor Mandatory Access Control (MAC) for RPC: enforce access control policy for shared resources

More information

func findbestfold(seq string, energyfunction func(fold)float64)) Fold {

func findbestfold(seq string, energyfunction func(fold)float64)) Fold { Carl Kignsford, 0-0, Fall 0 Loose Ends Functions as values of variables Sometimes it would be useful to pass a function as a parameter to another function. For example, suppose you were writing a protein

More information

Symbolic Computation and Common Lisp

Symbolic Computation and Common Lisp Symbolic Computation and Common Lisp Dr. Neil T. Dantam CSCI-56, Colorado School of Mines Fall 28 Dantam (Mines CSCI-56) Lisp Fall 28 / 92 Why? Symbolic Computing: Much of this course deals with processing

More information

Finding Vulnerabilities in Web Applications

Finding Vulnerabilities in Web Applications Finding Vulnerabilities in Web Applications Christopher Kruegel, Technical University Vienna Evolving Networks, Evolving Threats The past few years have witnessed a significant increase in the number of

More information

Distributed Systems. 02r. Go Programming. Paul Krzyzanowski. TA: Yuanzhen Gu. Rutgers University. Fall 2015

Distributed Systems. 02r. Go Programming. Paul Krzyzanowski. TA: Yuanzhen Gu. Rutgers University. Fall 2015 Distributed Systems 02r. Go Programming Paul Krzyzanowski TA: Yuanzhen Gu Rutgers University Fall 2015 September 15, 2015 CS 417 - Paul Krzyzanowski 1 Motivation In the current world, languages don't help

More information

DEBUGGING: DYNAMIC PROGRAM ANALYSIS

DEBUGGING: DYNAMIC PROGRAM ANALYSIS DEBUGGING: DYNAMIC PROGRAM ANALYSIS WS 2017/2018 Martina Seidl Institute for Formal Models and Verification System Invariants properties of a program must hold over the entire run: integrity of data no

More information

GO IDIOMATIC CONVENTIONS EXPLAINED IN COLOR

GO IDIOMATIC CONVENTIONS EXPLAINED IN COLOR GO IDIOMATIC CONVENTIONS EXPLAINED IN COLOR REVISION 1 HAWTHORNE-PRESS.COM Go Idiomatic Conventions Explained in Color Published by Hawthorne-Press.com 916 Adele Street Houston, Texas 77009, USA 2013-2018

More information

C and C++ Secure Coding 4-day course. Syllabus

C and C++ Secure Coding 4-day course. Syllabus C and C++ Secure Coding 4-day course Syllabus C and C++ Secure Coding 4-Day Course Course description Secure Programming is the last line of defense against attacks targeted toward our systems. This course

More information

Using the Go Programming Language in Practice

Using the Go Programming Language in Practice Using the Go Programming Language in Practice Erik Westrup & Fredrik Pettersson Department of Computer Science, Lund University Axis Communications, Sweden May 28, 2014 Supervisors: Jonas Skeppstedt

More information

Cut. it s not just for Google. Eleanor McHugh.

Cut. it s not just for Google. Eleanor McHugh. Ro u gh Cut! Go it s not just for Google Eleanor McHugh http://slides.games-with-brains.net/ compiled garbage collected imperative package main import fmt const HELLO string = hello var WORLD string =

More information

Marwan Burelle. Parallel and Concurrent Programming

Marwan Burelle.  Parallel and Concurrent Programming marwan.burelle@lse.epita.fr http://wiki-prog.infoprepa.epita.fr Outline 1 2 3 OpenMP Tell Me More (Go, OpenCL,... ) Overview 1 Sharing Data First, always try to apply the following mantra: Don t share

More information

Marwan Burelle. Parallel and Concurrent Programming

Marwan Burelle.   Parallel and Concurrent Programming marwan.burelle@lse.epita.fr http://wiki-prog.infoprepa.epita.fr Outline 1 2 Solutions Overview 1 Sharing Data First, always try to apply the following mantra: Don t share data! When non-scalar data are

More information

Homework I - Solution

Homework I - Solution CS 426 Fall 2017 1 Homework I - Solution Homework I - Solution CS 426 Compiler Construction Fall Semester 2017 1. (50 points) Intermediate representations: (a) (25 points) Construct a Control-Flow Graph

More information

QUIZ on Ch.5. Why is it sometimes not a good idea to place the private part of the interface in a header file?

QUIZ on Ch.5. Why is it sometimes not a good idea to place the private part of the interface in a header file? QUIZ on Ch.5 Why is it sometimes not a good idea to place the private part of the interface in a header file? Example projects where we don t want the implementation visible to the client programmer: The

More information

Jython. An introduction by Thinh Le

Jython. An introduction by Thinh Le Jython An introduction by Thinh Le precursor_python! Google App Engine! Dropbox! PyGTK (Gnome)! Vim (embedded)! BitTorrent/Morpheus! Civilization/Battlefield Jython! Interpretation of Python (1997)! Jim

More information

Using Positive Tainting and Syntax-Aware Evaluation to Counter SQL Injection Attacks

Using Positive Tainting and Syntax-Aware Evaluation to Counter SQL Injection Attacks Using Positive Tainting and Syntax-Aware Evaluation to Counter SQL Injection Attacks Alex Orso with William Halfond and Pete Manolios Georgia Institute of Technology {orso whalfond manolios}@cc.gatech.edu

More information

MOC 6232A: Implementing a Microsoft SQL Server 2008 Database

MOC 6232A: Implementing a Microsoft SQL Server 2008 Database MOC 6232A: Implementing a Microsoft SQL Server 2008 Database Course Number: 6232A Course Length: 5 Days Course Overview This course provides students with the knowledge and skills to implement a Microsoft

More information

A Fast Review of C Essentials Part I

A Fast Review of C Essentials Part I A Fast Review of C Essentials Part I Structural Programming by Z. Cihan TAYSI Outline Program development C Essentials Functions Variables & constants Names Formatting Comments Preprocessor Data types

More information

Binghamton University. CS-211 Fall Syntax. What the Compiler needs to understand your program

Binghamton University. CS-211 Fall Syntax. What the Compiler needs to understand your program Syntax What the Compiler needs to understand your program 1 Pre-Processing Any line that starts with # is a pre-processor directive Pre-processor consumes that entire line Possibly replacing it with other

More information

ECE 650 Systems Programming & Engineering. Spring 2018

ECE 650 Systems Programming & Engineering. Spring 2018 ECE 650 Systems Programming & Engineering Spring 2018 PostgreSQL Database and C++ Interface Tyler Bletsch Duke University Slides are adapted from Brian Rogers (Duke) Also called Postgres Open source relational

More information

COMP520 - GoLite Type Checking Specification

COMP520 - GoLite Type Checking Specification COMP520 - GoLite Type Checking Specification Vincent Foley February 26, 2015 1 Declarations Declarations are the primary means of introducing new identifiers in the symbol table. In Go, top-level declarations

More information

Chapter 6: Process Synchronization

Chapter 6: Process Synchronization Chapter 6: Process Synchronization Objectives Introduce Concept of Critical-Section Problem Hardware and Software Solutions of Critical-Section Problem Concept of Atomic Transaction Operating Systems CS

More information

Static Conflict Analysis for Multi-Threaded Object Oriented Programs

Static Conflict Analysis for Multi-Threaded Object Oriented Programs Static Conflict Analysis for Multi-Threaded Object Oriented Programs Christoph von Praun and Thomas Gross Presented by Andrew Tjang Authors Von Praun Recent PhD Currently at IBM (yorktown( heights) Compilers

More information

Pointer Analysis in the Presence of Dynamic Class Loading. Hind Presented by Brian Russell

Pointer Analysis in the Presence of Dynamic Class Loading. Hind Presented by Brian Russell Pointer Analysis in the Presence of Dynamic Class Loading Martin Hirzel, Amer Diwan and Michael Hind Presented by Brian Russell Claim: First nontrivial pointer analysis dealing with all Java language features

More information

Short Notes of CS201

Short Notes of CS201 #includes: Short Notes of CS201 The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with < and > if the file is a system

More information

CSE 413 Languages & Implementation. Hal Perkins Winter 2019 Structs, Implementing Languages (credits: Dan Grossman, CSE 341)

CSE 413 Languages & Implementation. Hal Perkins Winter 2019 Structs, Implementing Languages (credits: Dan Grossman, CSE 341) CSE 413 Languages & Implementation Hal Perkins Winter 2019 Structs, Implementing Languages (credits: Dan Grossman, CSE 341) 1 Goals Representing programs as data Racket structs as a better way to represent

More information

Advanced Compiler Design. CSE 231 Instructor: Sorin Lerner

Advanced Compiler Design. CSE 231 Instructor: Sorin Lerner Advanced Compiler Design CSE 231 Instructor: Sorin Lerner Let s look at a compiler if ( ) { x := ; } else { y := ; } ; Parser Compiler Compiler Optimizer Code Gen Exec Let s look at a compiler Compiler

More information

EI 338: Computer Systems Engineering (Operating Systems & Computer Architecture)

EI 338: Computer Systems Engineering (Operating Systems & Computer Architecture) EI 338: Computer Systems Engineering (Operating Systems & Computer Architecture) Dept. of Computer Science & Engineering Chentao Wu wuct@cs.sjtu.edu.cn Download lectures ftp://public.sjtu.edu.cn User:

More information

CSE 451 Midterm 1. Name:

CSE 451 Midterm 1. Name: CSE 451 Midterm 1 Name: 1. [2 points] Imagine that a new CPU were built that contained multiple, complete sets of registers each set contains a PC plus all the other registers available to user programs.

More information

CS 376b Computer Vision

CS 376b Computer Vision CS 376b Computer Vision 09 / 25 / 2014 Instructor: Michael Eckmann Today s Topics Questions? / Comments? Enhancing images / masks Cross correlation Convolution C++ Cross-correlation Cross-correlation involves

More information