SlideShare ist ein Scribd-Unternehmen logo
1 von 36
The Deconstruction of Dyninst

  Andrew Bernat, Bill Williams
          Paradyn Project

               CScADS
            June 26, 2012
Dyninst 8.0
o Component integration
  o ProcControlAPI
  o StackwalkerAPI
  o PatchAPI
o Additional analyses
  o Register liveness
  o Improved stack height
o Significantly reduced overhead
o Additional platforms: PPC-64, BlueGene

                The Deconstruction of Dyninst   2
Performance Improvements
% Execution Time Increase

                            400%

                            350%

                            300%

                            250%

                            200%

                            150%

                            100%

                            50%

                             0%
                                   pe


                                         bz


                                               gc


                                                      m


                                                            go


                                                                   hm



                                                                           sj

                                                                           lib



                                                                                     h2


                                                                                              om



                                                                                                      as

                                                                                                             xa

                                                                                                                   G
                                                                                                                    eo
                                                                             en
                                                       cf




                                                                                                        ta
                                                  c




                                                                                                              la
                                    rl


                                          ip




                                                                               qu
                                                               b




                                                                                        6


                                                                                                ne
                                                                     m
                                                              m




                                                                                         4r




                                                                                                                       m
                                                                                                        r
                                                                                g




                                                                                                              nc
                                                                                 a
                                                                      er




                                                                                                 tp
                                                               k




                                                                                                                        et
                                                                                            ef
                                                                                 nt




                                                                                                                 b
                                                                                                 p




                                                                                                                         r ic
                                                                                                                   m
                                                                                    um




                                                                                                                    k


                                                                                                                             M
                                                                                                                                ea
                                   Dyninst 7.0                PEBIL            PIN               DynamoRIO




                                                                                                                                 n
                                   Dyninst 8.0

                                                       The Deconstruction of Dyninst                               3
Dyninst Components Timeline
   Design and Implementation
                                                                       DynCAPI
   Beta Release
   First Release                                                       DataflowAPI
   Integration into Dyninst
                                                                       PatchAPI

                                                                       ParseAPI

                                                                       ProcControlAPI

                                                                       InstructionAPI

                                                                       StackwalkerAPI

                                                                   SymtabAPI

       2006     2007     2008      2009      2010        2011   2012
                         The Deconstruction of Dyninst                      4
Dyninst Components Timeline
   Design and Implementation
                                                                       DynCAPI
   Beta Release
   First Release                                                       DataflowAPI
   Integration into Dyninst
                                                                       PatchAPI

                                                                       ParseAPI

                                                                       ProcControlAPI

                                                                       InstructionAPI

                                                                       StackwalkerAPI

                                                                   SymtabAPI

       2006     2007     2008      2009      2010        2011   2012
                         The Deconstruction of Dyninst                      4
Dyninst and the Components
         = Existing Component
         = Proposed
 AST
                                        Code
                                        Gen

           SymtabAPI       Parsing                   Process
                            API
                                        Patch
Binary                                   API         Binary
           Instruction    DataFlow
               API          API


                                       ProcControl
                         Stackwalker       API
                             API
Dyninst and the Components
         = Existing Component
         = Proposed
 AST
                                        Code
                                        Gen

           SymtabAPI       Parsing                   Process
                            API
                                        Patch
Binary                                   API         Binary
           Instruction    DataFlow
               API          API


                                       ProcControl
                         Stackwalker       API
                             API
Dyninst and the Components
         = Existing Component
         = Proposed
 AST
                                        Code
                                        Gen

           SymtabAPI       Parsing                   Process
                            API
                                        Patch
Binary                                   API         Binary
           Instruction    DataFlow
               API          API


                                       ProcControl
                         Stackwalker       API
                             API
Dyninst and the Components
         = Existing Component
         = Proposed
 AST
                                        Code
                                        Gen

           SymtabAPI       Parsing                   Process
                            API
                                        Patch
Binary                                   API         Binary
           Instruction    DataFlow
               API          API


                                       ProcControl
                         Stackwalker       API
                             API
Programming with Dyninst and
o Dyninst user interface is backwards
  compatible
