Paradyn Project Paradyn / Dyninst Week Madison, Wisconsin May 2-4, 2011 ProcControlAPI and StackwalkerAPI Integration into Dyninst Todd Frederick and Dan.

Slides:



Advertisements
Similar presentations
Software & Services Group PinPlay: A Framework for Deterministic Replay and Reproducible Analysis of Parallel Programs Harish Patil, Cristiano Pereira,
Advertisements

University of Maryland Smarter Code Generation for Dyninst Nick Rutar.
RIVERSIDE RESEARCH INSTITUTE Helikaon Linux Debugger: A Stealthy Custom Debugger For Linux Jason Raber, Team Lead - Reverse Engineer.
Paradyn Project Paradyn / Dyninst Week College Park, Maryland March 26-28, 2012 Paradyn Project Upcoming Features in Dyninst and its Components Bill Williams.
Paradyn Project Paradyn / Dyninst Week Madison, Wisconsin May 2-3, 2011 Introduction to the PatchAPI Wenbin Fang, Drew Bernat.
OPERATING SYSTEMS Threads
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 4: Multithreaded Programming.
Threads. Objectives To introduce the notion of a thread — a fundamental unit of CPU utilization that forms the basis of multithreaded computer systems.
Threads.
Chapter 5 Threads os5.
Modified from Silberschatz, Galvin and Gagne ©2009 Lecture 7 Chapter 4: Threads (cont)
Intro to Threading CS221 – 4/20/09. What we’ll cover today Finish the DOTS program Introduction to threads and multi-threading.
Chapter 5 Processes and Threads Copyright © 2008.
Chapter 4: Threads. 4.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th edition, Jan 23, 2005 Chapter 4: Threads Overview Multithreading.
Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8 th Edition Chapter 4: Threads.
Chapter 4: Threads READ 4.1 & 4.2 NOT RESPONSIBLE FOR 4.3 &
Cortex-M3 Debugging System
14.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Chapter 4: Threads.
Introduction to the Enterprise Library. Sounds familiar? Writing a component to encapsulate data access Building a component that allows you to log errors.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 4: Threads.
Paradyn Project Dyninst/MRNet Users’ Meeting Madison, Wisconsin August 7, 2014 The Evolution of Dyninst in Support of Cyber Security Emily Gember-Jacobson.
University of Maryland parseThat: A Robust Arbitrary-Binary Tester for Dyninst Ray Chen.
Chapter 4: Threads. 4.2CSCI 380 Operating Systems Chapter 4: Threads Overview Multithreading Models Threading Issues Pthreads Windows XP Threads Linux.
Chapter 4: Threads. 4.2 Chapter 4: Threads Overview Multithreading Models Threading Issues Pthreads Windows XP Threads Linux Threads Java Threads.
Silberschatz, Galvin and Gagne ©2011Operating System Concepts Essentials – 8 th Edition Chapter 4: Threads.
University of Maryland The New Dyninst Event Model James Waskiewicz.
Support for Debugging Automatically Parallelized Programs Robert Hood Gabriele Jost CSC/MRJ Technology Solutions NASA.
Lawrence Livermore National Laboratory Matthew LeGendre LLNL-PRES Lawrence Livermore National Laboratory, P. O. Box 808, Livermore,
March 17, 2005 Roadmap of Upcoming Research, Features and Releases Bart Miller & Jeff Hollingsworth.
Andrew Bernat, Bill Williams Paradyn / Dyninst Week Madison, Wisconsin April 29-May 1, 2013 New Features in Dyninst
The Deconstruction of Dyninst: Experiences and Future Directions Drew Bernat, Madhavi Krishnan, Bill Williams, Bart Miller Paradyn Project 1.
Auther: Kevian A. Roudy and Barton P. Miller Speaker: Chun-Chih Wu Adviser: Pao, Hsing-Kuo.
Proposed Debugger Features Ken Ryall Warren Paul.
1 Threads Chapter 11 from the book: Inter-process Communications in Linux: The Nooks & Crannies by John Shapley Gray Publisher: Prentice Hall Pub Date:
Source: Operating System Concepts by Silberschatz, Galvin and Gagne.
© 2001 Barton P. MillerParadyn/Condor Week (12 March 2001, Madison/WI) The Paradyn Port Report Barton P. Miller Computer Sciences Department.
November 2005 New Features in Paradyn and Dyninst Matthew LeGendre Ray Chen
Test Specifications A Specification System for Multi-Platform Test Suite Configuration, Build, and Execution Greg Cooksey.
University of Maryland Paradyn as a Strict Dyninst Client James Waskiewicz.
Processes CS 6560: Operating Systems Design. 2 Von Neuman Model Both text (program) and data reside in memory Execution cycle Fetch instruction Decode.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 5: Threads Overview Multithreading Models Threading Issues Pthreads Solaris.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 4: Threads Modified from the slides of the text book. TY, Sept 2010.
Multithreaded Programing. Outline Overview of threads Threads Multithreaded Models  Many-to-One  One-to-One  Many-to-Many Thread Libraries  Pthread.
Chapter 4: Multithreaded Programming. 4.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts What is Thread “Thread is a part of a program.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 4: Threads.
AMD64/EM64T – Dyninst & ParadynMarch 17, 2005 The AMD64/EM64T Port of Dyninst and Paradyn Greg Quinn Ray Chen
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 4: Threads.
Lecture 3 Threads Erick Pranata © Sekolah Tinggi Teknik Surabaya 1.
Processes, Threads, and Process States. Programs and Processes  Program: an executable file (before/after compilation)  Process: an instance of a program.
Presenter : Shao-Chieh Hou 2012/8/27 Second ACM/IEEE International Symposium on Networks-on-Chip IEEE computer society.
Paradyn Project Paradyn / Dyninst Week Madison, Wisconsin April 12-14, 2010 Binary Rewriting with Dyninst Madhavi Krishnan and Dan McNulty.
Paradyn Project Paradyn / Dyninst Week Madison, Wisconsin April 12-14, 2010 Binary Concolic Execution for Automatic Exploit Generation Todd Frederick.
April 2007The Deconstruction of Dyninst: Part 1- the SymtabAPI The Deconstruction of Dyninst Part 1: The SymtabAPI Giridhar Ravipati University of Wisconsin,
Source Level Debugging of Parallel Programs Roland Wismüller LRR-TUM, TU München Germany.
Paradyn Project Paradyn / Dyninst Week Madison, Wisconsin April 29-May 1, 2013 Detecting Code Reuse Attacks Using Dyninst Components Emily Jacobson, Drew.
What is a Process ? A program in execution.
Paradyn Project Paradyn / Dyninst Week Madison, Wisconsin May 2-4, 2011 Paradyn Project Deconstruction of Dyninst: Best Practices and Lessons Learned Bill.
Introduction Ken Ryall – Nokia Warren Paul – Nokia Daymon Rogers – Freescale John Cortell - Freescale.
Contents 1.Overview 2.Multithreading Model 3.Thread Libraries 4.Threading Issues 5.Operating-system Example 2 OS Lab Sun Suk Kim.
Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8 th Edition Chapter 4: Threads.
Threads prepared and instructed by Shmuel Wimer Eng. Faculty, Bar-Ilan University 1July 2016Processes.
Introduction to Operating Systems Concepts
Computer System Structures
Current Generation Hypervisor Type 1 Type 2.
New Features in Dyninst 5.1
Chapter 5: Threads Overview Multithreading Models Threading Issues
New Features in Dyninst 6.1 and 6.2
Efficient x86 Instrumentation:
Chapter 4: Threads.
Dynamic Binary Translators and Instrumenters
Presentation transcript:

