SlideShare a Scribd company logo
Software Architecture in Evolution and
Reverse Engineering of Legacy systems
                   Mikael Lindvall, Dharma Ganesan
         Software Architecture and Embedded Systems division
     Fraunhofer Center for Experimental Software Engineering Maryland (FC-MD)




                                 © 2012 Fraunhofer USA, Inc.
Your Presenters




     Mikael Lindvall, PhD                               Dharma Ganesan, PhD
•   Division director, more than 13              •       Research scientist, more than 8
    years at FC-MD, co-invented FC-                      years at FC-MD, co-invented FC-
    MD’s reverse engineering                             MD’s reverse engineering and
    approach, analyzed e.g. NASA’s                       testing approach, analyzed
    Space Network (10 MLOC ADA,                          NASA’s Core Flight Software,
    C++ etc). Review board member                        GMSEC, Climate Modeling
    for SN replacement system                            System etc. etc.
    (SGSS).
                                © 2012 Fraunhofer USA, Inc.
Fraunhofer Center – Maryland (FC-MD)
• Applied Research and Tech Transfer, non-profit
   – US incorporated
• Affiliated with
   – University of Maryland, College Park
   – Fraunhofer Germany
• Close to ties to NASA
   – Goddard Space Flight Center around the corner
• Focus on Software Engineering
   – Especially Software Quality
• Business model: Applied research services

                        © 2012 Fraunhofer USA, Inc.
Fraunhofer Center – Maryland (FC-MD)
at MSquare




             © 2012 Fraunhofer USA, Inc.
Clients ask Fraunhofer to determine

•   If their sw architecture/design rules are met
•   The risk involved if they change the software
•   If their software meet certain regulations
•   If their software has defects
•   If their software is efficient
•   Etc. etc.

    Today: How reverse engineering can be used to deal with legacy
    systems using different kinds of examples on different systems



                                © 2012 Fraunhofer USA, Inc.
Reverse Engineering at Fraunhofer

• Developed an approach to analyze, visualize
  and describe legacy software
  – Structure and behavior
  – Methods and tools
  – Support from NASA IV&V
• Analyzed legacy software systems e.g.
  – NASA’s Space Network (Ground segment)
  – NASA’s Core Flight Software
  – NASA’s GMSEC
• More than 10 years

                       © 2012 Fraunhofer USA, Inc.
Background: Software architecture
• Software architecture (SA) deals with
  components, connectors, and protocols
• SA is a multi-dimensional artifact
  – Each dimension corresponds to one concern
    (e.g. Database interaction concern)
• SA is represented by a collection of views
  – Development/Implementation view
  – Runtime view

                               7
                   © 2012 Fraunhofer USA, Inc.
Our Model of SA and RE
• Development views
  – Components of a development view
     • Directories/files/functions/database tables
  – Connectors of a development view
     • Function calls, includes, variable accesses, etc.
• Runtime views
  – Components of a runtime view
     • Tasks, Processes
  – Connectors of a runtime view
     • Sockets, Queues, Shared Memory, Software Bus etc.
• Create views from source code to answer questions!
                                        8
                            © 2012 Fraunhofer USA, Inc.
The Fraunhofer RE Method
• Software architecture is influenced and
  inspired by external entities (EE)
  – Programming language libraries
  – COTS and Frameworks
• Reverse Engineering is driven by EE
• A knowledge base of EE based on ~24
  real-world systems
  – Several NASA systems and other companies

                                                 9
                   © 2012 Fraunhofer USA, Inc.
SAVE
      Sample Software Architecture Visualization and Evaluation Tools
                  (Depends on development environment)


   Tool         Type                                  Purpose
Understand   Commercial    Extracts code-level dependencies and metrics from source code

RPA          Research      Queries the dependency models using relational algebra
Prefuse      Research      Visualizes the content of the knowledge base

Similarity   Research      Determines similarity among files

FindBugs     Open Source Detects defects in Java code.
                           Other tools used to detect defects in other languages
SAVE         Research      Imports and visualizes dependency models tagged by similarity,
                           metrics, defects, knowledge.
                           Detects architecture violations (compares actual to planned).




                                      © 2012 Fraunhofer USA, Inc.
Example: Common Ground System (CGS)

• Ground System implemented in C/C++
• Developed by Johns Hopkins University/
  Applied Physics Laboratory (JHU/APL)
• 10 years old
• Product line for three different NASA
  missions
• Works well
• Software Quality is very important

                  © 2012 Fraunhofer USA, Inc.
Exploring actual architecture




            © 2012 Fraunhofer USA, Inc.
The Common Ground System
                                                  Assessment CSCI Telemetry Data Flow Diagram

       Web Data Server
                                                                     Requested                                         MOPs/ I&T
                                                                     Points File                                        Users
           Level 0 Data Files                   eng_dump
           Ancillary Products                                         Decommutated                                       1:N
                                                                        Points File
                                                                                         Plots
                                                                                                   Archived
                                ArchiveServer                                                      Telemetry               instant_ replay
                                 Directives                               Plotter                                             Directives Telemetry

                                                                                                 ArchiveServer
     gap_reporter      level_zero                                                                 Directives
                                                                                                                                instant_replay
                                          Archived
                                         Telemetry


   *Timekeeping                                                                          Sorted
      System                                                                                                                        Telemetry
                                                                        merger        Telemetry Pkt              indexer                                  spooler
                                                                                         Files &                                     Pkt Files
                                                                                        Indexes
            Archived
            Telemetry
                            archive_server                                                                                          Non-Real-
                                                                       Archive of                                                   TIme Pkt
                                                                       Pkts and                                                       Files             Real-Time
                                                                        Indexes                                                                         Telemetry
                                                                                                                                                         Packets
       Archived
      Telemetry
                    ArchiveServer                    ArchiveServer
                                     Archived          Directives
                     Directives
                                    Telemetry                                            Non-Real-Time Extracted
         SSC POC                        Planning &                                         Telemetry Packets
          Clients                       Scheduling
           1:N                             CSCI                                                                             Telemetry
                                                                                                                              CSCI

   *Timekeeping System expanded separately                                                                                                       LHerrera 08/03




    Manually drawn diagram from system documentation
                                                           © 2012 Fraunhofer USA, Inc.