o Component interfaces are more capable
o Goal: Dyninst as thin veneer over
  components
    PatchMgrPtr PatchAPI::convert(BPatch_addressSpace
    *);

    PatchBlock *PatchAPI::convert(BPatch_basicBlock *);

    Block *ParseAPI::convert(BPatch_basicBlock *);

    Symtab *SymtabAPI::convert(BPatch_module *);
                  The Deconstruction of Dyninst      6
Component Challenges




           The Deconstruction of Dyninst   7
Component Challenges

            Concurrency




           The Deconstruction of Dyninst   7
Component Challenges

               Concurrency
                          +
  Incomplete and inconsistent interfaces




              The Deconstruction of Dyninst   7
Component Challenges

               Concurrency
                          +
  Incomplete and inconsistent interfaces
                          =

    High-performance process control



              The Deconstruction of Dyninst   7
ProcControlAPI
o Entirely reengineered stop/continue logic
o Simplified RPC interface
o Process group support
o Hardware breakpoint support

o Platform support
  o BlueGene
  o Windows



               The Deconstruction of Dyninst   8
StackwalkerAPI
o Binary analysis frameStepper
  o Improves stack walk accuracy in frameless
    functions
  o Fallback option if cheaper steppers fail


o 3rd party stack walking through
  ProcControlAPI
  o Improved portability
  o More capable process control interface


                The Deconstruction of Dyninst   9
PatchAPI – Binary Modification
o Use familiar abstractions
  o CFG
  o Snippets
o Interactive
  o Inserted code becomes part of the CFG and
    can be modified further
  o Instrument modified code
o Safe
  o Avoid unexpected side-effects
  o Preserve correct control flow

                The Deconstruction of Dyninst   10
CFG Transformations
o Modifying code: block split, edge
  redirection




o Inserting code: snippets
              store


       addr                    add


                      deref          1


                      addr




                              The Deconstruction of Dyninst   11
Code Insertion (Apache hotpatch tool)
                 PatchBlock *b1, *b2;
   b1


        callee


   b2




                    The Deconstruction of Dyninst   12
Code Insertion (Apache hotpatch tool)
                 PatchBlock *b1, *b2;
   b1

                 Snippet::Ptr snip;
        callee   IC::Ptr code = PatchModifier::insert(b1->obj(),
                                        snip,
                                        b1->exit());
   b2




                    The Deconstruction of Dyninst             12
Code Insertion (Apache hotpatch tool)
                 PatchBlock *b1, *b2;
   b1

                 Snippet::Ptr snip;
        callee   IC::Ptr code = PatchModifier::insert(b1->obj(),
                                        snip,
                                        b1->exit());
   b2
                 PatchModifier::redirect(getEdge(b1, CALL_FT),
                                code->entry());




                    The Deconstruction of Dyninst             12
Code Insertion (Apache hotpatch tool)
                 PatchBlock *b1, *b2;
   b1

                 Snippet::Ptr snip;
        callee   IC::Ptr code = PatchModifier::insert(b1->obj(),
                                        snip,
                                        b1->exit());
   b2
                 PatchModifier::redirect(getEdge(b1, CALL_FT),
                                code->entry());


                 for (iterator iter = code->exits().begin();
                       iter != code->exits().end(); ++iter) {
                    PatchModifier::redirect(*iter, b2);
                 }




                    The Deconstruction of Dyninst               12
