Fuzz: Introduction to instrumentation technology

definition

Instrumentation is a technology for testing program performance, detecting errors, and obtaining program execution information. Instrumentation technology was first proposed by JC Huang [3]. On the basis of ensuring the original logical integrity of the program under test, some probes are inserted into the program, that is, some codes are added to obtain the control flow and data flow information of the program. For example, through automatic tools or manually, insert the code to read the timer before and after the function is executed to obtain the function execution time.

Classification

  • According to different instrumentation objects, it is divided into source code instrumentation and binary instrumentation.
  • According to different granularities, it is divided into instruction level instrumentation, function level instrumentation, basic block level instrumentation, and boundary level instrumentation.
  • According to different analysis methods, it is divided into static instrumentation and dynamic instrumentation.

use

  • Statement coverage probe: Probes are implanted at the entrance and exit of the basic block to determine whether the block is covered at runtime.
  • Branch coverage probe: Same as above.
  • Conditional coverage probe: Insert probes after conditional expressions such as if, switch, while, etc., and perform variable tracking and fetching to determine whether they are covered.

Dynamic binary instrumentation

execution mode

Most dynamic binary instrumentation has three execution modes:

  • JIT (Just-In-Time) mode: Generate a copy of the modified binary execution part in a new memory area and then execute it.
  • Interpretation mode: The user implements a lookup table, and each instruction of the binary file is mapped in the lookup table and executed.
  • Detection mode: Use new instructions to overwrite old instructions to achieve modification purposes.

Pin frame analysis

Insert image description here
Reference: Intel Pin Architecture

Guess you like

Origin blog.csdn.net/weixin_43249758/article/details/125891517