A Typical application: eng_dump




    Automatically drawn diagram based on source code
                      © 2012 Fraunhofer USA, Inc.
eng_dump’s use of Common
                                                 App_Specific




 Automatically drawn diagram based on source code
                   © 2012 Fraunhofer USA, Inc.
Detecting high level violations




             © 2012 Fraunhofer USA, Inc.
The Common Ground System                        Assessment CSCI Telemetry Data Flow Diagram

     Web Data Server
                                                                   Requested                                          MOPs/ I&T
                                                                   Points File                                         Users
         Level 0 Data Files                   eng_dump
         Ancillary Products                                         Decommutated                                        1:N
                                                                      Points File
                                                                                        Plots
                                                                                                   Archived
                              ArchiveServer                                                       Telemetry               instant_ replay
                               Directives                               Plotter                                              Directives Telemetry

                                                                                                ArchiveServer
   gap_reporter      level_zero                                                                   Directives
                                                                                                                               instant_replay
                                        Archived
                                       Telemetry


 *Timekeeping                                                                              Sorted
    System                                                                                                                         Telemetry
                                                                      merger           Telemetry Pkt            indexer                                  spooler
                                                                                           Files &                                  Pkt Files
                                                                                          Indexes
          Archived
          Telemetry
                          archive_server                                                                                           Non-Real-
                                                                     Archive of                                                    TIme Pkt
                                                                     Pkts and                                                        Files             Real-Time
                                                                      Indexes                                                                          Telemetry
                                                                                                                                                        Packets
     Archived
    Telemetry
                  ArchiveServer                    ArchiveServer
                                  Archived          Directives
                   Directives
                                  Telemetry                                              Non-Real-Time Extracted
       SSC POC                        Planning &                                           Telemetry Packets
        Clients                       Scheduling
         1:N                            CSCI                                                                               Telemetry
                                                                                                                             CSCI
                                                            Common
  *Timekeeping System expanded separately                                                                                                       LHerrera 08/03


                                                         © 2012 Fraunhofer USA, Inc.
Violations of architecture:
            Common depends on eng_dump


               AS
                                   ED




Automatically drawn diagram (actual) based on source code
                               © 2012 Fraunhofer USA, Inc.
Checking Design Rules




       © 2012 Fraunhofer USA, Inc.
Planned Architecture: eng_dump




                                                                  Client
   Application-Specific
   Modules



Encapsulation of
client/server interface


Encapsulation of socket
communications


                 The socket




                    Manually drawn diagram based on design rule
                                    © 2012 Fraunhofer USA, Inc.
The Actual Architecture: eng_dump (“components” collapsed)




           Automatically drawn diagram based on source code
                              © 2012 Fraunhofer USA, Inc.
Mapping planned and actual using
            patterns




             © 2012 Fraunhofer USA, Inc.
The Actual Architecture vs. The Planned: eng_dump




                                                                 Client




                     Dependency
                     in planned,                             Dependency in
                     not in actual                           actual, not in
                                                             planned

                                                             Who does socket
                                                             communicate
                                                             with?




                               © 2012 Fraunhofer USA, Inc.
Adding Components and Layers
         to Common




           © 2012 Fraunhofer USA, Inc.
Common; across all applications




 Automatically drawn diagram based on source code
                   © 2012 Fraunhofer USA, Inc.
Suggested Target Architecture for Common




    Basic rule: A lower layer cannot access a higher layer

                 Manually drawn diagram
                        © 2012 Fraunhofer USA, Inc.
Components and Layers




Manual refactoring of files into components and layers
                      © 2012 Fraunhofer USA, Inc.
Layers with dependencies


 Let’s see how this target structure maps to the
             actual implementation




      Automatically drawn diagram, manual layout
                     © 2012 Fraunhofer USA, Inc.
Back links from lower layer to higher layer




      Automatically drawn diagram, manual layout
                     © 2012 Fraunhofer USA, Inc.
Analyzing embedded software




           © 2012 Fraunhofer USA, Inc.
Case Study: CARA Medical Device

          Blood Pressure
          Monitor




                                           CARA Software




                            31
                 © 2012 Fraunhofer USA, Inc.
Sample analysis needs at FDA
• What is the architecture of the software in general?
  – Is the software putrid?
• Where is a certain “Safety Function” located?
  – Is it present at all?
• Once located:
  – What is the quality of that “Safety Function”?
     • From various perspective (cloning, look and feel etc.)
  – Does the architecture allow for “modularized verification”
    of the “Safety Function”?
  – If not, can the architecture be refactored to facilitate
    verification using detailed but time-consuming static
    analysis tools?           32
                            © 2012 Fraunhofer USA, Inc.
Analysis Types
• Goal: Analysis of Architectural Quality
• Variability Management
  – OS/Hardware Abstraction
• Reverse architecture of module
  dependencies
• Reverse architecture of task dependencies
• Analysis of Testability


                              33
                   © 2012 Fraunhofer USA, Inc.
Summary Generator Output


 CARA has