Paradyn Project Paradyn / Dyninst Week Madison, Wisconsin May 2-4, 2011 ProcControlAPI and StackwalkerAPI Integration into Dyninst Todd Frederick and Dan McNulty

AST Binary Process Stackwalker API Stackwalker API Patch API Patch API Symtab API Symtab API DataFlow API DataFlow API Instruction API Parse API Parse API Code Gen Code Gen ProcControl API Binary = Existing Component = New Component = Proposed Dyninst and the Components Stackwalker API Stackwalker API ProcControl API

Process Control and Stackwalking in Dyninst o Process control: o Modify processes’ memory during instrumentation o Capture events such as exit, fork, library load o Start and stop processes and threads o Stackwalking: o Analysis during instrumentation o Provide stackwalks to users Stackwalking needs process control to access memory and registers 3 ProcControlAPI and StackwalkerAPI Integration

ProcControlAPI and StackwalkerAPI o Already released o Who is using these components now? o Who is not using these components now? o Dyninst gains new features and stability when integrated with these components 4 ProcControlAPI and StackwalkerAPI Integration ProcControlAPI o proc++ Filesystem o StackwalkerAPI o Dyninst StackwalkerAPI o STAT o Libra o PnMPI o ATP o …and more o Dyninst

Ideal Componentization Process o New components should separate existing functionality out of Dyninst o Keeping Dyninst in mind ensures the components work together correctly 5 ProcControlAPI and StackwalkerAPI Integration Dyninst Process Control Functionality Process Control Component

