Dynamic program analysis explained

Dynamic program analysis is the act of analyzing software that involves executing a program as opposed to static program analysis, which does not execute it.

Analysis can focus on different aspects of the software including but not limited to: behavior, test coverage, performance and security.

To be effective, the target program must be executed with sufficient test inputs[1] to address the ranges of possible inputs and outputs. Software testing measures, such as code coverage, and tools such as mutation testing, are used to identify where testing is inadequate.

Types

Functional testing

See main article: Software testing.

Functional testing includes relatively common programming techniques such as unit testing, integration testing and system testing.[2]

Code coverage

Computing the code coverage of a test identifies code that is not tested; not covered by a test.

Although this analysis identifies code that is not tested it does not determine whether tested coded is adequately tested. Code can be executed even if the tests do not actually verify correct behavior.

Dynamic testing

See main article: Dynamic testing.

Dynamic testing involves executing a program on a set of test cases.

Memory error detection

Fuzzing

See main article: Fuzzing. Fuzzing is a testing technique that involves executing a program on a wide variety of inputs; often these inputs are randomly generated (at least in part). Gray-box fuzzers use code coverage to guide input generation.

Dynamic symbolic execution

See main article: Concolic testing.

Dynamic symbolic execution (also known as DSE or concolic execution) involves executing a test program on a concrete input, collecting the path constraints associated with the execution, and using a constraint solver (generally, an SMT solver) to generate new inputs that would cause the program to take a different control-flow path, thus increasing code coverage of the test suite.[3] DSE can considered a type of fuzzing ("white-box" fuzzing).

Dynamic data-flow analysis

Dynamic data-flow analysis tracks the flow of information from sources to sinks. Forms of dynamic data-flow analysis include dynamic taint analysis and even dynamic symbolic execution.[4] [5]

Invariant inference

Daikon is an implementation of dynamic invariant detection. Daikon runs a program, observes the values thatthe program computes, and then reports properties that were true over the observed executions, and thus likely true over all executions.

Security analysis

Dynamic analysis can be used to detect security problems.

Concurrency errors

Program slicing

See main article: Program slicing. For a given subset of a program’s behavior, program slicing consists of reducing the program to the minimum form that still produces the selected behavior. The reduced program is called a “slice” and is a faithful representation of the original program within the domain of the specified behavior subset.Generally, finding a slice is an unsolvable problem, but by specifying the target behavior subset by the values of a set of variables, it is possible to obtain approximate slices using a data-flow algorithm. These slices are usually used by developers during debugging to locate the source of errors.

Performance analysis

Most performance analysis tools use dynamic program analysis techniques.

Techniques

Most dynamic analysis involves instrumentation or transformation.

Since instrumentation can affect runtime performance, interpretation of test results must account for this to avoid misidentifying a performance problem.

Examples

DynInst is a runtime code-patching library that is useful in developing dynamic program analysis probes and applying them to compiled executables. Dyninst does not require source code or recompilation in general, however, non-stripped executables and executables with debugging symbols are easier to instrument.

Iroh.js is a runtime code analysis library for JavaScript. It keeps track of the code execution path, provides runtime listeners to listen for specific executed code patterns and allows the interception and manipulation of the program's execution behavior.

See also

Notes and References

  1. Khatiwada. Saket. Tushev. Miroslav. Mahmoud. Anas. 2018-01-01. Just enough semantics: An information theoretic approach for IR-based software bug localization. Information and Software Technology. en. 93. 45–57. 10.1016/j.infsof.2017.08.012.
  2. Book: Myers, G. J. . The Art of Software Testing . 1979 . John Wiley and Sons.. Glenford Myers .
  3. Chen . Ting . Zhang . Xiao-song . Guo . Shi-ze . Li . Hong-yuan . Wu . Yue . 2013-09-01 . State of the art: Dynamic symbolic execution for automated test generation . Future Generation Computer Systems . Including Special sections: Cyber-enabled Distributed Computing for Ubiquitous Cloud and Network Services & Cloud Computing and Scientific Applications — Big Data, Scalable Analytics, and Beyond . en . 29 . 7 . 1758–1773 . 10.1016/j.future.2012.02.006 . 0167-739X.
  4. Book: Chen . Ju . Han . Wookhyun . Yin . Mingjun . Zeng . Haochen . Song . Chengyu . Lee . Byoungyoung . Yin . Heng . Shin . Insik . 2022 . : Time and Space Efficient Concolic Execution via Dynamic Data-flow Analysis . en . 2531–2548 . 978-1-939133-31-1.
  5. Book: Chang . Walter . Streiff . Brandon . Lin . Calvin . Proceedings of the 15th ACM conference on Computer and communications security . Efficient and extensible security enforcement using dynamic data flow analysis . 2008-10-27 . https://doi.org/10.1145/1455770.1455778 . CCS '08 . New York, NY, USA . Association for Computing Machinery . 39–50 . 10.1145/1455770.1455778 . 978-1-59593-810-7. 6888893 .