• Several keywords of Windows libraries (e.g. windows.h)
• Several keywords of VxWorks libraries (e.g. vxworks.h)
• Multitasks because it has the taskSpawn keyword
• Inter-Process because it has msgQSend/Receive keywords
• Semaphores because it has semBCreate and semTake keywords
• GUI because it has keywords of GUI libraries (e.g. afxwin.h)




                                   34
                        © 2012 Fraunhofer USA, Inc.
Views of SAVE Light




                  35
       © 2012 Fraunhofer USA, Inc.
Analysis of OS Variability
• Fraunhofer has a knowledge base (KB) of
  OS functions/files for different OS types
• KB was used for CARA analysis
• Automatically identified OS types of
  CARA:
  – Vxworks
  – Simulation of Vxworks APIs using Windows
    APIs


                              36
                   © 2012 Fraunhofer USA, Inc.
Analysis of OS Variability
                                                #ifdef WIN32
sim.cpp                                           #include vxworsksim.h
src/AD_Reader.c                                 #endif
src/BP_Reader.c
src/CARA_CUII.c
src/CARA_Calculations.c
src/CARA_DA.c
src/CARA_Globals.c
src/CARA_Globals.h
src/CARA_Interface.c      CARA Architecture lacks an OS abstraction
src/CARA_Macroes.c
src/CARA_Main.c           OS concerns present in several files
src/CARA_Timer.c
src/CARA_Types.h
src/COM_Reader.cpp
src/VxWorksSim.h
src/dscud.h
                                      37
                           © 2012 Fraunhofer USA, Inc.
Analysis of OS Variability
   File Name                              Count of #if WIN32
   src/Interface.c                        40
   src/Cara_Main.c                        6
   src/Cara_DA.c                          5



• Unnecessary complexity to manage OS variants

• 40 #if could have been avoided if the architecture has an OSAL




                                    38
                         © 2012 Fraunhofer USA, Inc.
OSAL in NASA CFS
                                                       …




   …           …                       …           …



• One generic interface for different OS types
• Implementations for each OS type
• At build time developers can use the OS of interest


                                                           39
                     © 2012 Fraunhofer USA, Inc.
Summary of OS Variability
• CARA lacks an OSAL
  – Complexity to support Windows and Vxworks


• OS variability analysis helped the FDA to run
  CodeSonar (static analysis tool) on CARA

• Identification of the right compiler switch to
  overcome the missing Vxworks related files

                                40
                     © 2012 Fraunhofer USA, Inc.
Analysis of Hardware Abstraction
 Because the CARA system was targeted for a specific embedded
 system platform, test execution was not possible on
 the development machines.

 A test platform was prepared with facilities to simulate sensor inputs
 and monitor system responses.

 Initial difficulties setting up the test hardware postponed the start of
 testing for a number of months.

 Once these problems were addressed, there remained a limited
 amount of time available to test the increment.
                Snippet from CARA documentation


                                       41
                            © 2012 Fraunhofer USA, Inc.
Analysis of Hardware Abstraction
      double CARA_READ_EMF(void)
      {
      #ifndef TEST
        /* Read the EMF value from the A/D board. */
        float Actual_Value;

       Actual_Value = AD(EMF_CHANNEL);
       Actual_Value = (float)(Actual_Value * (-1.0));
       dprintf("EMF %fn", Actual_Value);

        return (double) Actual_Value;
      #else
        return CARA_EMF_VALUE;
      #endif
      }
   Lack of hardware abstraction layer (HAL)

   Testing could have been facilitated better with HAL (e.g. Stubs)
                                      42
                           © 2012 Fraunhofer USA, Inc.
Extraction of Runtime Views
• Pool of relations are semi-automatically
  extracted using our KB and regular
  expressions
• Extracted relations are stored in a
  relational database (text file)
• Relational algebraic operators (e.g.,
  Union, Transitive Closure) are used to
  extract runtime views

                              43
                   © 2012 Fraunhofer USA, Inc.
Task creation view
                     <<optional>>                            <<optional>>              <<optional>>



                     BP_Reader                                   AD_Reader                 COM_Reader

                                      CARA_Main




                                                                                                CARA_KVO_SERVICE


CARA_B2B_Broker CARA_CUII_Svc CARA_Log_Svc CARA_Display_Svc CARA_Warn_Svc               CARA_Alarm_Svc




                                                                              Task


                                                                             Creation of Task


                                                       44
                                            © 2012 Fraunhofer USA, Inc.
Task-Queue-Task View
         <<optional>>



        BP_Reader                                                                  Read from msg queue
                                                                                   Write to msg queue


                                                                                   Task
CARA_B2B_Broker              BP_Reader_Q_ID



    CARA_CUII_Svc             CUII_MSGQ_ID




                             CARA_MSGQ_ID
      CARA_Main


                             CARA_LOGQ_ID                    CARA_Log_Svc



                              CARA_DSPQ_ID
                                                           CARA_Display_Svc
                    <<optional>>   <<optional>>


                                              45
  CARA_Warn_Svc      AD_Reader     COM_Reader                CARA_KVO_SERVICE CARA_Alarm_Svc
                                   © 2012 Fraunhofer USA, Inc.
Task-Queue-Task View
• Useful to reason about overall complexity

• Useful to reason about testability of each
  task
  – Can tasks be unit tested independently?


• Tasks also communicate using shared
  variables (see demo)
                               46
                    © 2012 Fraunhofer USA, Inc.
Identifying high risk sw modules by
       combining information

            Structures
             Defects
             Clones


              © 2012 Fraunhofer USA, Inc.
High Level Architecture




• The high level architecture seems fairly
  organized and clean, there are however worries
  on the left
© 2007 Fraunhofer               48
CESE
                     © 2012 Fraunhofer USA, Inc.
High Priority Bugs
                                                                 1



          118
                       52                           19               2   14       2




  23

                                                9                             1


  29                                                                          9