Actual Componentization Process o We developed ProcControlAPI and StackwalkerAPI separately from Dyninst o Interfaces to these components do not exactly match Dyninst’s requirements 6 ProcControlAPI and StackwalkerAPI Integration Dyninst Process Control Functionality Process Control Component

Why Separate ProcControlAPI? o Clean interface to complex, notoriously buggy, OS-dependent debugger interfaces 7 ProcControlAPI and StackwalkerAPI Integration Your Code/ Stackwalker/ Dyninst ProcControlAPI Linux Debugger Interface Breakpoints Thread events FreeBSD Debugger Interface Windows Debugger Interface BlueGene Debugger Interface VxWorks Debugger Interface Read memory Stop process Low Level Commands Low Level Events System Interface

Threading inside Dyninst/ProcControlAPI 8 ProcControlAPI and StackwalkerAPI Integration o Integrating ProcControlAPI into Dyninst introduces a new threading model o Leverage threads to handle multiple inputs o User API calls o System debug interface o Internal event handling o Types of threads o Event decoders o Event handlers

Dyninst 7.0 Threading Model o 2 threads per mutatee process 9 ProcControlAPI and StackwalkerAPI Integration Mutator Process Model Target Process RT Lib Target Process RT Lib Mutatee Process Runtime Library Event Decoders Runtime Library Event Handler Event Handlers Event notifications User Thread Execute callbacks Update data structures Abstract events OS events Asynchronous events Update data structures Event notifications DyninstAPI Dyninst+ProcControlAPI

Dyninst+ProcControlAPI Threading Model o 1 event decoder, 2 event handlers 10 ProcControlAPI and StackwalkerAPI Integration Mutator Target Process RT Lib Target Process RT Lib Mutatee Process Event Decoder Event Handler Abstract events Update data structures Execute callbacks OS events Event notifications Process Model Event notifications Process Model No longer update data structures DyninstAPI ProcControlAPI User Thread Runtime Library

New functionality with ProcControlAPI o Synchronous events for mutatee thread creation and destruction o No more “Dead On Arrival” threads o Possible new DyninstAPI features o Separate kernel-level and user-level thread events o Real breakpoints and single-stepping 11 ProcControlAPI and StackwalkerAPI Integration

Target Process New Feature – Detach-on-the-fly o Useful when multiple target processes generate many events that require no Dyninst action o e.g., profiling timers generating signals o Temporarily detach from mutatee process 12 ProcControlAPI and StackwalkerAPI Integration Old Mutatee Process Mutator Process DyninstAPI Library Temporary Detach Events Re-attach Events Forward Events Events