Code Replacement (CRAFT, Michael
           PatchBlock *b;
           Address a2, a3;
      a2
  b
      a3




               The Deconstruction of Dyninst   13
Code Replacement (CRAFT, Michael
            PatchBlock *b;
  b1        Address a2, a3;

       a2   PatchBlock *b3 = PatchModifier::split(b, a3);
  b2        PatchBlock *b2 = PatchModifier::split(b, a2);
            PatchBlock *b1 = b;
       a3
  b3




                 The Deconstruction of Dyninst             13
Code Replacement (CRAFT, Michael
            PatchBlock *b;
  b1        Address a2, a3;

       a2   PatchBlock *b3 = PatchModifier::split(b, a3);
  b2        PatchBlock *b2 = PatchModifier::split(b, a2);
            PatchBlock *b1 = b;
       a3
  b3
            IC::Ptr code = PatchModifier::insert(b->obj(),
                                   snip,
                                   b2->entry());




                 The Deconstruction of Dyninst              13
Code Replacement (CRAFT, Michael
          PatchBlock *b;
  b1      Address a2, a3;
          PatchBlock *b3 = PatchModifier::split(b, a3);
  b2      PatchBlock *b2 = PatchModifier::split(b, a2);
          PatchBlock *b1 = b;
  b3
          IC::Ptr code = PatchModifier::insert(b->obj(),
                                 snip,
                                 b2->entry());
          PatchModifier::redirect(getEdge(b1, FT),
                         code->entry());

          for (iterator iter = code->exits().begin();
                iter != code->exits().end(); ++iter) {
             PatchModifier::redirect(*iter, b2);
          }




               The Deconstruction of Dyninst              13
Code Replacement (CRAFT, Michael
          PatchBlock *b;
  b1      Address a2, a3;
          PatchBlock *b3 = PatchModifier::split(b, a3);
          PatchBlock *b2 = PatchModifier::split(b, a2);
          PatchBlock *b1 = b;
  b3
          IC::Ptr code = PatchModifier::insert(b->obj(),
                                 snip,
                                 b2->entry());
          PatchModifier::redirect(getEdge(b1, FT),
                         code->entry());

          for (iterator iter = code->exits().begin();
                iter != code->exits().end(); ++iter) {
             PatchModifier::redirect(*iter, b2);
          }

          PatchModifier::remove(b2);

               The Deconstruction of Dyninst              13
CFG Modification Callbacks
o Interface class for CFG modification
  updates
o Register one (or more) child classes
o Notify on CFG element:
  o Creation
  o Destruction
  o Block splitting
  o New in-edge or out-edge
  o Removed in-edge or out-edge
o Notify on Point creation, destruction, or
  change        The Deconstruction of Dyninst
                                          14
PatchAPI – User-defined snippets
o Allow users to insert their own code
  o Floating point
  o Access to complex data structures
  o Platform-specific optimizations
  o Precompiled binary blobs


o Simple interface
  o Extensible for better code generation
    efficiency


                 The Deconstruction of Dyninst   15
class Snippet
o bool generate(Point *point, Buffer
  &buffer);
  o point: identifies location of code generation
  o buffer: container of generated code




                 The Deconstruction of Dyninst   16
Data structure accesses (boar)
                               lea -128(%rsp), %rsp
                               push %rax
     Register saves            lahf
                               seto %al
                               push %rax
                               push %rbx
                               mov $1, %rax
                               xaddl %rax, <index>(%rip)
     Circular buffer           and <size>, %rax
                               lea <base>(%rip), %rbx
             access            movl <ID> (%rbx,%rax,4)
                               pop %rbx
                               pop %rax
                               add 0x7f, %al
   Register restores           sahf
                               pop %rax
                               lea 128(%rsp), %rsp



                The Deconstruction of Dyninst              17
Data structure accesses (boar)




                              mov $1, %rax
                              xaddl %rax, <index>(%rip)
     Circular buffer          and <size>, %rax
                              lea <base>(%rip), %rbx
             access           movl <ID> (%rbx,%rax,4)




               The Deconstruction of Dyninst              17
Single-precision floating point (CRAFT)




   addsd xmm0,                              addss xmm0, xmm1
   xmm1




                 The Deconstruction of Dyninst             18
Single-precision floating point (CRAFT)
      nop                                 cvtsd2ss xmm1, xmm1
                                          mov eax, 0x7ff4dead
      mov qword ptr [rsp-0xb8], rax       mov rcx, 0xffffffff
      mov rax, 0x0                        and rax, rcx
      lahf                                rol rax, 0x20
      seto al                             movlpd qword ptr [rsp-0xe8], xmm1
      mov qword ptr [rsp-0xc0], rax       mov rcx, 0xffffffff
      mov qword ptr [rsp-0xd0], rax       and qword ptr [rsp-0xe8], rcx
      mov qword ptr [rsp-0xd8], rbx       or qword ptr [rsp-0xe8], rax
      mov qword ptr [rsp-0xe0], rcx       movlpd xmm1, qword ptr [rsp-0xe8]
      movq rax, xmm0
      mov rbx, 0x7fffffff00000000         mov rax, 0x605000
      and rax, rbx                        mov rbx, qword ptr [rax]
      mov rbx, 0x7ff4dead00000000         inc qword ptr [rbx+0xf8]
      cmp rbx, rax                        mov rcx, qword ptr [rsp-0xe0]
      jz 0x7fff1d923f6c                   mov rbx, qword ptr [rsp-0xd8]
                                          mov rax, qword ptr [rsp-0xd0]
      movq rax, xmm1                      mov rax, qword ptr [rsp-0xb8]
      mov rbx, 0x7fffffff00000000         addss xmm0, xmm1
      and rax, rbx                        mov qword ptr [rsp-0xb8], rax
      mov rbx, 0x7ff4dead00000000         mov qword ptr [rsp-0xd0], rax
      cmp rbx, rax                        mov qword ptr [rsp-0xd8], rcx
      jz 0x7fff1d923f6c                   mov eax, 0x7ff4dead
                                          mov rcx, 0xffffffff
      cvtsd2ss xmm0, xmm0                 and rax, rcx
      mov eax, 0x7ff4dead                 rol rax, 0x20
      mov rcx, 0xffffffff                 movlpd qword ptr [rsp-0xe0], xmm0
      and rax, rcx                        mov rcx, 0xffffffff
      rol rax, 0x20                       and qword ptr [rsp-0xe0], rcx
      movlpd qword ptr [rsp-0xe8], xmm0   or qword ptr [rsp-0xe0], rax
      mov rcx, 0xffffffff                 movlpd xmm0, qword ptr [rsp-0xe0]
      and qword ptr [rsp-0xe8], rcx       mov rcx, qword ptr [rsp-0xd8]
      or qword ptr [rsp-0xe8], rax        mov rax, qword ptr [rsp-0xd0]
      movlpd xmm0, qword ptr [rsp-0xe8]   mov rax, qword ptr [rsp-0xc0]
                                          add al, 0x7f
                                          sahf
                                          mov rax, qword ptr [rsp-0xb8]


                             The Deconstruction of Dyninst                    18
Dyninst 8.0
o Coming soon!
  o Individual component integration complete
  o Final merging in progress


o Great features and new platform support

o Beta access upon request




                The Deconstruction of Dyninst   19
Research Status
o Recently finished:
  o Binary editing (Bernat)
  o Extreme scale process control and inspection
    (Brim)
  o Analyzing and instrumenting malicious code
    (Roundy)
o In flight:
  o Analysis and visualization of large systems
    (Fang)
  o Return address tamper detection (Jacobson)
        Papers at www.paradyn.org
  o Binary authorship (Meng)
                 The Deconstruction of Dyninst   20

Weitere ähnliche Inhalte

Ähnlich wie BernatC ScADS-2012

Curbarea tevilor din pwc pt solar
Curbarea tevilor din pwc pt solarCurbarea tevilor din pwc pt solar
Curbarea tevilor din pwc pt solarGherghescu Gabriel
 
OpenID Foundation Japan Chapter Announcement
OpenID Foundation Japan Chapter AnnouncementOpenID Foundation Japan Chapter Announcement
OpenID Foundation Japan Chapter AnnouncementDavid Recordon
 
Introduction to windows workflow foundation (2007)
Introduction to windows workflow foundation (2007)Introduction to windows workflow foundation (2007)
Introduction to windows workflow foundation (2007)Bruno Camara
 
Dave Folio G D 8
Dave Folio  G D 8Dave Folio  G D 8
Dave Folio G D 8Dave Lilly
 
Egkekrimena sxedia comenius 2012
Egkekrimena sxedia comenius 2012Egkekrimena sxedia comenius 2012
Egkekrimena sxedia comenius 2012sfikasp
 
Digital signature
Digital signatureDigital signature
Digital signatureYug Sharma
 
if you forget me
if you forget meif you forget me
if you forget menitish
 
Blackhawk Mines Corp. Marmajito Mining Sector
Blackhawk Mines Corp. Marmajito Mining SectorBlackhawk Mines Corp. Marmajito Mining Sector
Blackhawk Mines Corp. Marmajito Mining SectorGenesis Mcklein
 
Personas 2 0 (World Usability Day 2007)
Personas 2 0 (World Usability Day 2007)Personas 2 0 (World Usability Day 2007)
Personas 2 0 (World Usability Day 2007)Raphael De Robiano
 
Nov Dec Newsletter
Nov Dec NewsletterNov Dec Newsletter
Nov Dec Newsletterkf_glensky
 
2011美國創新事業規劃研修團分享
2011美國創新事業規劃研修團分享2011美國創新事業規劃研修團分享
2011美國創新事業規劃研修團分享基欽 劉
 
Xero Advertisment - NZ Accountants Journal November 2007
Xero Advertisment - NZ Accountants Journal  November 2007Xero Advertisment - NZ Accountants Journal  November 2007
Xero Advertisment - NZ Accountants Journal November 2007Xero
 
South Lincoln County, Workshop Presentation (Feb 29, 2012)
South Lincoln County, Workshop Presentation (Feb 29, 2012)South Lincoln County, Workshop Presentation (Feb 29, 2012)
South Lincoln County, Workshop Presentation (Feb 29, 2012)Travel Oregon
 

Ähnlich wie BernatC ScADS-2012 (20)

Curbarea tevilor din pwc pt solar
Curbarea tevilor din pwc pt solarCurbarea tevilor din pwc pt solar
Curbarea tevilor din pwc pt solar
 
OpenID Foundation Japan Chapter Announcement
OpenID Foundation Japan Chapter AnnouncementOpenID Foundation Japan Chapter Announcement
OpenID Foundation Japan Chapter Announcement
 
Arch grnhouse
Arch grnhouseArch grnhouse
Arch grnhouse
 
Poultry pen
Poultry penPoultry pen
Poultry pen
 
Chapter 4 bj ts dc biasing
Chapter 4 bj ts dc biasingChapter 4 bj ts dc biasing
Chapter 4 bj ts dc biasing
 
Introduction to windows workflow foundation (2007)
Introduction to windows workflow foundation (2007)Introduction to windows workflow foundation (2007)
Introduction to windows workflow foundation (2007)
 
Social Media Branding by Dawn Jensen
Social Media Branding by Dawn JensenSocial Media Branding by Dawn Jensen
Social Media Branding by Dawn Jensen
 
Dave Folio
Dave FolioDave Folio
Dave Folio
 
Dave Folio G D 8
Dave Folio  G D 8Dave Folio  G D 8
Dave Folio G D 8
 
Cold frame
Cold frameCold frame
Cold frame
 
Egkekrimena sxedia comenius 2012
Egkekrimena sxedia comenius 2012Egkekrimena sxedia comenius 2012
Egkekrimena sxedia comenius 2012
 
Digital signature
Digital signatureDigital signature
Digital signature
 
if you forget me
if you forget meif you forget me
if you forget me
 
Blackhawk Mines Corp. Marmajito Mining Sector
Blackhawk Mines Corp. Marmajito Mining SectorBlackhawk Mines Corp. Marmajito Mining Sector
Blackhawk Mines Corp. Marmajito Mining Sector
 
Concept Board
Concept BoardConcept Board
Concept Board
 
Personas 2 0 (World Usability Day 2007)
Personas 2 0 (World Usability Day 2007)Personas 2 0 (World Usability Day 2007)
Personas 2 0 (World Usability Day 2007)
 
Nov Dec Newsletter
Nov Dec NewsletterNov Dec Newsletter
Nov Dec Newsletter
 
2011美國創新事業規劃研修團分享
2011美國創新事業規劃研修團分享2011美國創新事業規劃研修團分享
2011美國創新事業規劃研修團分享
 
Xero Advertisment - NZ Accountants Journal November 2007
Xero Advertisment - NZ Accountants Journal  November 2007Xero Advertisment - NZ Accountants Journal  November 2007
Xero Advertisment - NZ Accountants Journal November 2007
 
South Lincoln County, Workshop Presentation (Feb 29, 2012)
South Lincoln County, Workshop Presentation (Feb 29, 2012)South Lincoln County, Workshop Presentation (Feb 29, 2012)
South Lincoln County, Workshop Presentation (Feb 29, 2012)
 

Kürzlich hochgeladen

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 

Kürzlich hochgeladen (20)

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 

BernatC ScADS-2012

  • 1. The Deconstruction of Dyninst Andrew Bernat, Bill Williams Paradyn Project CScADS June 26, 2012
  • 2. Dyninst 8.0 o Component integration o ProcControlAPI o StackwalkerAPI o PatchAPI o Additional analyses o Register liveness o Improved stack height o Significantly reduced overhead o Additional platforms: PPC-64, BlueGene The Deconstruction of Dyninst 2
  • 3. Performance Improvements % Execution Time Increase 400% 350% 300% 250% 200% 150% 100% 50% 0% pe bz gc m go hm sj lib h2 om as xa G eo en cf ta c la rl ip qu b 6 ne m m 4r m r g nc a er tp k et ef nt b p r ic m um k M ea Dyninst 7.0 PEBIL PIN DynamoRIO n Dyninst 8.0 The Deconstruction of Dyninst 3
  • 4. Dyninst Components Timeline Design and Implementation DynCAPI Beta Release First Release DataflowAPI Integration into Dyninst PatchAPI ParseAPI ProcControlAPI InstructionAPI StackwalkerAPI SymtabAPI 2006 2007 2008 2009 2010 2011 2012 The Deconstruction of Dyninst 4
  • 5. Dyninst Components Timeline Design and Implementation DynCAPI Beta Release First Release DataflowAPI Integration into Dyninst PatchAPI ParseAPI ProcControlAPI InstructionAPI StackwalkerAPI SymtabAPI 2006 2007 2008 2009 2010 2011 2012 The Deconstruction of Dyninst 4
  • 6. Dyninst and the Components = Existing Component = Proposed AST Code Gen SymtabAPI Parsing Process API Patch Binary API Binary Instruction DataFlow API API ProcControl Stackwalker API API
  • 7. Dyninst and the Components = Existing Component = Proposed AST Code Gen SymtabAPI Parsing Process API Patch Binary API Binary Instruction DataFlow API API ProcControl Stackwalker API API
  • 8. Dyninst and the Components = Existing Component = Proposed AST Code Gen SymtabAPI Parsing Process API Patch Binary API Binary Instruction DataFlow API API ProcControl Stackwalker API API
  • 9. Dyninst and the Components = Existing Component = Proposed AST Code Gen SymtabAPI Parsing Process API Patch Binary API Binary Instruction DataFlow API API ProcControl Stackwalker API API
  • 10. Programming with Dyninst and o Dyninst user interface is backwards compatible o Component interfaces are more capable o Goal: Dyninst as thin veneer over components PatchMgrPtr PatchAPI::convert(BPatch_addressSpace *); PatchBlock *PatchAPI::convert(BPatch_basicBlock *); Block *ParseAPI::convert(BPatch_basicBlock *); Symtab *SymtabAPI::convert(BPatch_module *); The Deconstruction of Dyninst 6
  • 11. Component Challenges The Deconstruction of Dyninst 7
  • 12. Component Challenges Concurrency The Deconstruction of Dyninst 7
  • 13. Component Challenges Concurrency + Incomplete and inconsistent interfaces The Deconstruction of Dyninst 7
  • 14. Component Challenges Concurrency + Incomplete and inconsistent interfaces = High-performance process control The Deconstruction of Dyninst 7
  • 15. ProcControlAPI o Entirely reengineered stop/continue logic o Simplified RPC interface o Process group support o Hardware breakpoint support o Platform support o BlueGene o Windows The Deconstruction of Dyninst 8
  • 16. StackwalkerAPI o Binary analysis frameStepper o Improves stack walk accuracy in frameless functions o Fallback option if cheaper steppers fail o 3rd party stack walking through ProcControlAPI o Improved portability o More capable process control interface The Deconstruction of Dyninst 9
  • 17. PatchAPI – Binary Modification o Use familiar abstractions o CFG o Snippets o Interactive o Inserted code becomes part of the CFG and can be modified further o Instrument modified code o Safe o Avoid unexpected side-effects o Preserve correct control flow The Deconstruction of Dyninst 10
  • 18. CFG Transformations o Modifying code: block split, edge redirection o Inserting code: snippets store addr add deref 1 addr The Deconstruction of Dyninst 11
  • 19. Code Insertion (Apache hotpatch tool) PatchBlock *b1, *b2; b1 callee b2 The Deconstruction of Dyninst 12
  • 20. Code Insertion (Apache hotpatch tool) PatchBlock *b1, *b2; b1 Snippet::Ptr snip; callee IC::Ptr code = PatchModifier::insert(b1->obj(), snip, b1->exit()); b2 The Deconstruction of Dyninst 12
  • 21. Code Insertion (Apache hotpatch tool) PatchBlock *b1, *b2; b1 Snippet::Ptr snip; callee IC::Ptr code = PatchModifier::insert(b1->obj(), snip, b1->exit()); b2 PatchModifier::redirect(getEdge(b1, CALL_FT), code->entry()); The Deconstruction of Dyninst 12
  • 22. Code Insertion (Apache hotpatch tool) PatchBlock *b1, *b2; b1 Snippet::Ptr snip; callee IC::Ptr code = PatchModifier::insert(b1->obj(), snip, b1->exit()); b2 PatchModifier::redirect(getEdge(b1, CALL_FT), code->entry()); for (iterator iter = code->exits().begin(); iter != code->exits().end(); ++iter) { PatchModifier::redirect(*iter, b2); } The Deconstruction of Dyninst 12
  • 23. Code Replacement (CRAFT, Michael PatchBlock *b; Address a2, a3; a2 b a3 The Deconstruction of Dyninst 13
  • 24. Code Replacement (CRAFT, Michael PatchBlock *b; b1 Address a2, a3; a2 PatchBlock *b3 = PatchModifier::split(b, a3); b2 PatchBlock *b2 = PatchModifier::split(b, a2); PatchBlock *b1 = b; a3 b3 The Deconstruction of Dyninst 13
  • 25. Code Replacement (CRAFT, Michael PatchBlock *b; b1 Address a2, a3; a2 PatchBlock *b3 = PatchModifier::split(b, a3); b2 PatchBlock *b2 = PatchModifier::split(b, a2); PatchBlock *b1 = b; a3 b3 IC::Ptr code = PatchModifier::insert(b->obj(), snip, b2->entry()); The Deconstruction of Dyninst 13
  • 26. Code Replacement (CRAFT, Michael PatchBlock *b; b1 Address a2, a3; PatchBlock *b3 = PatchModifier::split(b, a3); b2 PatchBlock *b2 = PatchModifier::split(b, a2); PatchBlock *b1 = b; b3 IC::Ptr code = PatchModifier::insert(b->obj(), snip, b2->entry()); PatchModifier::redirect(getEdge(b1, FT), code->entry()); for (iterator iter = code->exits().begin(); iter != code->exits().end(); ++iter) { PatchModifier::redirect(*iter, b2); } The Deconstruction of Dyninst 13
  • 27. Code Replacement (CRAFT, Michael PatchBlock *b; b1 Address a2, a3; PatchBlock *b3 = PatchModifier::split(b, a3); PatchBlock *b2 = PatchModifier::split(b, a2); PatchBlock *b1 = b; b3 IC::Ptr code = PatchModifier::insert(b->obj(), snip, b2->entry()); PatchModifier::redirect(getEdge(b1, FT), code->entry()); for (iterator iter = code->exits().begin(); iter != code->exits().end(); ++iter) { PatchModifier::redirect(*iter, b2); } PatchModifier::remove(b2); The Deconstruction of Dyninst 13
  • 28. CFG Modification Callbacks o Interface class for CFG modification updates o Register one (or more) child classes o Notify on CFG element: o Creation o Destruction o Block splitting o New in-edge or out-edge o Removed in-edge or out-edge o Notify on Point creation, destruction, or change The Deconstruction of Dyninst 14
  • 29. PatchAPI – User-defined snippets o Allow users to insert their own code o Floating point o Access to complex data structures o Platform-specific optimizations o Precompiled binary blobs o Simple interface o Extensible for better code generation efficiency The Deconstruction of Dyninst 15
  • 30. class Snippet o bool generate(Point *point, Buffer &buffer); o point: identifies location of code generation o buffer: container of generated code The Deconstruction of Dyninst 16
  • 31. Data structure accesses (boar) lea -128(%rsp), %rsp push %rax Register saves lahf seto %al push %rax push %rbx mov $1, %rax xaddl %rax, <index>(%rip) Circular buffer and <size>, %rax lea <base>(%rip), %rbx access movl <ID> (%rbx,%rax,4) pop %rbx pop %rax add 0x7f, %al Register restores sahf pop %rax lea 128(%rsp), %rsp The Deconstruction of Dyninst 17
  • 32. Data structure accesses (boar) mov $1, %rax xaddl %rax, <index>(%rip) Circular buffer and <size>, %rax lea <base>(%rip), %rbx access movl <ID> (%rbx,%rax,4) The Deconstruction of Dyninst 17
  • 33. Single-precision floating point (CRAFT) addsd xmm0, addss xmm0, xmm1 xmm1 The Deconstruction of Dyninst 18
  • 34. Single-precision floating point (CRAFT) nop cvtsd2ss xmm1, xmm1 mov eax, 0x7ff4dead mov qword ptr [rsp-0xb8], rax mov rcx, 0xffffffff mov rax, 0x0 and rax, rcx lahf rol rax, 0x20 seto al movlpd qword ptr [rsp-0xe8], xmm1 mov qword ptr [rsp-0xc0], rax mov rcx, 0xffffffff mov qword ptr [rsp-0xd0], rax and qword ptr [rsp-0xe8], rcx mov qword ptr [rsp-0xd8], rbx or qword ptr [rsp-0xe8], rax mov qword ptr [rsp-0xe0], rcx movlpd xmm1, qword ptr [rsp-0xe8] movq rax, xmm0 mov rbx, 0x7fffffff00000000 mov rax, 0x605000 and rax, rbx mov rbx, qword ptr [rax] mov rbx, 0x7ff4dead00000000 inc qword ptr [rbx+0xf8] cmp rbx, rax mov rcx, qword ptr [rsp-0xe0] jz 0x7fff1d923f6c mov rbx, qword ptr [rsp-0xd8] mov rax, qword ptr [rsp-0xd0] movq rax, xmm1 mov rax, qword ptr [rsp-0xb8] mov rbx, 0x7fffffff00000000 addss xmm0, xmm1 and rax, rbx mov qword ptr [rsp-0xb8], rax mov rbx, 0x7ff4dead00000000 mov qword ptr [rsp-0xd0], rax cmp rbx, rax mov qword ptr [rsp-0xd8], rcx jz 0x7fff1d923f6c mov eax, 0x7ff4dead mov rcx, 0xffffffff cvtsd2ss xmm0, xmm0 and rax, rcx mov eax, 0x7ff4dead rol rax, 0x20 mov rcx, 0xffffffff movlpd qword ptr [rsp-0xe0], xmm0 and rax, rcx mov rcx, 0xffffffff rol rax, 0x20 and qword ptr [rsp-0xe0], rcx movlpd qword ptr [rsp-0xe8], xmm0 or qword ptr [rsp-0xe0], rax mov rcx, 0xffffffff movlpd xmm0, qword ptr [rsp-0xe0] and qword ptr [rsp-0xe8], rcx mov rcx, qword ptr [rsp-0xd8] or qword ptr [rsp-0xe8], rax mov rax, qword ptr [rsp-0xd0] movlpd xmm0, qword ptr [rsp-0xe8] mov rax, qword ptr [rsp-0xc0] add al, 0x7f sahf mov rax, qword ptr [rsp-0xb8] The Deconstruction of Dyninst 18
  • 35. Dyninst 8.0 o Coming soon! o Individual component integration complete o Final merging in progress o Great features and new platform support o Beta access upon request The Deconstruction of Dyninst 19
  • 36. Research Status o Recently finished: o Binary editing (Bernat) o Extreme scale process control and inspection (Brim) o Analyzing and instrumenting malicious code (Roundy) o In flight: o Analysis and visualization of large systems (Fang) o Return address tamper detection (Jacobson) Papers at www.paradyn.org o Binary authorship (Meng) The Deconstruction of Dyninst 20

Hinweis der Redaktion

  1. \n
  2. \n
  3. Overhead results were gathered from instrumenting the SPEC CPU benchmarks. We instrumented each basic block with an increment of a value in memory. For each tool we used their provided example code that includes all pertinent optimizations. \n\nDyninst 7.0 and 8.0: www.dyninst.org\nPEBIL: http://www.sdsc.edu/pmac/projects/pebil.html\nPIN: http://www.pintool.org/\nDynamoRIO: http://code.google.com/p/dynamorio/\n\nResults for omnetpp are missing for Dyninst 7.0 and PEBIL; omnet uses an exception mechanism that neither tool handles. \nPEBIL failed to correctly instrument GCC. \n\n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. \n
  43. \n
  44. \n
  45. \n
  46. \n
  47. \n
  48. \n
  49. \n
  50. \n
  51. \n
  52. \n
  53. \n
  54. \n
  55. \n
  56. \n
  57. \n
  58. \n
  59. \n
  60. \n
  61. \n
  62. \n
  63. \n
  64. \n
  65. \n
  66. \n
  67. \n