• Number of high priority bugs for each high level component
       – mocclient is the most buggy package with 118 bugs
       – dsdm, shareclient, and oamclient also contain many highly severe bugs
© 2007 Fraunhofer                             49
CESE
                                   © 2012 Fraunhofer USA, Inc.
Duplicates
                                  Cloned bugs




                                                                   3
                                                               3
            89                        3                                3




• Number of duplicates shared among high level components
  (duplicate dependencies)
     – mocclient and oamclient share most duplicates
     – snif shares duplicates with many other components
     – Same high priority FindBugs bug in several cloned files
© 2007 Fraunhofer                     50
CESE
                                 © 2012 Fraunhofer USA, Inc.
Conclusion
• Overview of reverse engineering
• Knowledge based reverse engineering is a simple,
  yet promising idea
• Architectural analysis offers complementary views
  on FDA’s static analysis
  – Helps to configure static analysis
  – Helps to plan static analysis on small portions
• Detected issues of CARA
  – Lack of OS abstraction layer
  – Lack of hardware abstraction layer
  – File structure and task structure are not symmetric


                                   51
                        © 2012 Fraunhofer USA, Inc.
Summary
• Architecture can be reverse engineered using
  external dependencies
• Multiple views are required to reason about
  software quality
• Specified architecture can be compared with the
  actual architecture
• Fraunhofer has wealth of experience in: Product
  Line, Architecture, and Reverse Engineering



                   © 2012 Fraunhofer USA, Inc.
Sample Publications
• Developing an Approach for Analyzing and Verifying System
  Communication, The Aerospace conference, 2009
• Verifying Architectural Design Rules of the Flight Software Product
  Line, The Software Product Line Conference (SPLC), 2009
• Connecting Research and Practice: An Experience Report on
  Research Infusion with SAVE, Innovations in Systems and Software
  Engineering a NASA Journal, 2010