StackwalkerAPI and Dyninst o Many tools already use StackwalkerAPI o Dyninst still uses separate, older code for walking stacks 13 ProcControlAPI and StackwalkerAPI Integration Dyninst Old Stackwalking Functionality StackwalkerAPI ATP STAT Libra PnMPI

Why Separate StackwalkerAPI? o Dyninst currently has separate stackwalking functionality for each platform o StackwalkerAPI abstracts common stackwalking patterns across platforms 14 ProcControlAPI and StackwalkerAPI Integration Stackwalking Interface Platform-Specific Support Debug Information Instrumentation Signal Handlers Frame Functions Heuristics Platform-Specific Stackwalking Frame Functions Debug Information Signal Handlers Instrumentation Heuristics

Why Separate StackwalkerAPI? o Stack frames on different architectures have different binary layouts o StackwalkerAPI Frame objects are a cross-architecture representation 15 ProcControlAPI and StackwalkerAPI Integration StackwalkerAPI Frame Return Address Frame Pointer Stack Pointer StackwalkerAPI Frame Return Address Frame Pointer Stack Pointer x86 Stack Frame Stack Pointer Frame Pointer Previous Stack Pointer Return Address Previous Frame Pointer Previous Return Address POWER Stack Frame Frame Pointer Previous Frame Pointer Return Address Previous Return Address Previous Stack Pointer

New Functionality with StackwalkerAPI o Extensible with frame steppers o Users can tell Dyninst how to walk through non- standard frames o Dyninst uses this feature to handle its own instrumentation o Binary analysis-based frame stepper o Determines how binary code creates stack frames o More robust than existing heuristics o Uses ProcControlAPI for third-party walks o Improved stability by sharing Dyninst’s view of a process 16 ProcControlAPI and StackwalkerAPI Integration

Extending StackwalkerAPI with Steppers o Frame stepper objects encapsulate the logic to walk different kinds of stack frames o Users can add new Frame teppers, as Dyninst does to walk through instrumentation 17 ProcControlAPI and StackwalkerAPI Integration main() { signal(SIGALRM, signal_handler); alarm(1); } signal_handler() { // Instrument // with foo } foo() { walkStack(); } Stack Frame foo _start __libc_start_main main __restore_rt signal_handler [Dyninst Tramp] Debug Information Stepper Signal Handler Stepper Instrumentation Stepper

Analysis-Based Stackwalking o Our analysis tracks how each instruction changes the height of the stack 18 ProcControlAPI and StackwalkerAPI Integration Analysis: Stack Heights Stack Frame Stack Pointer 0x4:-16 0x0: -8 0x4: SUB 40, RBP 0x1: MOV RSP, RBP 0x0: PUSH RBP 0x1: -16 0x8:-56 0x8:...

Analysis-Based Stackwalking o Using the stack height at an instruction, we determine how to find the next stack frame 19 ProcControlAPI and StackwalkerAPI Integration Analysis: Stack Heights Stack Frame 0x8:-56 0x1: -16 0x0: -8 0x4: SUB 40, RBP 0x1: MOV RSP, RBP 0x0: PUSH RBP 0x8:... 0x4:-16 Frame Object Stack Pointer Frame Object Stack Pointer 0x8:-56

Where we are o In-development version of Dyninst fully integrated with ProcControlAPI and StackwalkerAPI o Stable on Linux o Incomplete platform support for ProcControlAPI and StackwalkerAPI 20 ProcControlAPI and StackwalkerAPI Integration LinuxWindowsFreeBSDVxWorksBG/P ProcControlAPI StackwalkerAPI

Dyninst 8.0 o Complete support of ProcControlAPI and StackwalkerAPI on all missing platforms o Dynamic instrumentation on new platforms o BlueGene/P, FreeBSD o New features from integration effort o Detach-on-the-fly o Binary analysis-based frame stepper 21 ProcControlAPI and StackwalkerAPI Integration

Questions 22 ProcControlAPI and StackwalkerAPI Integration