Program structure sensitive engine task division method and system in parallel fuzzy test scene
Use static analysis and dynamic behavior capture technology to identify exploration tasks that are sensitive to program structure, optimize the parallel fuzz testing process, solve the problems of high task repeatability and system redundancy, and improve testing efficiency and vulnerability discovery capabilities.
Patent Information
- Application Number
- CN202410385813.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-01
- Publication Date
- 2024-08-23
AI Technical Summary
In existing parallel fuzz testing, tasks are highly repetitive, system exploration redundancy is large, and task division is insensitive to program structure, resulting in low testing efficiency and missed vulnerabilities.
Use the instrumentation method that combines static analysis and dynamic behavior capture to build a control flow graph, monitor basic block interactions and function calls in real time, identify potentially triggered basic block boundaries as the basis for task division, allocate tasks according to the position of the control flow graph, and adjust the test engine Seed storage and scheduling strategies.
It improves code coverage and vulnerability discovery capabilities, reduces redundant testing, and improves resource utilization and efficiency of parallel fuzz testing.
Smart Images

Figure CN118535449A
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of software fuzz testing, and in particular to a method and system for dividing engine tasks that are sensitive to program structure in a parallel fuzz testing scenario. Background Art
[0002] With the continuous progress of computer science and Internet information technology, various programs and systems have emerged, with increasingly powerful functions and wide application range, covering mobile terminals, IoT devices, industrial control systems and cloud computing platforms. However, many developers often ignore security design during program construction, resulting in the gradual emergence of security risks, especially the increase in the number of event-driven vulnerabilities and serious zero-day vulnerabilities. Vulnerabilities in information systems have become the main source of network security threats. Once maliciously exploited, they may cause significant political and economic losses.
[0003] At the same time, with the rise of open source software and the change of development mode, software development has evolved from a closed model to open source collaboration and rapid iteration. In this new model, software updates are frequent and the scale grows rapidly, resulting in an increase in the workload of security testing. At the same time, software functions are becoming more and more complex, and the demand for fuzz testing is increasing. However, the performance improvement of traditional single-core CPUs is limited and cannot meet the requirements of test task timeliness and computing resource utilization. Therefore, parallel fuzz testing has become an important means to meet these challenges, aiming to improve test efficiency and computing resource utilization to adapt to the development trend of multi-core CPUs.
[0004] Although fuzz testing is widely used as an effective software testing method, current research and applications mainly focus on traditional scenarios of single-core stand-alone machines. Parallel fuzz testing, as a field that helps improve test efficiency and cope with the popularization of multi-core processors, is still in a relatively blank state. There are several key problems that need to be solved in the current research and application of parallel fuzz testing: ① High task repetitiveness: In the absence of an effective coordination mechanism, multiple test engines may repeatedly explore the same program execution path, resulting in redundant test work and waste of resources. ② Large system exploration redundancy: Due to the lack of effective division of the overall test space, different test engines may consume computing resources under the same system state, increasing the redundancy of parallel testing. ③ Task division is insensitive to program structure: Existing task division methods often ignore the internal structure and logic of the program under test, resulting in the inability to effectively target the key parts of the program and may miss important security vulnerabilities. These problems not only reduce the efficiency of testing, but also may miss important vulnerabilities.
[0005] In view of the limitations of existing parallel fuzz testing schemes, such as strong repetitiveness of sub-instance test tasks, high system exploration redundancy, and insensitivity of task division to program structure, the present invention provides an engine task division method and system that is sensitive to program structure in a parallel fuzz testing scenario, to achieve adaptive dynamic parallel fuzz testing task segmentation. Summary of the invention
[0006] The present invention provides a method and system for dividing engine tasks that are sensitive to program structure in a parallel fuzzy testing scenario.
[0007] Specifically, the present invention proposes a plugging method that integrates static analysis and dynamic behavior capture, which is used to construct a control flow graph of a target program and monitor basic block interactions and function calls in real time. Through a specially designed plugging pass, the method can not only dynamically update the control flow graph, but also accurately monitor the running status of the program. In addition, based on the collected behavior data, the present invention can effectively distinguish between triggered and untriggered basic block boundary sets, and identify those boundary basic blocks with potential triggering possibilities as the basis for task division. Considering the number of parallel fuzz testing engines and their positions on the runtime control flow graph, these potential basic blocks will be assigned to different exploration tasks. Each test engine adjusts its seed storage and scheduling strategy according to the assigned tasks to achieve centralized exploration of specific tasks. In general, the present invention improves the efficiency of parallel fuzz testing tools in code coverage and discovery of new vulnerabilities by integrating static and dynamic program behavior capture technologies, dynamically identifying exploration tasks sensitive to program structure, and optimizing fuzz testing processes.
[0008] The specific technical solutions are as follows:
[0009] In a first aspect, the present invention provides a method for dividing engine tasks that is sensitive to program structure in a parallel fuzz testing scenario, comprising the following steps:
[0010] 1) Capture the basic block information and the calling relationship information between basic blocks in the target program source code through static analysis tools, and build the initial control flow graph of the target program based on the captured information;
[0011] 2) formulating a first executable file for obtaining actual call conditions during runtime between basic blocks and a second executable file for recording actual call information during runtime between functions in the target program source code; the function is composed of multiple basic blocks;
[0012] 3) Using the two executable files prepared in step 2) to respectively execute all test cases in the fuzz test, collect real-time data of the actual execution behavior in the target program, and update the initial control flow graph based on the collected real-time data to form a runtime control flow graph that reflects the actual execution path and operation logic of the program;
[0013] 4) According to the runtime control flow graph of step 3), the boundary between the triggered basic blocks and the untriggered basic blocks is identified, and the basic blocks that are triggered but have untriggered successor basic blocks are found as the task partitioning target basic blocks. According to the position relationship of the task partitioning target basic blocks on the runtime control flow graph and the number of parallel fuzz testing engines, these target basic blocks are divided into different exploration tasks;
[0014] 5) Assign the exploration task of step 4) to the fuzz test engine. The fuzz test engine screens the test cases in the fuzz test engine according to whether the test cases trigger the relevant exploration tasks, and uses the screened test cases that can trigger the exploration tasks as the final engine tasks of the engine, thereby completing the engine task division of each test engine in the fuzz test.
[0015] As a preferred embodiment of the present invention, the step 1) comprises:
[0016] 1.1) Obtain the source code of the target program, identify each basic block in the target program through a static analysis tool, assign a unique identifier to each basic block, record the subsequent basic blocks to which each basic block can jump, and assign a unique identifier to each jump relationship;
[0017] 1.2) Based on the recorded identifiers of basic blocks and jump relationships between them, an initial control flow graph of the target program is constructed.
[0018] As a preferred solution of the present invention, the step 2) is specifically as follows: a first link-time optimization mode Pass for recording actual runtime call information between basic blocks and a second link-time optimization mode Pass for tracking call information between functions are formulated through the core library interface of LLVM, and applied to the target program to generate a first executable file for obtaining actual runtime call conditions between basic blocks and a second executable file for recording actual runtime call information between functions in the target program source code.
[0019] In a second aspect, the present invention further provides an engine task division system for implementing the above-mentioned engine task division method, comprising:
[0020] A control flow graph construction module is used to capture basic block information and call relationship information between basic blocks in the target program source code through a static analysis tool, store the captured information in a synchronously created record file, and construct an initial control flow graph of the target program based on the captured information;
[0021] An executable file formulation module, used for formulating two executable files, the two executable files are respectively a first executable file for obtaining actual call conditions between basic blocks at runtime and a second executable file for recording actual runtime call information between functions in the target program source code;
[0022] A control flow graph update module executes all fuzzy test cases respectively using the first executable file and the second executable file prepared by the executable file preparation module, collects real-time data of the actual execution behavior of the target program, and updates the initial control flow graph based on the collected real-time data to form a runtime control flow graph that reflects the actual execution path and operation logic of the program;
[0023] An exploration task division module is used to identify the boundaries of triggered basic blocks and untriggered basic blocks according to the runtime control flow graph updated by the control flow graph update module, find basic blocks that are triggered but have untriggered successor basic blocks as task division target basic blocks, and divide these target basic blocks into different exploration tasks according to the position relationship of the task division target basic blocks on the runtime control flow graph and the number of parallel fuzz test engines;
[0024] The exploration task allocation module is used to allocate exploration tasks to the fuzz testing engine and screen test cases based on whether the historical execution information of the test cases triggers related tasks.
[0025] As a preferred solution of the present invention, the control flow graph construction module includes:
[0026] An information acquisition component is used to obtain the source code of the target program, identify each basic block in the target program through a static analysis tool, assign a unique identifier to each basic block, and record the subsequent basic blocks that each basic block can jump to, and assign a unique identifier to each jump relationship;
[0027] The control flow graph construction component is used to construct an initial control flow graph of the target program according to the recorded basic blocks and the identifiers of the jump relationships between them.
[0028] As a preferred solution of the present invention, the execution file formulation module includes:
[0029] An LLVM Pass formulation component is used to formulate a first link-time optimization mode Pass for recording actual runtime call information between basic blocks and a second link-time optimization mode Pass for tracking call information between functions by using a core library interface of LLVM;
[0030] An executable file generation component is used to apply the formulated first link-time optimization mode Pass and second link-time optimization mode Pass to the target program to generate a first executable file for obtaining the actual call status between basic blocks at runtime and a second executable file for recording the actual call information between functions at runtime in the target program source code.
[0031] As a preferred solution of the present invention, the control flow graph updating module includes:
[0032] A basic block execution status update component is used to record the triggering status of the calling relationship between the basic blocks according to the first executable file and deduce the execution status of the basic blocks, and mark the boundaries between all the basic blocks that have been executed and the basic blocks that have not been executed;
[0033] A function execution status update component is used to calibrate the sequential numbering according to the triggering situation of the calling relationship between functions recorded by the second executable file using the link-time optimization mode, taking the identifier of the entry basic block of the function as the benchmark, and representing the calling relationship between the two functions through the calling relationship between the two function entry basic blocks, thereby updating the initial control flow graph.
[0034] Compared with the prior art, the present invention has the following beneficial effects:
[0035] 1) By accurately monitoring program behavior, the present invention can more effectively guide fuzz testing, thereby improving code coverage and enhancing the ability to discover potential vulnerabilities.
[0036] 2) The present invention utilizes the runtime control flow graph to identify potential basic block boundary sets, is more sensitive to program structure, and realizes targeted task division, making test case generation and execution more efficient and reducing the generation and execution of invalid test cases.
[0037] 3) The present invention effectively reduces the resource consumption of the operation of the instrumented binary file, reduces the exploration of redundant test paths, and improves the resource utilization of parallel fuzz testing through the customized link-time optimization mode Pass and the correction optimization of the runtime control flow graph.
[0038] 4) The present invention takes into account the positional relationship in the runtime control flow graph, allocates closely related basic blocks to the same task, minimizes the interdependence and communication requirements between tasks, and thus enhances the independence of parallel test tasks and the overall efficiency of the test. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 Schematic diagram of the architecture of the engine task partitioning system that is sensitive to program structure;
[0040] Figure 2 It is a schematic diagram of the workflow of the target program preprocessing module;
[0041] Figure 3 A workflow diagram for task division modules;
[0042] Figure 4 This is the workflow diagram of the fuzz testing engine. DETAILED DESCRIPTION
[0043] The present invention is further described and illustrated below in conjunction with specific embodiments. The embodiments are merely exemplary of the present disclosure and do not define the scope of limitation. The technical features of each embodiment of the present invention may be combined accordingly without conflicting with each other.
[0044] like Figure 1 As shown, a program structure-sensitive engine task partitioning system in a parallel fuzz testing scenario of the present invention is composed of a control flow graph construction module, an execution file formulation module, a control flow graph update module, an exploration task partitioning module and an exploration task allocation module, wherein the control flow graph construction module is used to capture the basic block information and the calling relationship information between the basic blocks in the target program source code through a static analysis tool, and store the captured information in a synchronously created record file; and construct an initial control flow graph of the target program based on the captured information; the execution file formulation module is used to formulate two executable files, the two executable files are respectively a first executable file for obtaining the actual calling situation between the basic blocks during runtime and a second executable file for recording the actual calling information between the functions in the target program source code during runtime; the control flow graph update module uses the first executable file formulated by the execution file formulation module to generate the first executable file. The line file and the second executable file respectively execute all the test cases of the fuzz test, collect the real-time data of the actual execution behavior of the target program, and update the initial control flow graph based on the collected real-time data to form a runtime control flow graph that reflects the actual execution path and operation logic of the program; the exploration task division module is used to identify the boundaries of the triggered basic blocks and the untriggered basic blocks according to the runtime control flow graph updated by the control flow graph update module, and find the basic blocks that are triggered but have untriggered successor basic blocks as the task division target basic blocks, and divide these target basic blocks into different exploration tasks according to the position relationship of the task division target basic blocks on the runtime control flow graph and the number of parallel fuzz test engines; the exploration task allocation module is used to allocate the exploration tasks to the fuzz test engines, and screen the test cases according to whether the historical execution information of the test cases triggers related tasks.
[0045] In a specific embodiment of the present invention, the control flow graph construction module and the execution file formulation module execute the process as follows Figure 2 As shown in the figure, the basic process is: first, the control flow graph construction module uses static analysis technology to analyze the source code based on LLVM, extracts basic block information and the calling relationship between each other, constructs the initial control flow graph, and saves this data to the record file. Then, the execution file formulation module implements two customized link-time optimization modes Pass through the LLVM core library interface, generates two executable files for monitoring runtime behavior, one to track calls between basic blocks, and the other to record call information between functions, providing accurate monitoring tools for subsequent tests.
[0046] In order to improve the parallel fuzz testing code exploration and vulnerability triggering capabilities, the present invention needs to fully collect and utilize the behavior information of the target program. Figure 1 The control flow graph update module, exploration task division module, and exploration task allocation module in the are all related to the processing of associated data information.
[0047] Among them, the control flow graph update module execution process is as follows Figure 3 As shown in the figure, the basic process is: first, use the information capture module to execute the newly saved test case, and use the executable file generated by the executable file formulation module to collect key behavior data in the actual execution of the program. Then, use this data to correct and optimize the initial control flow graph to form a runtime control flow graph that can reflect the actual running logic of the program. The exploration task division module accurately identifies the set of basic block boundaries that have been triggered and not triggered, especially those boundary basic blocks with triggering potential. Finally, according to the number of parallel fuzz testing engines and the position relationship of these target basic blocks in the runtime control flow graph, they are effectively allocated to different exploration tasks to ensure that each fuzz testing engine can focus on the exploration of a specific task.
[0048] Explore the execution process of the task allocation module Figure 4 As shown in the figure, the basic process is: first, the test environment and engine are initialized and configured, and the task path input item is introduced so that the engine can read and lock the key target area of this exploration to improve the accuracy of the test. Then all saved test cases are executed, and the results are analyzed in depth to identify the use cases that trigger the key basic blocks. These use cases that are considered to be more valuable for exploration will serve as the core of subsequent mutation and evolution, while the use cases that do not trigger the key blocks are excluded. Then, according to the triggering of each test case on the task-related basic blocks, the probability of being selected is calculated, and more test cases that trigger task-related basic blocks are preferred, thereby optimizing the allocation of mutation resources and increasing the possibility of discovering unknown paths or vulnerabilities.
[0049] Based on the above introduction to the execution process of the three major modules, each major module is composed of several sub-modules. The control flow graph construction module includes:
[0050] An information acquisition component is used to obtain the source code of the target program, identify each basic block in the target program through a static analysis tool, assign a unique identifier to each basic block, and record the successor basic blocks that each basic block can jump to, and assign a unique identifier to each jump relationship; in a specific embodiment of the present invention, the static analysis tool uses the static analysis tool of LLVM;
[0051] The control flow graph construction component is used to construct an initial control flow graph of the target program according to the recorded basic blocks and the identifiers of the jump relationships between them.
[0052] The execution file formulation module includes:
[0053] An LLVM link-time optimization Pass formulation component is used to formulate a first link-time optimization mode Pass for recording actual runtime call information between basic blocks and a second link-time optimization mode Pass for tracking call information between functions by using the LLVM core library interface;
[0054] An executable file generation component is used to apply the formulated first link-time optimization mode Pass and second link-time optimization mode Pass to the target program to generate a first executable file for obtaining the actual call status between basic blocks at runtime and a second executable file for recording the actual call information between functions at runtime in the target program source code.
[0055] The control flow graph update module includes:
[0056] A basic block execution status update component is used to record the triggering status of the calling relationship between the basic blocks according to the first executable file and deduce the execution status of the basic blocks, and mark the boundaries between all the basic blocks that have been executed and the basic blocks that have not been executed;
[0057] A function execution status update component is used to calibrate the sequential numbering according to the triggering situation of the calling relationship between functions recorded by the second executable file using the link-time optimization mode, taking the identifier of the entry basic block of the function as the benchmark, and representing the calling relationship between the two functions through the calling relationship between the two function entry basic blocks, thereby updating the initial control flow graph.
[0058] In one embodiment of the present invention, the fuzz testing engine includes:
[0059] The initialization setting module is responsible for configuring the test environment and engine, and adds the task path as input based on the traditional configuration. This enables the engine to identify and focus on specific test target areas based on the task path, thereby enhancing the accuracy of the test.
[0060] The test case attribute update module is responsible for executing test cases and analyzing the results to identify the use cases that trigger task-related basic blocks. These use cases have high exploration value and therefore become the main input for subsequent mutation and evolution processes. Use cases that do not trigger key blocks do not participate in subsequent activities, ensuring the goal orientation of the test process.
[0061] The probability allocation module is selected to calculate the probability of being selected based on the number of basic blocks related to the task triggered by the use case. Use cases with a high number of triggered key blocks are given higher probabilities because they are more likely to reveal new paths or vulnerabilities, while other use cases are given lower probabilities accordingly.
[0062] The system embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of the present invention. Those of ordinary skill in the art may understand and implement the scheme without creative work.
[0063] The embodiments of the system of the present invention can be applied to any device with data processing capabilities, and the device with data processing capabilities can be a device or apparatus such as a computer. The system embodiments can be implemented by software, or by hardware or a combination of software and hardware. Taking software implementation as an example, as a device in a logical sense, the corresponding computer program instructions in the non-volatile memory are read into the memory by the processor of any device with data processing capabilities and run.
[0064] Based on the same inventive concept, a method for dividing engine tasks that is sensitive to program structure in a parallel fuzz testing scenario is proposed, and the main steps are:
[0065] 1) Capture the basic block information and the calling relationship information between basic blocks in the target program source code through static analysis tools, and build the initial control flow graph of the target program based on the captured information;
[0066] 2) formulating a first executable file for obtaining actual call conditions during runtime between basic blocks and a second executable file for recording actual call information during runtime between functions in the target program source code; the function is composed of multiple basic blocks;
[0067] 3) Using the two executable files prepared in step 2), respectively execute all test cases in the fuzz test, collect real-time data of the actual execution behavior in the target program, and update the initial control flow graph based on the collected real-time data to form a runtime control flow graph that reflects the actual execution path and operation logic of the program;
[0068] 4) According to the runtime control flow graph of step 3), the boundary between the triggered basic blocks and the untriggered basic blocks is identified, and the basic blocks that are triggered but have untriggered successor basic blocks are found as the task partitioning target basic blocks. According to the position relationship of the task partitioning target basic blocks on the runtime control flow graph and the number of parallel fuzz testing engines, these target basic blocks are divided into different exploration tasks;
[0069] 5) Assign the exploration task of step 4) to the fuzz test engine. The fuzz test engine screens the test cases in the fuzz test engine according to whether the test cases trigger related tasks; the screened test cases that can trigger the exploration task are used as the final engine tasks of the engine, thereby completing the engine task division of each test engine in the fuzz test.
[0070] Each fuzz testing engine adjusts its seed preservation and scheduling strategies to ensure that only test cases that trigger exploration tasks are retained to participate in the mutation process. The selection probability of test cases is closely related to the exploration tasks. Test cases that trigger more basic blocks of tasks have stronger exploration potential, so the probability of selection assigned to them is correspondingly higher.
[0071] 6) Repeat steps 3)-5) until the parallel fuzz testing is completed.
[0072] The PAFL tool first introduced the concept of task partitioning. Before the test starts, it divides the bitmap of the program under test equally. Each engine is responsible for exploring a bitmap area, thereby reducing task conflicts. However, the exploration difficulty of different bitmap areas is different, and there is an uneven load between test engines. In addition, the adjacent areas on the bitmap may not be adjacent in the program. It does not consider the program structure and does not fully utilize the principle of locality. The AFLTeam tool attempts to solve the above problems. It first establishes the program call graph through static analysis, and then divides the call graph using the graph partitioning algorithm. In addition, it will adjust the partitioning results based on the actual completion of the task. However, it is not reasonable for the AFLTeam tool to use the entire program as the partitioning target. Most program areas are actually irrelevant to the current exploration progress. Including them as targets will not only fail to trigger them, but will affect the engine's exploration of other areas. The AFL-EDGE tool divides test cases into mutually exclusive subsets based on their execution information. The ClusterFuzz and OneFuzz tools commonly used in the industry adopt a simple preemptive strategy. When each test engine is idle, it directly applies for test cases from the central queue. This type of work does not consider the structural information of the program under test, and the mutual exclusivity of the exploration areas between test engines is poor.
[0073] Compared with the PAFL tool, the present invention further accurately tests the target, identifies basic blocks with exploration potential from the exploration boundary as the target, has a finer division granularity, a more focused test engine exploration area, and lower duplication between engines; compared with the AFL-EDGE tool, the present invention makes full use of the structural information of the program under test, and the basis for division is clearer. Combining the above two points, the present invention performs better than other tools in the same field. Experiments show that under the same test conditions, multiple different programs are tested and averaged. Taking the program coverage index, which is the most widely used indicator for measuring the efficiency of fuzz testing, as an example, compared with the PAFL tool, the present invention has improved by 23.45%; compared with the AFLTeam tool, the present invention has improved by 21.80%; compared with the AFL-EDGE tool, the present invention has improved by 19.53%. To a certain extent, the present invention is the most efficient parallel fuzz testing tool.
[0074] The above-mentioned embodiments only express several implementation methods of the present invention, and the description is relatively specific and detailed, but it cannot be understood as limiting the scope of the present invention. For ordinary technicians in this field, several modifications and improvements can be made without departing from the concept of the present invention, which all belong to the protection scope of the present invention.
Claims
1. A method for dividing engine tasks that is sensitive to program structure in a parallel fuzz testing scenario, characterized in that: The following steps are involved: 1) Capture the basic block information and the calling relationship information between basic blocks in the target program source code through static analysis tools, and build the initial control flow graph of the target program based on the captured information; 2) formulating a first executable file for obtaining actual call conditions during runtime between basic blocks and a second executable file for recording actual call information during runtime between functions in the target program source code; the function is composed of multiple basic blocks; 3) Using the two executable files prepared in step 2) to respectively execute all test cases in the fuzz test, collect real-time data of the actual execution behavior in the target program, and update the initial control flow graph based on the collected real-time data to form a runtime control flow graph that reflects the actual execution path and operation logic of the program; 4) According to the runtime control flow graph of step 3), the boundary between the triggered basic blocks and the untriggered basic blocks is identified, and the basic blocks that are triggered but have untriggered successor basic blocks are found as the task partitioning target basic blocks. According to the position relationship of the task partitioning target basic blocks on the runtime control flow graph and the number of parallel fuzz testing engines, these target basic blocks are divided into different exploration tasks; 5) Assign the exploration task of step 4) to the fuzz test engine. The fuzz test engine screens the test cases in the fuzz test engine according to whether the test cases trigger the relevant exploration tasks, and uses the screened test cases that can trigger the exploration tasks as the final engine tasks of the engine, thereby completing the engine task division of each test engine in the fuzz test.
2. The engine task division method according to claim 1, characterized in that: The step 1) comprises: 1.1) Obtain the source code of the target program, identify each basic block in the target program through a static analysis tool, assign a unique identifier to each basic block, record the subsequent basic blocks to which each basic block can jump, and assign a unique identifier to each jump relationship; 1.2) Based on the recorded identifiers of basic blocks and jump relationships between them, an initial control flow graph of the target program is constructed.
3. The engine task division method according to claim 1, characterized in that: The step 2) is specifically as follows: a first link-time optimization mode Pass for recording actual runtime call information between basic blocks and a second link-time optimization mode Pass for tracking call information between functions are formulated through the core library interface of LLVM, and applied to the target program to generate a first executable file for obtaining actual runtime call information between basic blocks and a second executable file for recording actual runtime call information between functions in the target program source code.
4. The engine task division method according to claim 1, characterized in that: Step 3) is specifically: The triggering situation of the calling relationship between basic blocks is recorded through the first executable file and the execution situation of the basic blocks is derived; the triggering situation of the calling relationship between functions is recorded through the second executable file, and the sequential numbering is calibrated using the link-time optimization mode, and the calling relationship between the two functions is represented by the calling relationship between the two function entry basic blocks based on the identifier of the entry basic block of the function, so as to update the initial control flow graph to reflect the actual behavior of the program; The entry basic block is the first basic block that executes the function.
5. The engine task division method according to claim 1, characterized in that: The step 4) comprises: 4.1) Analyze the runtime control flow graph constructed in step 3, mark the boundaries between all basic blocks that have been executed and basic blocks that have not been executed, and find the target basic block, which is a basic block that is triggered itself but has no subsequent basic blocks triggered. 4.2) Select the target basic block as the target of task division, and decide whether to divide the target basic block into multiple groups of independent exploration tasks according to the number of available parallel fuzz testing engines. When grouping, the position relationship of the target basic block in the runtime control flow graph is considered to realize task division. By performing depth-first traversal on the runtime control flow graph, the closely connected basic blocks are divided into the same task to reduce cross-task jumps. 4.3) Allocating the multiple groups of exploration tasks to a corresponding number of fuzz testing engines for exploration.
6. An engine task division system for implementing the engine task division method of claim 1, characterized in that: include: A control flow graph construction module is used to capture basic block information and call relationship information between basic blocks in the target program source code through a static analysis tool, and store the captured information in a synchronously created record file; and constructing the initial control flow graph of the target program based on the captured information; An executable file formulation module, used for formulating two executable files, the two executable files are respectively a first executable file for obtaining actual call conditions between basic blocks at runtime and a second executable file for recording actual runtime call information between functions in the target program source code; A control flow graph update module executes all fuzzy test cases respectively using the first executable file and the second executable file prepared by the executable file preparation module, collects real-time data of the actual execution behavior of the target program, and updates the initial control flow graph based on the collected real-time data to form a runtime control flow graph that reflects the actual execution path and operation logic of the program; An exploration task division module is used to identify the boundaries of triggered basic blocks and untriggered basic blocks according to the runtime control flow graph updated by the control flow graph update module, find basic blocks that are triggered but have untriggered successor basic blocks as task division target basic blocks, and divide these target basic blocks into different exploration tasks according to the position relationship of the task division target basic blocks on the runtime control flow graph and the number of parallel fuzz test engines; The exploration task allocation module is used to allocate exploration tasks to the fuzz testing engine, and the fuzz testing engine screens the test cases in the fuzz testing engine according to whether the test cases trigger related exploration tasks.
7. The engine task division system according to claim 6, characterized in that: The control flow graph building module includes: An information acquisition component is used to obtain the source code of the target program, identify each basic block in the target program through a static analysis tool, assign a unique identifier to each basic block, and record the subsequent basic blocks that each basic block can jump to, and assign a unique identifier to each jump relationship; The control flow graph construction component is used to construct an initial control flow graph of the target program according to the recorded basic blocks and the identifiers of the jump relationships between them.
8. The engine task division system according to claim 6, characterized in that: The execution file formulation module includes: An LLVM Pass formulation component is used to formulate a first link-time optimization mode Pass for recording actual runtime call information between basic blocks and a second link-time optimization mode Pass for tracking call information between functions by using a core library interface of LLVM; An executable file generation component is used to apply the formulated first link-time optimization mode Pass and second link-time optimization mode Pass to the target program to generate an executable file for obtaining the actual runtime calling status between basic blocks and an executable file for recording the actual runtime calling information between functions in the target program source code.
9. The engine task division system according to claim 6, characterized in that: The control flow graph updating module comprises: A basic block execution status update component is used to record the triggering status of the calling relationship between the basic blocks according to the first executable file and deduce the execution status of the basic blocks, and mark the boundaries between all the basic blocks that have been executed and the basic blocks that have not been executed; A function execution status update component is used to calibrate the sequential numbering according to the triggering situation of the calling relationship between functions recorded by the second executable file using the link-time optimization mode, taking the identifier of the entry basic block of the function as the benchmark, and representing the calling relationship between the two functions through the calling relationship between the two function entry basic blocks, thereby updating the initial control flow graph.
Citation Information
Cited By
Parallel fuzzy test method and system based on input field division
CN120045464A
Parallel fuzzy testing method and system based on input domain division
CN120045464B
Control flow integrity protection method and device based on program control flow characteristics, equipment and storage medium
CN120744881A
Control flow integrity protection method and device based on program control flow characteristics, equipment and storage medium
CN120744881B