• D. Ganesan. Software Architecture Discovery for Testability,
  Performance, and Maintainability of Industrial Systems. PhD Thesis,
  Vrije Universiteit Amsterdam, 2012
  (http://dare.ubvu.vu.nl/handle/1871/32693)




                             © 2012 Fraunhofer USA, Inc.
Contact information
• www.fc-md.umd.edu

• Mikael Lindvall
  – 240-487-2902
  – mlindvall@fc-md.umd.edu


• Dharma Ganesan
  – 240-487-2915
  – dganesan@fc-md.umd.edu
                    © 2012 Fraunhofer USA, Inc.

More Related Content

PPTX
GitHub Copilot.pptx
PPTX
Jenkins Pipeline Tutorial | Jenkins Build And Delivery Pipeline | Jenkins Tut...
PDF
Agile Integration eBook from 2018
PDF
Club Urba-EA - Architecture d'entreprise et projets agiles
PPTX
TPE Aide à la problématique
PDF
Les Français et le Métavers
DOCX
Office 365 Project Online - Comprehensive Guide
PDF
Démarche mise en place de référentiel d'architecture
GitHub Copilot.pptx
Jenkins Pipeline Tutorial | Jenkins Build And Delivery Pipeline | Jenkins Tut...
Agile Integration eBook from 2018
Club Urba-EA - Architecture d'entreprise et projets agiles
TPE Aide à la problématique
Les Français et le Métavers
Office 365 Project Online - Comprehensive Guide
Démarche mise en place de référentiel d'architecture

What's hot (15)

PPTX
Support at scale in a DevOps world How Swarming and Cynefin can save you from...
PDF
Exemple de charte graphique
PDF
The 15 ITIL Steps to DBaaS in the Cloud
PPTX
Building a strong Data Management capability with TOGAF and ArchiMate
PDF
Randy Shoup eBays Architectural Principles
PDF
Modéliser avec ARCHIMATE 3.1®
PDF
Point de vente ( Odoo )
PDF
Amazon Web service Aws
PDF
La narration transmedia : les enjeux d'une nouvelle expérience créative. Sibe...
PPTX
A new IT Operating Model Emerges
PDF
Azure DevOps Tutorial | Developing CI/ CD Pipelines On Azure | Edureka
PDF
EA Intensive Course "Building Enterprise Architecture" by mr.danairat
PDF
Maximising The Value and Benefits of Enterprise Architecture
PDF
Plaquette présentation ssii project si
PDF
An Introduction to the Agile SoC
Support at scale in a DevOps world How Swarming and Cynefin can save you from...
Exemple de charte graphique
The 15 ITIL Steps to DBaaS in the Cloud
Building a strong Data Management capability with TOGAF and ArchiMate
Randy Shoup eBays Architectural Principles
Modéliser avec ARCHIMATE 3.1®
Point de vente ( Odoo )
Amazon Web service Aws
La narration transmedia : les enjeux d'une nouvelle expérience créative. Sibe...
A new IT Operating Model Emerges
Azure DevOps Tutorial | Developing CI/ CD Pipelines On Azure | Edureka
EA Intensive Course "Building Enterprise Architecture" by mr.danairat
Maximising The Value and Benefits of Enterprise Architecture
Plaquette présentation ssii project si
An Introduction to the Agile SoC
Ad

Viewers also liked (20)

PPT
Capacity 1
PPTX
Measurement System Analysis
PPT
Reverse engineering
PPT
Line balancing
PPTX
Measuring capacity lesson3
PPT
Unit 1 Service Operations Management
PPTX
intra and inter personal relations
PPT
Legacy Software Maintenance And Management
PPTX
Reverse engineering
PPTX
Maintenance, Re-engineering &Reverse Engineering in Software Engineering
PPTX
Software reverse engineering
PPTX
Tools for capacity planning, measurement of capacity, capacity planning process
PDF
Reverse Engineering
PPT
reverse engineering
PDF
Reverse engineering
PPTX
Service Operation - Manajemen Layanan Teknologi Informasi
PPT
Facility layout
PPT
Capacity Management
PDF
Service Operation Processes
PPTX
Capacity Planning with Free Tools
Capacity 1
Measurement System Analysis
Reverse engineering
Line balancing
Measuring capacity lesson3
Unit 1 Service Operations Management
intra and inter personal relations
Legacy Software Maintenance And Management
Reverse engineering
Maintenance, Re-engineering &Reverse Engineering in Software Engineering
Software reverse engineering
Tools for capacity planning, measurement of capacity, capacity planning process
Reverse Engineering
reverse engineering
Reverse engineering
Service Operation - Manajemen Layanan Teknologi Informasi
Facility layout
Capacity Management
Service Operation Processes
Capacity Planning with Free Tools
Ad

Similar to Reverse Engineering of Software Architecture (20)

PPTX
Verifying Architectural Design Rules of a Flight Software Product Line
PPTX
Architecture Analysis of Systems based on Publish-Subscribe Systems
PDF
fiwalk With Me: Building Emergent Pre-Ingest Workflows for Digital Archival R...
ODP
Nagios Conference 2012 - Dave Josephsen - 2002 called they want there rrd she...
PPTX
5 chap - MAINTENANCE
PDF
Tetradyn Law Enforce Introduction11nov08
PDF
digitalSTROM Server Development
PPSX
SeCold - A Linked Data Platform for Mining Software Repositories
PPTX
Analysis of Testability of a Flight Software Product Line
PDF
Pattern: an open source project for migrating predictive models onto Apache H...
PPTX
Centralizing sequence analysis
PDF
Philly DB MapR Overview
PPTX
Profiling Multicore Systems to Maximize Core Utilization
PPT
Creating an RAD Authoratative Data Environment
PDF
Thesis presentation: Middleware for Ubicomp - A Model Driven Development Appr...
PDF
SDE - Dynamic Analysis
PDF
Sensor Data Management
PDF
the UPS protoproto project
PDF
EventStudio: Sequence Diagram Based System Modeling Tool
Verifying Architectural Design Rules of a Flight Software Product Line
Architecture Analysis of Systems based on Publish-Subscribe Systems
fiwalk With Me: Building Emergent Pre-Ingest Workflows for Digital Archival R...
Nagios Conference 2012 - Dave Josephsen - 2002 called they want there rrd she...
5 chap - MAINTENANCE
Tetradyn Law Enforce Introduction11nov08
digitalSTROM Server Development
SeCold - A Linked Data Platform for Mining Software Repositories
Analysis of Testability of a Flight Software Product Line
Pattern: an open source project for migrating predictive models onto Apache H...
Centralizing sequence analysis
Philly DB MapR Overview
Profiling Multicore Systems to Maximize Core Utilization
Creating an RAD Authoratative Data Environment
Thesis presentation: Middleware for Ubicomp - A Model Driven Development Appr...
SDE - Dynamic Analysis
Sensor Data Management
the UPS protoproto project
EventStudio: Sequence Diagram Based System Modeling Tool

More from Dharmalingam Ganesan (20)

PDF
.NET Deserialization Attacks
PDF
Reverse Architecting using Relation Algebra.pdf
PDF
How to exploit rand()?
PDF
Cyclic Attacks on the RSA Trapdoor Function
PDF
An Analysis of RSA Public Exponent e
PDF
An Analysis of Secure Remote Password (SRP)
PDF
Thank-a-Gram
PDF
Active Attacks on DH Key Exchange
PDF
Can I write to a read only file ?
PPTX
How do computers exchange secrets using Math?
PDF
On the Secrecy of RSA Private Keys
PDF
Computing the Square Roots of Unity to break RSA using Quantum Algorithms
PDF
Analysis of Short RSA Secret Exponent d
PDF
Dependency Analysis of RSA Private Variables
PDF
Analysis of Shared RSA Modulus
PDF
RSA Game using an Oracle
PDF
RSA Two Person Game
PDF
RSA without Integrity Checks
PPTX
RSA without Padding
PDF
Solutions to online rsa factoring challenges
.NET Deserialization Attacks
Reverse Architecting using Relation Algebra.pdf
How to exploit rand()?
Cyclic Attacks on the RSA Trapdoor Function
An Analysis of RSA Public Exponent e
An Analysis of Secure Remote Password (SRP)
Thank-a-Gram
Active Attacks on DH Key Exchange
Can I write to a read only file ?
How do computers exchange secrets using Math?
On the Secrecy of RSA Private Keys
Computing the Square Roots of Unity to break RSA using Quantum Algorithms
Analysis of Short RSA Secret Exponent d
Dependency Analysis of RSA Private Variables
Analysis of Shared RSA Modulus
RSA Game using an Oracle
RSA Two Person Game
RSA without Integrity Checks
RSA without Padding
Solutions to online rsa factoring challenges

Recently uploaded (20)

PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
KodekX | Application Modernization Development
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
Cloud computing and distributed systems.
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Approach and Philosophy of On baking technology
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PPTX
Programs and apps: productivity, graphics, security and other tools
PPTX
MYSQL Presentation for SQL database connectivity
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPT
Teaching material agriculture food technology
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Network Security Unit 5.pdf for BCA BBA.
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Unlocking AI with Model Context Protocol (MCP)
KodekX | Application Modernization Development
Review of recent advances in non-invasive hemoglobin estimation
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Cloud computing and distributed systems.
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Chapter 3 Spatial Domain Image Processing.pdf
Approach and Philosophy of On baking technology
NewMind AI Weekly Chronicles - August'25 Week I
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Programs and apps: productivity, graphics, security and other tools
MYSQL Presentation for SQL database connectivity
The Rise and Fall of 3GPP – Time for a Sabbatical?
Teaching material agriculture food technology
sap open course for s4hana steps from ECC to s4
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Network Security Unit 5.pdf for BCA BBA.

Reverse Engineering of Software Architecture

  • 1. Software Architecture in Evolution and Reverse Engineering of Legacy systems Mikael Lindvall, Dharma Ganesan Software Architecture and Embedded Systems division Fraunhofer Center for Experimental Software Engineering Maryland (FC-MD) © 2012 Fraunhofer USA, Inc.
  • 2. Your Presenters Mikael Lindvall, PhD Dharma Ganesan, PhD • Division director, more than 13 • Research scientist, more than 8 years at FC-MD, co-invented FC- years at FC-MD, co-invented FC- MD’s reverse engineering MD’s reverse engineering and approach, analyzed e.g. NASA’s testing approach, analyzed Space Network (10 MLOC ADA, NASA’s Core Flight Software, C++ etc). Review board member GMSEC, Climate Modeling for SN replacement system System etc. etc. (SGSS). © 2012 Fraunhofer USA, Inc.
  • 3. Fraunhofer Center – Maryland (FC-MD) • Applied Research and Tech Transfer, non-profit – US incorporated • Affiliated with – University of Maryland, College Park – Fraunhofer Germany • Close to ties to NASA – Goddard Space Flight Center around the corner • Focus on Software Engineering – Especially Software Quality • Business model: Applied research services © 2012 Fraunhofer USA, Inc.
  • 4. Fraunhofer Center – Maryland (FC-MD) at MSquare © 2012 Fraunhofer USA, Inc.
  • 5. Clients ask Fraunhofer to determine • If their sw architecture/design rules are met • The risk involved if they change the software • If their software meet certain regulations • If their software has defects • If their software is efficient • Etc. etc. Today: How reverse engineering can be used to deal with legacy systems using different kinds of examples on different systems © 2012 Fraunhofer USA, Inc.
  • 6. Reverse Engineering at Fraunhofer • Developed an approach to analyze, visualize and describe legacy software – Structure and behavior – Methods and tools – Support from NASA IV&V • Analyzed legacy software systems e.g. – NASA’s Space Network (Ground segment) – NASA’s Core Flight Software – NASA’s GMSEC • More than 10 years © 2012 Fraunhofer USA, Inc.
  • 7. Background: Software architecture • Software architecture (SA) deals with components, connectors, and protocols • SA is a multi-dimensional artifact – Each dimension corresponds to one concern (e.g. Database interaction concern) • SA is represented by a collection of views – Development/Implementation view – Runtime view 7 © 2012 Fraunhofer USA, Inc.
  • 8. Our Model of SA and RE • Development views – Components of a development view • Directories/files/functions/database tables – Connectors of a development view • Function calls, includes, variable accesses, etc. • Runtime views – Components of a runtime view • Tasks, Processes – Connectors of a runtime view • Sockets, Queues, Shared Memory, Software Bus etc. • Create views from source code to answer questions! 8 © 2012 Fraunhofer USA, Inc.
  • 9. The Fraunhofer RE Method • Software architecture is influenced and inspired by external entities (EE) – Programming language libraries – COTS and Frameworks • Reverse Engineering is driven by EE • A knowledge base of EE based on ~24 real-world systems – Several NASA systems and other companies 9 © 2012 Fraunhofer USA, Inc.
  • 10. SAVE Sample Software Architecture Visualization and Evaluation Tools (Depends on development environment) Tool Type Purpose Understand Commercial Extracts code-level dependencies and metrics from source code RPA Research Queries the dependency models using relational algebra Prefuse Research Visualizes the content of the knowledge base Similarity Research Determines similarity among files FindBugs Open Source Detects defects in Java code. Other tools used to detect defects in other languages SAVE Research Imports and visualizes dependency models tagged by similarity, metrics, defects, knowledge. Detects architecture violations (compares actual to planned). © 2012 Fraunhofer USA, Inc.
  • 11. Example: Common Ground System (CGS) • Ground System implemented in C/C++ • Developed by Johns Hopkins University/ Applied Physics Laboratory (JHU/APL) • 10 years old • Product line for three different NASA missions • Works well • Software Quality is very important © 2012 Fraunhofer USA, Inc.
  • 12. Exploring actual architecture © 2012 Fraunhofer USA, Inc.
  • 13. The Common Ground System Assessment CSCI Telemetry Data Flow Diagram Web Data Server Requested MOPs/ I&T Points File Users Level 0 Data Files eng_dump Ancillary Products Decommutated 1:N Points File Plots Archived ArchiveServer Telemetry instant_ replay Directives Plotter Directives Telemetry ArchiveServer gap_reporter level_zero Directives instant_replay Archived Telemetry *Timekeeping Sorted System Telemetry merger Telemetry Pkt indexer spooler Files & Pkt Files Indexes Archived Telemetry archive_server Non-Real- Archive of TIme Pkt Pkts and Files Real-Time Indexes Telemetry Packets Archived Telemetry ArchiveServer ArchiveServer Archived Directives Directives Telemetry Non-Real-Time Extracted SSC POC Planning & Telemetry Packets Clients Scheduling 1:N CSCI Telemetry CSCI *Timekeeping System expanded separately LHerrera 08/03 Manually drawn diagram from system documentation © 2012 Fraunhofer USA, Inc.
  • 14. A Typical application: eng_dump Automatically drawn diagram based on source code © 2012 Fraunhofer USA, Inc.
  • 15. eng_dump’s use of Common App_Specific Automatically drawn diagram based on source code © 2012 Fraunhofer USA, Inc.
  • 16. Detecting high level violations © 2012 Fraunhofer USA, Inc.
  • 17. The Common Ground System Assessment CSCI Telemetry Data Flow Diagram Web Data Server Requested MOPs/ I&T Points File Users Level 0 Data Files eng_dump Ancillary Products Decommutated 1:N Points File Plots Archived ArchiveServer Telemetry instant_ replay Directives Plotter Directives Telemetry ArchiveServer gap_reporter level_zero Directives instant_replay Archived Telemetry *Timekeeping Sorted System Telemetry merger Telemetry Pkt indexer spooler Files & Pkt Files Indexes Archived Telemetry archive_server Non-Real- Archive of TIme Pkt Pkts and Files Real-Time Indexes Telemetry Packets Archived Telemetry ArchiveServer ArchiveServer Archived Directives Directives Telemetry Non-Real-Time Extracted SSC POC Planning & Telemetry Packets Clients Scheduling 1:N CSCI Telemetry CSCI Common *Timekeeping System expanded separately LHerrera 08/03 © 2012 Fraunhofer USA, Inc.
  • 18. Violations of architecture: Common depends on eng_dump AS ED Automatically drawn diagram (actual) based on source code © 2012 Fraunhofer USA, Inc.
  • 19. Checking Design Rules © 2012 Fraunhofer USA, Inc.
  • 20. Planned Architecture: eng_dump Client Application-Specific Modules Encapsulation of client/server interface Encapsulation of socket communications The socket Manually drawn diagram based on design rule © 2012 Fraunhofer USA, Inc.
  • 21. The Actual Architecture: eng_dump (“components” collapsed) Automatically drawn diagram based on source code © 2012 Fraunhofer USA, Inc.
  • 22. Mapping planned and actual using patterns © 2012 Fraunhofer USA, Inc.
  • 23. The Actual Architecture vs. The Planned: eng_dump Client Dependency in planned, Dependency in not in actual actual, not in planned Who does socket communicate with? © 2012 Fraunhofer USA, Inc.
  • 24. Adding Components and Layers to Common © 2012 Fraunhofer USA, Inc.
  • 25. Common; across all applications Automatically drawn diagram based on source code © 2012 Fraunhofer USA, Inc.
  • 26. Suggested Target Architecture for Common Basic rule: A lower layer cannot access a higher layer Manually drawn diagram © 2012 Fraunhofer USA, Inc.
  • 27. Components and Layers Manual refactoring of files into components and layers © 2012 Fraunhofer USA, Inc.
  • 28. Layers with dependencies Let’s see how this target structure maps to the actual implementation Automatically drawn diagram, manual layout © 2012 Fraunhofer USA, Inc.
  • 29. Back links from lower layer to higher layer Automatically drawn diagram, manual layout © 2012 Fraunhofer USA, Inc.
  • 30. Analyzing embedded software © 2012 Fraunhofer USA, Inc.
  • 31. Case Study: CARA Medical Device Blood Pressure Monitor CARA Software 31 © 2012 Fraunhofer USA, Inc.
  • 32. Sample analysis needs at FDA • What is the architecture of the software in general? – Is the software putrid? • Where is a certain “Safety Function” located? – Is it present at all? • Once located: – What is the quality of that “Safety Function”? • From various perspective (cloning, look and feel etc.) – Does the architecture allow for “modularized verification” of the “Safety Function”? – If not, can the architecture be refactored to facilitate verification using detailed but time-consuming static analysis tools? 32 © 2012 Fraunhofer USA, Inc.
  • 33. Analysis Types • Goal: Analysis of Architectural Quality • Variability Management – OS/Hardware Abstraction • Reverse architecture of module dependencies • Reverse architecture of task dependencies • Analysis of Testability 33 © 2012 Fraunhofer USA, Inc.
  • 34. Summary Generator Output CARA has • Several keywords of Windows libraries (e.g. windows.h) • Several keywords of VxWorks libraries (e.g. vxworks.h) • Multitasks because it has the taskSpawn keyword • Inter-Process because it has msgQSend/Receive keywords • Semaphores because it has semBCreate and semTake keywords • GUI because it has keywords of GUI libraries (e.g. afxwin.h) 34 © 2012 Fraunhofer USA, Inc.
  • 35. Views of SAVE Light 35 © 2012 Fraunhofer USA, Inc.
  • 36. Analysis of OS Variability • Fraunhofer has a knowledge base (KB) of OS functions/files for different OS types • KB was used for CARA analysis • Automatically identified OS types of CARA: – Vxworks – Simulation of Vxworks APIs using Windows APIs 36 © 2012 Fraunhofer USA, Inc.
  • 37. Analysis of OS Variability #ifdef WIN32 sim.cpp #include vxworsksim.h src/AD_Reader.c #endif src/BP_Reader.c src/CARA_CUII.c src/CARA_Calculations.c src/CARA_DA.c src/CARA_Globals.c src/CARA_Globals.h src/CARA_Interface.c CARA Architecture lacks an OS abstraction src/CARA_Macroes.c src/CARA_Main.c OS concerns present in several files src/CARA_Timer.c src/CARA_Types.h src/COM_Reader.cpp src/VxWorksSim.h src/dscud.h 37 © 2012 Fraunhofer USA, Inc.
  • 38. Analysis of OS Variability File Name Count of #if WIN32 src/Interface.c 40 src/Cara_Main.c 6 src/Cara_DA.c 5 • Unnecessary complexity to manage OS variants • 40 #if could have been avoided if the architecture has an OSAL 38 © 2012 Fraunhofer USA, Inc.
  • 39. OSAL in NASA CFS … … … … … • One generic interface for different OS types • Implementations for each OS type • At build time developers can use the OS of interest 39 © 2012 Fraunhofer USA, Inc.
  • 40. Summary of OS Variability • CARA lacks an OSAL – Complexity to support Windows and Vxworks • OS variability analysis helped the FDA to run CodeSonar (static analysis tool) on CARA • Identification of the right compiler switch to overcome the missing Vxworks related files 40 © 2012 Fraunhofer USA, Inc.
  • 41. Analysis of Hardware Abstraction Because the CARA system was targeted for a specific embedded system platform, test execution was not possible on the development machines. A test platform was prepared with facilities to simulate sensor inputs and monitor system responses. Initial difficulties setting up the test hardware postponed the start of testing for a number of months. Once these problems were addressed, there remained a limited amount of time available to test the increment. Snippet from CARA documentation 41 © 2012 Fraunhofer USA, Inc.
  • 42. Analysis of Hardware Abstraction double CARA_READ_EMF(void) { #ifndef TEST /* Read the EMF value from the A/D board. */ float Actual_Value; Actual_Value = AD(EMF_CHANNEL); Actual_Value = (float)(Actual_Value * (-1.0)); dprintf("EMF %fn", Actual_Value); return (double) Actual_Value; #else return CARA_EMF_VALUE; #endif } Lack of hardware abstraction layer (HAL) Testing could have been facilitated better with HAL (e.g. Stubs) 42 © 2012 Fraunhofer USA, Inc.
  • 43. Extraction of Runtime Views • Pool of relations are semi-automatically extracted using our KB and regular expressions • Extracted relations are stored in a relational database (text file) • Relational algebraic operators (e.g., Union, Transitive Closure) are used to extract runtime views 43 © 2012 Fraunhofer USA, Inc.
  • 44. Task creation view <<optional>> <<optional>> <<optional>> BP_Reader AD_Reader COM_Reader CARA_Main CARA_KVO_SERVICE CARA_B2B_Broker CARA_CUII_Svc CARA_Log_Svc CARA_Display_Svc CARA_Warn_Svc CARA_Alarm_Svc Task Creation of Task 44 © 2012 Fraunhofer USA, Inc.
  • 45. Task-Queue-Task View <<optional>> BP_Reader Read from msg queue Write to msg queue Task CARA_B2B_Broker BP_Reader_Q_ID CARA_CUII_Svc CUII_MSGQ_ID CARA_MSGQ_ID CARA_Main CARA_LOGQ_ID CARA_Log_Svc CARA_DSPQ_ID CARA_Display_Svc <<optional>> <<optional>> 45 CARA_Warn_Svc AD_Reader COM_Reader CARA_KVO_SERVICE CARA_Alarm_Svc © 2012 Fraunhofer USA, Inc.
  • 46. Task-Queue-Task View • Useful to reason about overall complexity • Useful to reason about testability of each task – Can tasks be unit tested independently? • Tasks also communicate using shared variables (see demo) 46 © 2012 Fraunhofer USA, Inc.
  • 47. Identifying high risk sw modules by combining information Structures Defects Clones © 2012 Fraunhofer USA, Inc.
  • 48. High Level Architecture • The high level architecture seems fairly organized and clean, there are however worries on the left © 2007 Fraunhofer 48 CESE © 2012 Fraunhofer USA, Inc.
  • 49. High Priority Bugs 1 118 52 19 2 14 2 23 9 1 29 9 • Number of high priority bugs for each high level component – mocclient is the most buggy package with 118 bugs – dsdm, shareclient, and oamclient also contain many highly severe bugs © 2007 Fraunhofer 49 CESE © 2012 Fraunhofer USA, Inc.
  • 50. Duplicates Cloned bugs 3 3 89 3 3 • Number of duplicates shared among high level components (duplicate dependencies) – mocclient and oamclient share most duplicates – snif shares duplicates with many other components – Same high priority FindBugs bug in several cloned files © 2007 Fraunhofer 50 CESE © 2012 Fraunhofer USA, Inc.
  • 51. Conclusion • Overview of reverse engineering • Knowledge based reverse engineering is a simple, yet promising idea • Architectural analysis offers complementary views on FDA’s static analysis – Helps to configure static analysis – Helps to plan static analysis on small portions • Detected issues of CARA – Lack of OS abstraction layer – Lack of hardware abstraction layer – File structure and task structure are not symmetric 51 © 2012 Fraunhofer USA, Inc.
  • 52. Summary • Architecture can be reverse engineered using external dependencies • Multiple views are required to reason about software quality • Specified architecture can be compared with the actual architecture • Fraunhofer has wealth of experience in: Product Line, Architecture, and Reverse Engineering © 2012 Fraunhofer USA, Inc.
  • 53. Sample Publications • Developing an Approach for Analyzing and Verifying System Communication, The Aerospace conference, 2009 • Verifying Architectural Design Rules of the Flight Software Product Line, The Software Product Line Conference (SPLC), 2009 • Connecting Research and Practice: An Experience Report on Research Infusion with SAVE, Innovations in Systems and Software Engineering a NASA Journal, 2010 • D. Ganesan. Software Architecture Discovery for Testability, Performance, and Maintainability of Industrial Systems. PhD Thesis, Vrije Universiteit Amsterdam, 2012 (http://dare.ubvu.vu.nl/handle/1871/32693) © 2012 Fraunhofer USA, Inc.
  • 54. Contact information • www.fc-md.umd.edu • Mikael Lindvall – 240-487-2902 – mlindvall@fc-md.umd.edu • Dharma Ganesan – 240-487-2915 – dganesan@fc-md.umd.edu © 2012 Fraunhofer USA, Inc.