AMD64/EM64T – Dyninst & ParadynMarch 17, 2005 The AMD64/EM64T Port of Dyninst and Paradyn Greg Quinn Ray Chen

Slides:



Advertisements
Similar presentations
University of Washington Procedures and Stacks II The Hardware/Software Interface CSE351 Winter 2013.
Advertisements

Introduction to Machine/Assembler Language Noah Mendelsohn Tufts University Web:
4/14/20151 Operating Systems Design (CS 423) Elsa L Gunter 2112 SC, UIUC Based on slides by Roy Campbell, Sam King,
Machine/Assembler Language Putting It All Together Noah Mendelsohn Tufts University Web:
COMP 2003: Assembly Language and Digital Logic
%rax %eax %rbx %ebx %rdx %edx %rcx %ecx %rsi %esi %rdi %edi %rbp %ebp %rsp %esp %r8 %r8d %r9 %r9d %r11 %r11d %r10 %r10d %r12 %r12d %r13 %r13d.
Paradyn Project Paradyn / Dyninst Week Madison, Wisconsin May 2-4, 2011 ProcControlAPI and StackwalkerAPI Integration into Dyninst Todd Frederick and Dan.
Assembly Code Verification Using Model Checking Hao XIAO Singapore University of Technology and Design.
Lecture 11 – Code Generation Eran Yahav 1 Reference: Dragon 8. MCD
1 Function Calls Professor Jennifer Rexford COS 217 Reading: Chapter 4 of “Programming From the Ground Up” (available online from the course Web site)
Accessing parameters from the stack and calling functions.
Assembly תרגול 8 פונקציות והתקפת buffer.. Procedures (Functions) A procedure call involves passing both data and control from one part of the code to.
Fast, Effective Code Generation in a Just-In-Time Java Compiler Rejin P. James & Roshan C. Subudhi CSE Department USC, Columbia.
University of Maryland parseThat: A Robust Arbitrary-Binary Tester for Dyninst Ray Chen.
Dr. José M. Reyes Álamo 1.  The 80x86 memory addressing modes provide flexible access to memory, allowing you to easily access ◦ Variables ◦ Arrays ◦
Computer architecture Lecture 6: Processor’s structure Piotr Bilski.
64-Bit Architectures Topics 64-bit data New registers and instructions Calling conventions CS 105 “Tour of the Black Holes of Computing!”
Code Generation Gülfem Savrun Yeniçeri CS 142 (b) 02/26/2013.
March 17, 2005 Roadmap of Upcoming Research, Features and Releases Bart Miller & Jeff Hollingsworth.
Machine/Assembler Language Control Flow & Compiling Function Calls Noah Mendelsohn Tufts University Web:
INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMING
The ISA Level The Instruction Set Architecture (ISA) is positioned between the microarchtecture level and the operating system level.  Historically, this.
Machine-Level Programming: X86-64 Topics Registers Stack Function Calls Local Storage X86-64.ppt CS 105 Tour of Black Holes of Computing.
Derived from "x86 Assembly Registers and the Stack" by Rodney BeedeRodney Beede x86 Assembly Registers and the Stack Nov 2009.
Assembly Language for x86 Processors 7th Edition Chapter 13: High-Level Language Interface (c) Pearson Education, All rights reserved. You may modify.
Carnegie Mellon 1 Odds and Ends Intro to x86-64 Memory Layout.
Microprocessors The ia32 User Instruction Set Jan 31st, 2002.
15-410, S’ Hardware Overview Jan. 19, 2004 Dave Eckhardt Bruce Maggs L04_Hardware “Dude, what were you thinking?”
1 Carnegie Mellon Assembly and Bomb Lab : Introduction to Computer Systems Recitation 4, Sept. 17, 2012.
Chapter 2 Parts of a Computer System. 2.1 PC Hardware: Memory.
Operating Systems ECE344 Ashvin Goel ECE University of Toronto Memory Management Overview.
Reminder Bomb lab is due tomorrow! Attack lab is released tomorrow!!
X86_64 programming Tutorial #1 CPSC 261. X86_64 An extension of the IA32 (often called x86 – originated in the Intel 8086 processor) instruction set to.
University of Amsterdam Computer Systems – the instruction set architecture Arnoud Visser 1 Computer Systems The instruction set architecture.
Introduction to Intel IA-32 and IA-64 Instruction Set Architectures.
1 Assembly Language: Function Calls Jennifer Rexford.
1 Hardware Overview Dave Eckhardt
Information Security - 2. CISC Vs RISC X86 is CISC while ARM is RISC CISC is Compiler’s heaven while RISC is Architecture’s heaven Orthogonal ISA in RISC.
Paradyn Project Paradyn / Dyninst Week Madison, Wisconsin April 12-14, 2010 Paradyn Project Safe and Efficient Instrumentation Andrew Bernat.
Microprocessors CSE- 341 Dr. Jia Uddin Assistant Professor, CSE, BRAC University Dr. Jia Uddin, CSE, BRAC University.
Exploiting & Defense Day 1 Recap
Assembly function call convention
Instruction Set Architecture
Machine-Level Programming I: Basics
Intel Architecture.
Instruction Set Architectures
Credits and Disclaimers
IA32 Processors Evolutionary Design
Introduction to Compilers Tim Teitelbaum
High-Level Language Interface
Low level Programming.
Recitation: Attack Lab
CSE 351 Section 10 The END…Almost 3/7/12
Introduction to Intel IA-32 and IA-64 Instruction Set Architectures
MIPS Procedure Calls CSE 378 – Section 3.
Machine Level Representation of Programs (IV)
Week 2: Buffer Overflow Part 1.
Roadmap C: Java: Assembly language: OS: Machine code: Computer system:
Reverse Engineering for CTFs
Machine-Level Representation of Programs (x86-64)
Machine-Level Programming II: Basics Comp 21000: Introduction to Computer Organization & Systems Instructor: John Barr * Modified slides from the book.
Get To Know Your Compiler
Machine-Level Programming II: Basics Comp 21000: Introduction to Computer Organization & Systems Spring 2016 Instructor: John Barr * Modified slides.
Lecture 4: Instruction Set Design/Pipelining
The von Neumann Machine
Credits and Disclaimers
Computer Architecture and System Programming Laboratory
Computer Architecture and System Programming Laboratory
Low level Programming.
Presentation transcript:

