Database cluster fuzz testing method, system, computer device and storage medium
By creating sub-process managers and observers in the database cluster, unified management and coverage statistics of multiple nodes are achieved, which solves the problem of the inability of existing technology to manage distributed database clusters and improves database security and testing efficiency.
Patent Information
- Application Number
- CN202410031467.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-09
- Publication Date
- 2024-10-08
- Estimated Expiration
- 2044-01-09
AI Technical Summary
Existing database fuzz testing technology can only be applied to a single database node and cannot effectively manage and count multiple nodes in a distributed database cluster, which makes it difficult to deal with distributed database clusters.
By creating sub-process managers, sub-process observers and sub-process management groups, all sub-process managers are uniformly registered to the overall multi-process manager, and sub-process observers are uniformly registered to the overall multi-process observer to achieve monitoring of all sub-processes. Unify management and coverage statistics to form summarized exception information and coverage information and send them to the mutator for mutation.
It realizes unified test process management, fuzz testing and coverage statistics for each node in the database cluster, adapts to massive database cluster testing, discovers more database defects and security vulnerabilities, improves database security, and reduces potential risks.
Smart Images

Figure CN117992340B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of fuzzy testing technology, and in particular to a database cluster fuzzy testing method, system, computer device and storage medium. Background Art
[0002] The main goal of database fuzz testing is to detect and discover potential vulnerabilities, errors, and abnormal behaviors in the database system to improve the security and stability of the database. The database fuzz testing techniques are as follows:
[0003] The test program establishes a communication connection with the database through various interfaces and protocols provided by the database system. The fuzz tester then generates a large amount of random or semi-random input data, usually database statements, and then calls the database interface for simulation testing. During this process, the fuzz testing framework monitors the response of the database system in real time. If the database encounters anomalies, crashes, errors, or other unexpected behaviors when processing fuzzy input, these anomalies will be recorded, and the code coverage information in each round of testing will be recorded. In the next round of iteration, the input data is mutated according to the code coverage and anomalies to achieve the most comprehensive coverage possible.
[0004] However, the inventors realize that the existing technology can only be applied to a single database node, start a single test node, record the code coverage information of each round of testing in the local shared memory, or start multiple test nodes in parallel to test a single database node, but for a large number of database cluster nodes, it is impossible to perform unified process management, fuzz testing and coverage statistics. Therefore, when facing a distributed database cluster, the existing technology seems to be somewhat stretched. Summary of the invention
[0005] The present application provides a database cluster fuzz testing method, system, computer device and storage medium, aiming to solve the technical problem that the existing fuzz testing technology can only be applied to a single database node and cannot be applied to database cluster nodes.
[0006] In a first aspect, a database cluster fuzz testing method includes:
[0007] S1, for each node in the database cluster, create a corresponding sub-process manager and sub-process observer, and for each sub-process manager, create a corresponding sub-process management group;
[0008] S2, register all sub-process managers in the total multi-process manager, register all sub-process observers in the total multi-process observer, and register all sub-process management groups in the total multi-process management group;
[0009] S3, using a fuzz tester to generate a fuzz test case and start the total multi-process manager;
[0010] S4, sending the fuzzy test case to the general multi-process manager, and sending control instructions to all sub-process managers through the general multi-process manager, so that all sub-process managers use the fuzzy test case to start the test process on the corresponding node and perform a round of fuzzy testing;
[0011] S5, in the current fuzzy testing process, using each sub-process management group to record and manage the fuzzy test exception information in the corresponding sub-process manager, and summarizing the fuzzy test exception information recorded and managed by all sub-process managers in the total multi-process management group;
[0012] S6, in the current fuzz testing process, using each sub-process observer to analyze and obtain the code coverage information of the corresponding node, and summarizing the code coverage information obtained by all sub-process observers in the total multi-process observer;
[0013] S7, sending the fuzzy test exception information summarized in the total multi-process management group and the code coverage information summarized in the total multi-process observer to the mutator, so that the mutator mutates the fuzzy test case according to the summarized fuzzy test exception information and code coverage information;
[0014] S8, repeat steps S4-S7 to perform multiple rounds of fuzzy testing.
[0015] In the above scheme, optionally, the fuzzy test exception information includes Crash information and operation logs generated by the test process during the test.
[0016] In the above solution, optionally, after each sub-process observer obtains the code coverage information of the corresponding node through analysis, the observer maps the code coverage information into its own memory.
[0017] In the above scheme, optionally, for a cluster node containing a single node in the database cluster, the sub-process manager created is a single-process manager, and the sub-process observer created is a single-process observer; for a cluster node containing multiple nodes in the database cluster, the sub-process manager created is a multi-process manager, and the sub-process observer created is a multi-process observer.
[0018] In the above scheme, optionally, the fuzzy tester is American Fuzzy Lop or American FuzzyLop plus plus.
[0019] In the above solution, optionally, the overall multi-process manager is started through a configuration file and a corresponding startup script.
[0020] In a second aspect, a database cluster fuzz testing system includes:
[0021] A total multi-process manager, in which a plurality of sub-process managers are registered; each sub-process manager corresponds to a node in the database cluster, and each sub-process manager is used to manage the life cycle of the test process; the total multi-process manager is used to manage all sub-process managers;
[0022] A total multi-process observer, in which a plurality of sub-process observers are registered; each sub-process observer corresponds to a node in the database cluster, and each sub-process observer is used to analyze and obtain the code coverage information of the corresponding node in each round of fuzz testing, and each sub-process observer maps the code coverage information to its own memory; the total multi-process observer is used to summarize the code coverage information obtained by all sub-process observers, and send the summarized code coverage information to the mutator;
[0023] A total multi-process management group, in which multiple sub-process management groups are registered; each sub-process management group corresponds to a sub-process manager, and each sub-process management group is used to record and manage the fuzz test exceptions of the corresponding sub-process manager; the total multi-process management group is used to summarize the fuzz test exception information recorded and managed by all sub-process managers, and send the summarized fuzz test exception information to the mutator.
[0024] According to a third aspect, a computer device comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of any one of the methods according to the first aspect when executing the computer program.
[0025] According to a fourth aspect, a computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the steps of any one of the methods described in the first aspect.
[0026] Compared with the prior art, this application has at least the following beneficial effects:
[0027] The embodiment of the present application proposes a database fuzz testing method based on a cluster environment in combination with a distributed architecture based on the traditional database fuzz testing. The present application creates a sub-process manager, a sub-process observer and a sub-process management group, and uniformly registers all sub-process managers with the total multi-process manager, uniformly registers all sub-process observers with the total multi-process observer, and uniformly registers all sub-process management groups with the total multi-process management group, so that the total multi-process manager can be used to manage all sub-process managers, the total multi-process management group can be used to summarize the operation logs and Crash information of all sub-process manager groups and send them to the mutator, the total multi-process observer can be used to count the coverage information of all registered observers, and the summarized coverage is sent to the mutator for the next round of testing; thereby, unified test process management, fuzz testing and coverage statistics can be implemented for each node in the database cluster; compared with the traditional database single-node fuzz testing, the present invention opens up a new direction for cluster fuzz testing, can adapt to testing on massive database clusters, can apply fuzz testing technology to more practical scenarios, discover more database defects and security vulnerabilities, improve the security of the database, and reduce potential risks.
[0028] The embodiment of the present application controls the coverage information executed by different nodes and maps them to independently managed memory spaces, thereby ensuring that the newly discovered paths are not affected by other processes, thereby generating correct coverage feedback. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 A flowchart of a database cluster fuzzy testing method provided by one embodiment of the present application;
[0030] Figure 2 This is a schematic diagram of a database fuzzy testing architecture based on a cluster environment in one embodiment of the present application;
[0031] Figure 3 A module architecture block diagram of a database cluster fuzzy testing system provided for one embodiment of the present application;
[0032] Figure 4 An internal structure diagram of a computer device is provided for one embodiment of the present application. DETAILED DESCRIPTION
[0033] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0034] In the description of this application: unless otherwise specified, the meaning of "plurality" is two or more. The terms "first", "second", "third", etc. in this application are intended to distinguish the objects referred to, and do not have special meanings in terms of technical connotations (for example, they should not be understood as emphasizing the importance or order, etc.). Expressions such as "including", "comprising", "having", etc. also mean "not limited to" (certain units, components, materials, steps, etc.).
[0035] In one embodiment, Figure 1 As shown, a database cluster fuzzy testing method is provided, which includes the following steps:
[0036] S1, for each node in the database cluster, create a corresponding sub-process manager and a sub-process observer, and for each sub-process manager, create a corresponding sub-process management group.
[0037] A cluster environment database refers to a database system that runs in a cluster consisting of multiple computers. In this environment, the database is distributed and deployed on multiple computers, which are connected through a network and work together to provide database services.
[0038] For a cluster node containing a single node in the database cluster, the sub-process manager created is a single-process manager, and the sub-process observer created is a single-process observer; for a cluster node containing multiple nodes in the database cluster, the sub-process manager created is a multi-process manager, and the sub-process observer created is a multi-process observer.
[0039] S2, all sub-process managers are uniformly registered in the total multi-process manager, all sub-process observers are uniformly registered in the total multi-process observer, and all sub-process management groups are uniformly registered in the total multi-process management group.
[0040] Suppose there is a database cluster that contains multiple computer nodes, and each computer runs a database instance. In order to perform fuzz testing, we need to start a subprocess manager for fuzz testing on each computer. This subprocess manager will be responsible for controlling the startup, running, and monitoring of each subprocess during the fuzz testing process.
[0041] Next, we need a multi-process manager, which is responsible for registering all these sub-process managers with itself so as to coordinate and manage them as a whole. In this way, we can control the behavior of all sub-process managers in the entire cluster through the multi-process manager, such as starting them uniformly, monitoring their status, etc.
[0042] In general, in database cluster fuzz testing, a sub-process manager is created for each node and they are uniformly registered in a multi-process manager. This method can help us better organize and manage the entire fuzz testing process, ensure that the test processes on each node can work together, and thus improve the test efficiency and accuracy.
[0043] S3, use the fuzz tester to generate fuzz test cases and start the total multi-process manager.
[0044] The fuzz tester may be American Fuzzy Lop or American Fuzzy Lop plusplus. Specifically, the total multi-process manager may be started through a configuration file and a corresponding startup script.
[0045] S4, sends the fuzzy test case to the general multi-process manager, and sends control instructions to all sub-process managers through the general multi-process manager, so that all sub-process managers use the fuzzy test case to start the test process on the corresponding node and perform a round of fuzzy testing.
[0046] S5, in the current fuzzy testing process, each sub-process management group is used to record and manage the fuzzy testing exception information in the corresponding sub-process manager, and the fuzzy testing exception information recorded and managed by all sub-process managers is summarized in the total multi-process management group.
[0047] Among them, the fuzzy test exception information includes the Crash information and operation log generated by the test process during the test. "Crash information" generally refers to the information generated when a serious error occurs in a computer software or system. When a program or system encounters a serious problem, it may cause the program to terminate abnormally, and this abnormal termination is called a "crash". In the process of software development and testing, collecting and analyzing Crash information is crucial for troubleshooting and fixing problems in the program. In the database fuzzy testing scheme described in this embodiment, collecting and recording Crash information can help detect and locate potential defects and security vulnerabilities in the database cluster system, thereby improving the stability and security of the system.
[0048] S6, in the current fuzz testing process, each sub-process observer is used to analyze and obtain the code coverage information of the corresponding node, and the code coverage information obtained by all sub-process observers is summarized in the total multi-process observer.
[0049] Among them, each sub-process observer maps the code coverage information into its own memory after analyzing and obtaining the code coverage information of the corresponding node.
[0050] S7, sending the fuzzy test exception information summarized in the total multi-process management group and the code coverage information summarized in the total multi-process observer to the mutator, so that the mutator mutates the fuzzy test case according to the summarized fuzzy test exception information and code coverage information.
[0051] S8, repeat steps S4-S7 to perform multiple rounds of fuzzy testing.
[0052] In other words, the embodiment of the present application provides a database fuzz testing method based on a cluster environment. On the one hand, a fuzz testing scheme for a database cluster environment is proposed, which expands and extends the traditional fuzz testing scheme, extracts useful information in a complex cluster environment, and serves the fuzz testing. On the other hand, based on the distributed and fuzz testing framework, process management and coverage statistics in the fuzz testing process of the database cluster are realized, and a complete implementation method is proposed, which can complete high-quality fuzz testing on the database cluster.
[0053] The overall structure of this solution is as follows Figure 2 As shown, it mainly includes the following three modules:
[0054] ①MultipleProcessManager, multi-process manager.
[0055] This application uses a process manager to manage test nodes. For test scenarios with only a single node, a single process manager is used to manage the startup, operation, destruction, and reconstruction of the main test process of this database node to ensure the availability of database connections, etc.; for cluster mode, that is, in the case of multiple nodes, the working method of the present invention is that for distributed nodes, each node is managed by a sub-process manager. This sub-process manager may be a single-process manager or a multi-process manager, that is, it also manages several sub-process managers, and finally a multi-process manager manages all sub-process managers.
[0056] The actual control flow is as follows: first, a corresponding sub-process manager is created for each node, and then all sub-process managers are uniformly registered with the multi-process manager. When it is necessary to start, run, destroy, rebuild, and other operations on the nodes of the database cluster, the multi-process manager node issues control instructions to notify the corresponding sub-process manager to perform the corresponding operations.
[0057] ②MultipleProcessGroup, multiple process management group.
[0058] This module is mainly used to record the crash information and operation logs generated by the process during the test. In addition, in the test scenario of a single database node, the sub-processes generated by the main test process during the test are also managed uniformly by this module; in a multi-node database cluster environment, the crash information and operation logs of the sub-process controller of each node and the regenerated sub-processes are uniformly recorded and managed by their respective process management groups (hereinafter referred to as sub-process management groups), and finally summarized by the multi-process management group, which summarizes the operation logs and crash information of all sub-process manager groups, and uniformly controls the exit and cleanup of sub-processes of each node.
[0059] ③MultipleObserver, multi-process observer.
[0060] For the test scenario of a single database node, during the test process, the Observer will update the coverage information in real time according to each test result, perform shared memory mapping, and then analyze the coverage and feed it back to the mutator, which will perform the mutation that may be needed and record the updated population information for the next round of testing. For multiple database cluster nodes, they cannot map the coverage information to the same shared memory because they may be distributed on different physical machines, but for the same physical machine, the coverage information of different nodes should not be mixed together. Therefore, the multi-process observer in the present invention is needed to process the coverage information of different nodes.
[0061] The sub-observers of all nodes are registered in the multi-process observer, and each sub-observer is mapped to its own shared memory or other memory space. This process ensures that different sub-processes will not form a repeated mapping relationship. After each round of fuzz testing is completed, the multi-process observer will count the coverage information of all registered observers to form a summary coverage. The fuzz tester will provide feedback after analyzing the coverage, and the mutator will then perform the mutation operations that may be needed, record the population information after mutation, and proceed to the next round of testing.
[0062] In summary, the method provided by the embodiment of the present application can realize cross-process level coverage collection. In a distributed system, a large number of database cluster nodes run in different processes and may also run in different physical environments. Traditional testing methods may cause repeated mapping of the same shared memory. The present application controls the coverage information executed by different nodes and maps them to independently managed memory spaces to ensure that the newly discovered paths are not affected by other processes, thereby generating correct coverage feedback.
[0063] In addition, the required processes can be accurately monitored, eliminating the influence of irrelevant sub-processes. Due to some characteristics of the distributed database system, some sub-processes other than the test process will appear in the node, such as daemon processes, etc. Therefore, it is necessary to use the method in the present invention to register the processes to be monitored in each node in a targeted manner, and successfully complete the fuzzy testing process without affecting the relationship between other processes in the system.
[0064] Based on the traditional database fuzzy test, the embodiment of the present application combines the distributed architecture and proposes a database fuzzy testing method based on a cluster environment. Compared with the traditional database single-node fuzzy test, the present invention opens up a new direction for cluster fuzzy testing and can adapt to the test on a massive database cluster. In other words, the fuzzy testing technology can be applied to more practical scenarios, discover more database defects and security vulnerabilities, improve the security of the database, and reduce potential risks. In addition, this architecture design adopts a stack structure, which can adapt to complex cluster scenarios and can be flexibly expanded according to actual needs to ensure resource utilization.
[0065] It should be understood that although Figure 1 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 1 At least part of the steps may include multiple steps or multiple stages. These steps or stages are not necessarily performed at the same time, but can be performed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed in turn or alternately with other steps or at least part of the steps or stages in other steps.
[0066] In one embodiment, Figure 3 As shown, a database cluster fuzzy testing system is provided, including the following program modules:
[0067] A total multi-process manager 301, in which multiple sub-process managers are registered; each sub-process manager corresponds to a node in the database cluster, and each sub-process manager is used to manage the life cycle of the test process; the total multi-process manager is used to manage all sub-process managers;
[0068] A total multi-process observer 302, in which multiple sub-process observers are registered; each sub-process observer corresponds to a node in the database cluster, and each sub-process observer is used to analyze and obtain the code coverage information of the corresponding node during each round of fuzz testing, and each sub-process observer maps the code coverage information to its own memory; the total multi-process observer is used to summarize the code coverage information obtained by all sub-process observers, and send the summarized code coverage information to the mutator;
[0069] A total multi-process management group 303, in which multiple sub-process management groups are registered; each sub-process management group corresponds to a sub-process manager, and each sub-process management group is used to record and manage the fuzz test exceptions of the corresponding sub-process manager; the total multi-process management group is used to summarize the fuzz test exception information recorded and managed by all sub-process managers, and send the summarized fuzz test exception information to the mutator.
[0070] The specific implementation content of each module can be found in the above definition of a database cluster fuzz testing method, which will not be repeated here.
[0071] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 4 As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. The processor of the computer device is used to provide computing and control capabilities, and the network interface is used to communicate with an external terminal through a network connection. The computer device implements the above-mentioned database cluster fuzzy testing method by loading and running a computer program.
[0072] Those skilled in the art will understand that Figure 4 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0073] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, which involves all or part of the processes in the above-mentioned embodiment method.
[0074] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
Claims
1. A database cluster fuzzy testing method, characterized in that: include: S1, for each node in the database cluster, create a corresponding sub-process manager and sub-process observer, and for each sub-process manager, create a corresponding sub-process management group; S2, register all sub-process managers in the total multi-process manager, register all sub-process observers in the total multi-process observer, and register all sub-process management groups in the total multi-process management group; S3, using the fuzz tester to generate fuzz test cases and start the total multi-process manager; S4, sending the fuzzy test case to the general multi-process manager, and sending control instructions to all sub-process managers through the general multi-process manager, so that all sub-process managers use the fuzzy test case to start the test process on the corresponding node and perform a round of fuzzy testing; S5, in the current fuzzy testing process, using each sub-process management group to record and manage the fuzzy test exception information in the corresponding sub-process manager, and summarizing the fuzzy test exception information recorded and managed by all sub-process managers in the total multi-process management group; S6, in the current fuzz testing process, using each sub-process observer to analyze and obtain the code coverage information of the corresponding node, and summarizing the code coverage information obtained by all sub-process observers in the total multi-process observer; S7, sending the fuzzy test exception information summarized in the total multi-process management group and the code coverage information summarized in the total multi-process observer to the mutator, so that the mutator mutates the fuzzy test case according to the summarized fuzzy test exception information and code coverage information; S8, repeat steps S4-S7 to perform multiple rounds of fuzzy testing.
2. The database cluster fuzzy testing method according to claim 1, characterized in that: The fuzzy test exception information includes the crash information and operation log generated by the test process during the test.
3. The database cluster fuzzy testing method according to claim 1, characterized in that: After analyzing and obtaining the code coverage information of the corresponding node, each sub-process observer maps the code coverage information into its own memory.
4. The database cluster fuzzy testing method according to claim 1, characterized in that: For a cluster node containing a single node in the database cluster, the sub-process manager created is a single-process manager, and the sub-process observer created is a single-process observer; for a cluster node containing multiple nodes in the database cluster, the sub-process manager created is a multi-process manager, and the sub-process observer created is a multi-process observer.
5. The database cluster fuzzy testing method according to claim 1, characterized in that: The fuzzy tester is American Fuzzy Lop or American Fuzzy Lop plus plus.
6. The database cluster fuzzy testing method according to claim 1, characterized in that: The overall multi-process manager is started through a configuration file and a corresponding startup script.
7. A database cluster fuzzy testing system, characterized in that: include: A total multi-process manager, in which a plurality of sub-process managers are registered; each sub-process manager corresponds to a node in the database cluster, and each sub-process manager is used to manage the life cycle of the test process; the total multi-process manager is used to manage all sub-process managers; A total multi-process observer, in which a plurality of sub-process observers are registered; each sub-process observer corresponds to a node in the database cluster, and each sub-process observer is used to analyze and obtain the code coverage information of the corresponding node in each round of fuzz testing, and each sub-process observer maps the code coverage information to its own memory; the total multi-process observer is used to summarize the code coverage information obtained by all sub-process observers, and send the summarized code coverage information to the mutator; A total multi-process management group, in which multiple sub-process management groups are registered; each sub-process management group corresponds to a sub-process manager, and each sub-process management group is used to record and manage the fuzz test exceptions of the corresponding sub-process manager; the total multi-process management group is used to summarize the fuzz test exception information recorded and managed by all sub-process managers, and send the summarized fuzz test exception information to the mutator.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Parallel fuzzy test scheduling method and device based on variation strategies
CN110147310A
Intelligent fuzzy test method, device and system
CN112181833A
Distributed parallel fuzzy test method and system based on dynamic centralized scheduling
CN113590281A
Database test method, database system, electronic equipment and storage medium
CN116089275A
Fuzzy testing a software system
EP4276630A1