AMD64/EM64T – Dyninst & ParadynMarch 17, 2005 The AMD64/EM64T Port of Dyninst and Paradyn Greg Quinn Ray Chen

AMD64/EM64T – Dyninst & Paradyn -2- Goals 64-bit Dyninst library and Paradyn daemon that handle both 32-bit and 64-bit mutatees Leverage as much existing functionality as possible

AMD64/EM64T – Dyninst & Paradyn -3- Talk Outline 32-Bit Compatibility 64-Bit Mode –Architectural Overview –Issues for Dyninst Current status and timeline for the port

AMD64/EM64T – Dyninst & ParadynMarch 17, Bit Compatibility

AMD64/EM64T – Dyninst & Paradyn -5- Problematic Porting Conceptually simple –ISA extension –Hardware compatibility –Pre-existing code base –Nightly regression tests

AMD64/EM64T – Dyninst & Paradyn -6- System Structures What’s wrong with this code? struct link_map { /* Base address shared object is loaded at.*/ ElfW(Addr) l_addr; /* Absolute file name object was found in.*/ char *l_name; /* Dynamic section of the shared object.*/ ElfW(Dyn) *l_ld; /* Chain of loaded objects. */ struct link_map *l_next, *l_prev; };

AMD64/EM64T – Dyninst & Paradyn -7- System Structures Compile-time decisions unacceptable Structure size depends on target platform –X86: sizeof( ElfW(Addr) ) == 4 –X86_64: sizeof( ElfW(Addr) ) == 8 Similar problem with pointer data types #define ElfW(type) \ Elf ## __ELF_NATIVE_CLASS ## type

AMD64/EM64T – Dyninst & Paradyn -8- System Structures No backwards compatible structure –Must create and maintain our own Multiple structures affected –link_map, r_debug, libelf routines struct link_map_dyn32 { Elf32_Addr l_addr; uint32_t l_name; uint32_t l_ld; uint32_t l_next, l_prev; };

AMD64/EM64T – Dyninst & Paradyn -9- System Structures Class based solution –Hierarchy with 32-bit and 64-bit siblings –Virtual functions instead of control structures Multiple benefits –No code duplication –Less source clutter –Minor function call overhead

AMD64/EM64T – Dyninst & Paradyn -10- What Works? Operation on 32-bit binaries at 95% –Passes most nightly regression tests Tests 1-12, attach, relocate –Save the World not fully tested Existing x86 shared library issue

AMD64/EM64T – Dyninst & ParadynMarch 17, Bit Mode Architectural Overview

AMD64/EM64T – Dyninst & Paradyn -12- Registers 32-bit Mode: –Eight 32-bit registers EAX EBX ECX EDX EBP ESP EDI ESI

AMD64/EM64T – Dyninst & Paradyn -13- Registers 32-bit Mode: –Eight 32-bit registers 64-bit Mode: –Registers extended to 64 bits RAX RBX RCX RDX RBP RSP RDI RSI

AMD64/EM64T – Dyninst & Paradyn -14- Registers 32-bit Mode: –Eight 32-bit registers 64-bit Mode: –Registers extended to 64 bits –Eight additional registers RAX RBX RCX RDX RBP RSP RDI RSI R8 R9 R10 R11 R12 R13 R14 R15

AMD64/EM64T – Dyninst & Paradyn -15- Registers Encoded using REX prefix: WRXB0100 Determines Width of Operation (32/64) Serve as High Order Bits for Register Numbers

AMD64/EM64T – Dyninst & Paradyn -16- Immediate Values Variable-length instructions allow for register-sized immediates (8 bytes) –MOV RAX, 0x abcdef This is the only way to specify an 8-byte value in an instruction Most importantly for Dyninst: –there is no JMP w/ 8-byte displacement

AMD64/EM64T – Dyninst & ParadynMarch 17, 2005 Handling 64-Bit Mutatees

AMD64/EM64T – Dyninst & Paradyn -18- Instruction Parsing x86 instruction parser collects basic block information and searches for instrumentation points We can use the same parsing algorithm for 64-bit mutatees –Architectural changes are abstracted away by instruction decoding –Bonus: support for stripped binaries

AMD64/EM64T – Dyninst & Paradyn -19- Executing Instrumentation Dyninst maintains a heap of non-contiguous memory areas in the mutatee Instrumentation points jump to code in nearby heap region Code for this already exists (AIX, Solaris) executable library code Mutatee Address Space

AMD64/EM64T – Dyninst & Paradyn -20- Executing Instrumentation Dyninst maintains a heap of non-contiguous memory areas in the mutatee Instrumentation points jump to code in nearby heap region Code for this already exists (AIX, Solaris) executable dyninst heap region library code Mutatee Address Space

AMD64/EM64T – Dyninst & Paradyn -21- Executing Instrumentation Dyninst maintains a heap of non-contiguous memory areas in the mutatee Instrumentation points jump to code in nearby heap region Code for this already exists (AIX, Solaris) executable dyninst heap region library code Mutatee Address Space >> 4GB spacing

AMD64/EM64T – Dyninst & Paradyn -22- Executing Instrumentation Dyninst maintains a heap of non-contiguous memory areas in the mutatee Instrumentation points jump to code in nearby heap region Code for this already exists (AIX, Solaris) executable dyninst heap region library code dyninst heap region Mutatee Address Space >> 4GB spacing

AMD64/EM64T – Dyninst & Paradyn -23- Code Generation Improved architecture allows for more efficient code generation –Stack no longer used for passing arguments –More registers means stack no longer needed for temporary values

AMD64/EM64T – Dyninst & Paradyn -24- Good Things™ We have been able to leverage x86 port extensively (code reuse) Some 32-bit headaches go away –Non-standard optimizations in mutatee code (_dl_open example) More registers allow for more efficient instrumentation code

AMD64/EM64T – Dyninst & Paradyn -25- Status/Timeline Now working: –32-bit support –Instruction decoding, parsing Left to do: –Code generation –Memory allocation –Counter, timers, and sampling code for Paradyn Beta release: 2Q05 –Available for partners and friends Production release: 3Q05

AMD64/EM64T – Dyninst & Paradyn -26- Questions?