Kernel processing method, device and equipment of operating system

By statically analyzing the log information and source code of the operating system kernel crash, key variables are determined and data read and write flow diagrams are generated, and combined with multiple scheduling strategies, efficient and stable reproduction of the operating system kernel crash is achieved, and the existing technology is solved The problem of low reproduction efficiency and low success rate.

CN118467216BActive Publication Date: 2024-11-19TSINGHUA UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410178284.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-02-08
Publication Date
2024-11-19
Estimated Expiration
2044-02-08

AI Technical Summary

Technical Problem

The existing technology is inefficient and the success rate cannot be guaranteed during the reproduction of the operating system kernel crash, and the failure to effectively combine the crash site and call stack, resulting in high scheduling time complexity and high repair difficulty.

Method used

By obtaining the log information and kernel source code related to the crash event, static analysis is performed to determine key variables, generating data read and write flow diagrams and control flow diagrams, generating scheduling diagrams based on multiple scheduling strategies, and dynamically performing to efficiently and stably reproduce crashes.

Benefits of technology

It realizes efficient and stable kernel crash reproduction, reduces the difficulty of repair and improves operating system security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118467216B_ABST
    Figure CN118467216B_ABST
Patent Text Reader

Abstract

The present application provides a kernel processing method, device and equipment for an operating system, which relates to computer technology. The method includes: if a crash event occurs during the operation of the operating system, log information and kernel source code related to the crash event are obtained, and the log information and kernel source code are statically analyzed to obtain the crash information. Based on multiple key variables, multiple system call sequences input before the crash are run in the kernel source code to generate a data read and write flow graph corresponding to each system call sequence; among the generated multiple data read and write flow graphs, at least two data read and write flow graphs are grouped together, and a scheduling graph corresponding to each group is generated according to a preset scheduling strategy; each group of corresponding scheduling graphs is executed to obtain the execution result information of each group of corresponding scheduling graphs. The method of the present application can efficiently and stably reproduce kernel crashes, solving the technical problem of the difficulty of reproducing kernel crashes of operating systems.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to computer technology, and in particular to a kernel processing method, device and equipment for an operating system. Background Art

[0002] At present, with the development of computer technology, operating systems have been applied to all aspects of social production and life. As a result, people have put forward higher and higher requirements for operating system security. Once a vulnerability appears in the operating system kernel, the security of the entire operating system will not be guaranteed. Therefore, it is of great significance to discover operating system security vulnerabilities in advance and repair them immediately.

[0003] In the prior art, a method of brute force repeatedly running a system call sequence is usually chosen. This method generally uses an endless loop to continuously create new processes to run the system call that triggers the crash, in the hope that the kernel happens to form a state that can trigger the crash at some point.

[0004] However, in the prior art, since new processes need to be continuously created to run the system call that triggers the crash, in the hope that the kernel happens to form a state that can trigger the crash at some point, it will result in low efficiency and the success rate cannot be guaranteed. Summary of the invention

[0005] The present application provides a kernel processing method, device and equipment of an operating system, which are used to solve the technical problem that it is difficult to reproduce the kernel crash of the operating system.

[0006] In a first aspect, the present application provides a kernel processing method of an operating system, comprising:

[0007] If a crash event occurs during the operation of the operating system, log information and kernel source code related to the crash event are obtained, and static analysis is performed on the log information and the kernel source code to obtain crash information; wherein the crash information includes a plurality of key variables;

[0008] Based on the multiple key variables, running multiple system call sequences input before the crash in the kernel source code, generating a data read and write flow graph corresponding to each system call sequence;

[0009] Among the generated multiple data read and write flow graphs, at least two data read and write flow graphs are grouped together, and a scheduling graph corresponding to each group is generated according to a preset scheduling strategy;

[0010] Execute each group of corresponding scheduling graphs to obtain execution result information of each group of corresponding scheduling graphs, wherein the execution result information indicates whether the operating system crashes.

[0011] Furthermore, the scheduling strategy includes any one or more of the following:

[0012] Directed acyclic strategy, three-node scheduling strategy, three-node mutation strategy, high-impact priority strategy, merge execution strategy, and deduplication strategy.

[0013] Furthermore, the performing static analysis on the log information and the kernel source code to obtain crash information includes:

[0014] Determining the type of the crash event in the crash information according to the log information and the kernel source code;

[0015] Extracting multiple function call sequences at the time of the crash and multiple function call stacks causing the crash event from the log information and the kernel source code;

[0016] Find the source code position and line number of the function in the function call stack, and analyze and extract key variables under the line number of the source code position;

[0017] Generate a data flow graph and / or a control flow graph in the crash information according to the key variables;

[0018] The influence value of the key variable in the crash information is determined according to the line number of the key variable in the function call stack at the source code location.

[0019] Furthermore, the performing static analysis on the log information and kernel source code to obtain crash information includes:

[0020] Determining, according to the log information, a type of the crash event in the crash information;

[0021] Extracting multiple function call sequences at the time of the crash and multiple function call stacks causing the crash event from the log information;

[0022] Find the source code position and line number of the function in the function call stack, and analyze and extract the key variables under the line number of the source code position.

[0023] Generate a data flow graph and / or a control flow graph in the crash information according to the key variables;

[0024] The influence value of the key variable in the crash information is determined according to the line number of the key variable in the function call stack at the source code location.

[0025] Further, generating a data flow graph and / or a control flow graph in the crash information according to the key variables includes:

[0026] For each key variable, trace the data transfer of the key variable from back to front, determine the forward instruction that initiates the value of the key variable; and determine the type of the forward instruction;

[0027] If the forward instruction is a data structure related instruction, it is transferred to a preset data structure identification module for recording; or, if the forward instruction is a read, write or declaration instruction for a shared memory, it is transferred to a preset control flow graph construction module; and a data flow graph is generated according to the transferred path;

[0028] In a preset data structure identification module, the data structure to which the key variable belongs and the field position of the key variable in the structure are recorded;

[0029] In the control flow graph construction module, starting from the current position of the forward instruction, backtracking upward to find the forward code block that can run to the current position, extracting the jump condition variable of the forward code block; and for the jump condition variable, repeatedly executing the step of tracing the data transfer of the key variable from back to front to determine the forward instruction that initiates the value of the key variable;

[0030] If no forward instruction related to the jump condition variable appears at present, the next layer function is selected from the function call stack, and the data transfer of the key variable is traced from back to front for each key variable, and the step of executing the forward instruction that initiates the value of the key variable is determined until the last layer function in the last function call stack is traced to generate a control flow graph.

[0031] Furthermore, the kernel source code is compiled, and during the compilation process, each key variable in the kernel source code is plugged to obtain the plugging information of each key variable; wherein the plugging information includes different function calls respectively inserted at the front end and the back end of the key variable;

[0032] The performing static analysis on the log information and the kernel source code to obtain crash information includes:

[0033] Static analysis is performed on the log information and the compiled kernel source code to obtain crash information.

[0034] Further, based on the multiple key variables, running multiple system call sequences input before the crash in the kernel source code to generate a data read and write flow graph corresponding to each system call sequence includes:

[0035] Running multiple system call sequences input before the crash in the compiled kernel source code, and after the running is completed, obtaining the plugging result of each system call sequence according to the plugging information of the key variables called during the running process; wherein the plugging result is the executed code position, the memory address read and written, and the read and written value;

[0036] According to the instrumentation data of each system call sequence, a data read and write flow graph of each system call sequence is generated.

[0037] Further, executing each group of corresponding scheduling graphs to obtain execution result information of each group of corresponding scheduling graphs includes:

[0038] Execute the scheduling graph corresponding to each group;

[0039] For each group of corresponding scheduling graphs, if it is determined that the current scheduling graph has been executed according to the plugging information of the key variables involved in the current scheduling graph, the execution result information of the current scheduling graph is generated.

[0040] In a second aspect, the present application provides a kernel processing device of an operating system, comprising:

[0041] An acquisition module is used to acquire log information and kernel source code related to a crash event if a crash event occurs during operation of the operating system;

[0042] An analysis module, used for performing static analysis on the log information and the kernel source code to obtain crash information; wherein the crash information includes a plurality of key variables;

[0043] A first generating module is used to run multiple system call sequences input before the crash in the kernel source code based on the multiple key variables to generate a data read and write flow graph corresponding to each system call sequence;

[0044] A second generating module is used to generate a scheduling graph corresponding to each group of at least two data read and write flow graphs among the generated multiple data read and write flow graphs according to a preset scheduling strategy;

[0045] The execution module is used to execute each group of corresponding scheduling graphs to obtain execution result information of each group of corresponding scheduling graphs, wherein the execution result information indicates whether the operating system crashes.

[0046] Furthermore, the scheduling strategy includes any one or more of the following:

[0047] Directed acyclic strategy, three-node scheduling strategy, three-node mutation strategy, high-impact priority strategy, merge execution strategy, and deduplication strategy.

[0048] Furthermore, the analysis module includes:

[0049] A first determining unit, configured to determine a type of a crash event in the crash information according to the log information and the kernel source code;

[0050] A first extraction unit is used to extract multiple function call sequences at the time of the crash and multiple function call stacks causing the crash event from the log information and the kernel source code;

[0051] A second extraction unit is used to find the source code position and line number of the function in the function call stack, and analyze and extract the key variables under the line number of the source code position;

[0052] A generating unit, configured to generate a data flow graph and / or a control flow graph in the crash information according to the key variables;

[0053] The second determining unit is used to determine the influence value of the key variable in the crash information according to the line number of the key variable in the function call stack at the source code position.

[0054] Furthermore, the generating unit comprises:

[0055] A first determining subunit is used for tracing the data transfer of each key variable from back to front, determining a forward instruction for initiating the value of the key variable; and determining the type of the forward instruction;

[0056] The second determination subunit is used to transfer the forward instruction to a preset data structure identification module for recording if the forward instruction is a data structure related instruction, or transfer the forward instruction to a preset control flow graph construction module if the forward instruction is a read, write or declaration instruction for a shared memory; and generate a data flow graph according to the transferred path;

[0057] A recording subunit, used for recording, in a preset data structure identification module, the data structure to which the key variable belongs and the field position of the key variable in the structure;

[0058] A third determining subunit is used to, in the control flow graph construction module, start from the current position of the forward instruction, trace back upward to find a forward code block that can run to the current position, and extract a jump condition variable of the forward code block; and for the jump condition variable, repeatedly perform the steps of tracing the data transfer of the key variable from back to front to determine the forward instruction that initiates the value of the key variable;

[0059] The fourth determination subunit is used to select a function of the next layer from the function call stack if no forward instruction related to the jump condition variable currently appears, and continue to trace the data transfer of the key variable from back to front for each key variable, determine the step of executing the forward instruction that initiates the value of the key variable, until the last layer function in the last function call stack is traced, and a control flow graph is generated.

[0060] Furthermore, the device also includes:

[0061] The plugging module is used to compile the kernel source code, and during the compilation process, plug each key variable in the kernel source code to obtain the plugging information of each key variable; wherein the plugging information includes different function calls inserted at the front end and the back end of the key variable respectively;

[0062] The analysis module is specifically used for:

[0063] Static analysis is performed on the log information and the compiled kernel source code to obtain crash information.

[0064] Furthermore, the first generating module includes:

[0065] an acquisition unit, configured to run multiple system call sequences input before the crash in the compiled kernel, and after the running is completed, obtain the plugging result of each system call sequence according to the plugging information of the key variables called during the running process; wherein the plugging result is the executed code position, the memory address read and written, and the read and written value;

[0066] The generating unit is used to generate a data read and write flow graph of each system call sequence according to the plug-in data of each system call sequence.

[0067] Furthermore, the execution module includes:

[0068] An execution unit, used for executing each group of corresponding scheduling graphs;

[0069] The generating unit is used for generating, for each group of corresponding scheduling graphs, execution result information of the current scheduling graph if it is determined that the current scheduling graph has been executed according to the plugging information of the key variables involved in the current scheduling graph.

[0070] In a third aspect, the present application provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program executable on the processor, and when the processor executes the computer program, the method described in the first aspect is implemented.

[0071] In a fourth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, they are used to implement the method described in the first aspect.

[0072] In a fifth aspect, the present application provides a computer program product, including a computer program, which implements the method described in the first aspect when executed by a processor.

[0073] The present application provides a kernel processing method, device and equipment for an operating system. If a crash event occurs during the operation of the operating system, the log information and kernel source code related to the crash event are obtained, and the log information and the kernel source code are statically analyzed to obtain the crash information; wherein the crash information includes multiple key variables. Based on the multiple key variables, multiple system call sequences input before the crash are run in the kernel source code to generate a data read and write flow graph corresponding to each system call sequence; among the multiple data read and write flow graphs generated, at least two data read and write flow graphs are grouped together, and a scheduling graph corresponding to each group is generated according to a preset scheduling strategy; each group of corresponding scheduling graphs is executed to obtain the execution result information of each group of corresponding scheduling graphs, and the execution result information indicates whether the operating system crashes. In this solution, by statically analyzing the log information and kernel source code, the key variables that affect the kernel crash are determined, and these key variables are tracked through dynamic execution to determine the values ​​of each key variable and the relationship between them, and then the data read and write flow graphs of these key variables are further constructed. Then, at least two data read and write flow graphs are grouped together to generate multiple scheduling graphs, and it is tested whether the scheduling scheme corresponding to each scheduling graph can trigger a crash, thereby reproducing the kernel crash efficiently and stably, solving the technical problem of the difficulty of reproducing the kernel crash of the operating system. BRIEF DESCRIPTION OF THE DRAWINGS

[0074] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0075] Figure 1 A flowchart of a kernel processing method of an operating system provided in an embodiment of the present application;

[0076] Figure 2 A schematic diagram of a generation process of a scheduling diagram is provided for an embodiment of the present application;

[0077] Figure 3 A flowchart of another operating system kernel processing method provided in an embodiment of the present application;

[0078] Figure 4A flowchart of another operating system kernel processing method provided in an embodiment of the present application;

[0079] Figure 5 An overall architecture diagram of a kernel processing method of an operating system provided in an embodiment of the present application;

[0080] Figure 6 A schematic diagram of the architecture of a dynamic analysis module provided in an embodiment of the present application;

[0081] Figure 7 A schematic diagram of the structure of a kernel processing device of an operating system provided in an embodiment of the present application;

[0082] Figure 8 A schematic diagram of the structure of a kernel processing device of another operating system provided in an embodiment of the present application;

[0083] Fig. 9 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;

[0084] Fig.10 A block diagram of an electronic device provided in an embodiment of the present application.

[0085] The above drawings show clear embodiments of the present disclosure, which will be described in more detail below. These drawings and text descriptions are not intended to limit the scope of the present disclosure in any way, but to illustrate the concepts of the present disclosure to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0086] Here, exemplary embodiments will be described in detail, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present disclosure.

[0087] At present, with the development of computer technology, operating systems have been applied to all aspects of social production and life. As a result, people have put forward higher and higher requirements for operating system security. Once a vulnerability appears in the operating system kernel, the security of the entire operating system will not be guaranteed. Therefore, it is of great significance to discover operating system security vulnerabilities in advance and repair them immediately.

[0088] There are many reasons why kernel crashes cannot be triggered stably, the most important of which is the complexity of the kernel state. The operating system kernel is a huge architecture that manages the hardware and software resources of the system and provides various services for application programs to use. In order to ensure the performance, security and stability of the system, the design and implementation of the kernel is often very complicated. At the same time, due to the randomness of kernel events, the kernel state is very uncertain. For example, in order to achieve multi-tasking, the kernel will frequently switch processes. This switching is often judged in real time based on the real-time state and cannot be predicted in advance. For example, the kernel allows multiple processor cores to execute multiple tasks in parallel. Concurrently executed tasks may need to access shared resources, which may cause access conflicts. In addition, in order to respond to requests from hardware peripherals, the kernel will enter a special interrupt processing state. This strategy will suspend the current process at any time, making the kernel state even more unpredictable.

[0089] In one example, a method of repeatedly running a system call sequence by force is usually chosen. This method generally uses an endless loop to continuously create new processes to run the system call that triggers the crash, hoping that the kernel will happen to form a state that can trigger the crash at some point. However, in the prior art, since it is necessary to continuously create new processes to run the system call that triggers the crash, hoping that the kernel will happen to form a state that can trigger the crash at some point, the efficiency is low and the success rate cannot be guaranteed.

[0090] In one example, some existing solutions use a strategy for scheduling memory shared variables, but this strategy will schedule all shared variables that appear during the reproduction process, without fully combining the kernel crash scene and call stack. This causes many shared variables that are not related to the crash to be scheduled, increasing the overall scheduling time complexity and reducing efficiency. In addition, existing solutions cannot effectively delete the existing system call sequence. The current mainstream solution uses a binary search method to delete the system call sequence, which is even more powerless for crashes that cannot be stably reproduced.

[0091] In one example, fuzz testing is the mainstream technology for discovering vulnerabilities. This technology mainly involves inputting invalid, unexpected or random data into the target system to observe possible errors or anomalies. On the one hand, this technology greatly increases the success rate of discovering vulnerabilities, but on the other hand, it makes the input that triggers the vulnerability more complicated. Sometimes the same input cannot trigger a crash again. These crashes that cannot be triggered stably greatly increase the difficulty of repairing kernel bugs.

[0092] The present application provides an operating system kernel processing method, device and equipment, aiming to solve the above technical problems in the prior art.

[0093] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0094] Figure 1 A flowchart of a kernel processing method of an operating system provided in an embodiment of the present application is shown as follows: Figure 1 As shown, the method includes:

[0095] Step 101: If a crash event occurs during the operation of the operating system, log information and kernel source code related to the crash event are obtained, and the log information and kernel source code are statically analyzed to obtain crash information; wherein the crash information includes multiple key variables.

[0096] Exemplarily, the execution subject of this embodiment may be an electronic device, or a terminal device, or a kernel processing device or device of an operating system, or other devices or equipment that can execute this embodiment, without limitation. In this embodiment, the execution subject is introduced as an electronic device, and the kernel may be a Linux kernel, without limitation.

[0097] In this step, if a crash event occurs during the operation of the operating system, the log information and kernel source code of the kernel of the operating system are read, and the type of the crash event is determined by analyzing the crash scene of the kernel, extracting multiple function call sequences at the time of the crash and multiple function call stacks that may cause the crash, finding the source code position and line number of the function of the function call stack from the kernel source code, and analyzing and extracting the key variables under the line number of the source code, analyzing these key variables in combination with the function call stack, obtaining more key variables, and then generating a data flow graph, and / or a control flow graph. Further, the influence value of the key variables in the crash information can also be determined according to the line number of the key variables in the function call stack at the source code position, for example, the highest influence value is given to the key variables at the top of the function call stack, and the farther the remaining variables are from the top variables, the lower the influence value is given; for variables that are not in the function call stack but meet the data structure characteristics, an influence value lower than the key variables in the function call stack is given. Therefore, the crash information includes the type of the crash event, multiple key variables, the location of each key variable, a data flow graph and / or a control flow graph, and may further include the influence value of each key variable in the crash information.

[0098] Step 102: Based on multiple key variables, multiple system call sequences input before the crash are run in the kernel source code to generate a data read and write flow graph corresponding to each system call sequence.

[0099] Exemplarily, the kernel source code needs to be compiled first, and during the compilation process, each key variable in the kernel source code is plugged to obtain the plugging information of each key variable, and the plugging information includes different function calls inserted at the front end and the back end of the key variable. Run multiple system call sequences input before the crash in the plugged kernel, and after the operation is completed, obtain the plugging results of each system call sequence based on the plugging information of the key variables called during the operation. The plugging results are the executed code position, the memory address read and written, and the read and written values. Finally, based on the plugging data of each system call sequence, generate a data read and write flow chart for each system call sequence. Among them, the electronic device can execute multiple system call sequences sequentially. Or, execute multiple system call sequences simultaneously, without limitation.

[0100] Step 103 : Among the generated multiple data read and write flow graphs, at least two data read and write flow graphs are grouped together, and a scheduling graph corresponding to each group is generated according to a preset scheduling strategy.

[0101] Exemplarily, the data read and write flow graph is defined as inserting and dynamically analyzing the aforementioned key variables during the crash reproduction process, recording the operation information of these key variables, including the read and write types of the key variables, the target addresses of the read and write, the addresses of the structures to which they belong, etc., and forming a directed graph with these key variables as nodes and the order of access as directed edges. For each call to a system call sequence, a data read and write flow graph can be generated, that is, each system call sequence has a corresponding data read and write flow graph. If a point is selected from each of the two graphs to connect a directed edge, then this new edge represents the order of process scheduling, that is, process scheduling can be performed in the order of scheduling edges. The present application can jointly consider multiple state information, and can prioritize factors with high scheduling possibilities to reproduce the crash as soon as possible.

[0102] In this step, Figure 2 A schematic diagram of a generation process of a scheduling diagram is provided for an embodiment of the present application, such as Figure 2 As shown, in multiple data read and write flow charts, at least two data read and write flow charts are grouped together, and multiple scheduling graphs are generated according to the preset scheduling strategy and crash information. Specifically, two data read and write flow charts are given. Select the node with the largest influence value from the unscheduled nodes. Determine whether the node exists. If the node exists, mark the address accessed by the node as scheduled; randomly select two nodes that access the same address; construct a directed acyclic graph for these three nodes. If there are no unscheduled nodes, extract the nodes that access the same address to form a subgraph; traverse the subgraph, enumerate the arrangements of all three nodes, and record them as scheduled; generate the final scheduling graph.

[0103] Among them, the scheduling strategy includes any one or more of the following: directed acyclic strategy, three-node scheduling strategy, three-node mutation strategy, high-impact priority strategy, merge execution strategy, and deduplication strategy. The specific strategies are as follows:

[0104] 1. Directed acyclic strategy: When there is no loop in multiple data read and write flow graphs, this call is legal and feasible; otherwise, if there is a loop, it violates the sequential execution of the code and is an infeasible schedule.

[0105] 2. Three-node scheduling strategy: When drawing scheduling edges on the data read and write flow graph, only three nodes (nodes refer to read, write, etc.) are selected for drawing. These three nodes are required to be variables of the same type, access the same location, and at least one variable is a write operation.

[0106] 3. Three-node mutation strategy: Three nodes can draw three directed scheduling edges, so that any one of the edges can be reversed to generate a new scheduling strategy. Theoretically, there are 8 scheduling strategies for three edges, which can be reduced through the directed acyclic strategy.

[0107] 4. High-impact priority strategy: When selecting nodes, give priority to selecting from variables with high influence.

[0108] 5. Merge execution strategy: Nodes of different types or accessing different locations can be merged for execution. Variables of different types or accessing different locations do not affect each other, and these variables can be scheduled simultaneously in one execution.

[0109] 6. Deduplication strategy: According to the three-node scheduling strategy, only three nodes are selected for each scheduling to draw the scheduling edge. For other nodes of the same type and accessing the same position, they are executed sequentially. This operation can be regarded as drawing a sequentially executed scheduling edge. Therefore, in this case, all three nodes of the same type and position will be traversed and the current sequentially executed scheduling edge will be marked as scheduled.

[0110] Step 104: execute each group of corresponding scheduling graphs to obtain execution result information of each group of corresponding scheduling graphs, where the execution result information indicates whether the operating system crashes.

[0111] Exemplarily, the electronic device can execute each group of corresponding scheduling graphs in sequence to obtain the execution result information of each group of corresponding scheduling graphs, the execution result information represents whether the operating system crashes, and after determining the execution result information of the current scheduling graph, the next scheduling graph is executed, and so on, all the scheduling graphs that cause the crash can be obtained, and then the scheduling graph that triggers the crash event, the key variables in the scheduling graph, the source code location of the key variables, etc. can be verified.

[0112] In an embodiment of the present application, if a crash event occurs during the operation of the operating system, log information and kernel source code related to the crash event are obtained, and static analysis is performed on the log information and kernel source code to obtain crash information; wherein the crash information includes multiple key variables. Based on multiple key variables, multiple system call sequences input before the crash are run in the kernel source code to generate a data read and write flow graph corresponding to each system call sequence. Among the multiple data read and write flow graphs generated, at least two data read and write flow graphs are grouped together, and a scheduling graph corresponding to each group is generated according to a preset scheduling strategy. Each group of corresponding scheduling graphs is executed to obtain execution result information of each group of corresponding scheduling graphs, and the execution result information represents whether the operating system has crashed. In this solution, by statically analyzing the log information and kernel source code, the key variables that affect the kernel crash are determined, and these key variables are tracked through dynamic execution to determine the values ​​of each key variable and the relationship between them, and then the data read and write flow graphs of these key variables are further constructed. Then, at least two data read and write flow graphs are grouped together to generate multiple scheduling graphs, and it is tested whether the scheduling scheme corresponding to each scheduling graph can trigger a crash, thereby reproducing the kernel crash efficiently and stably, solving the technical problem of the difficulty of reproducing the kernel crash of the operating system.

[0113] Figure 3 A flowchart of another operating system kernel processing method provided in an embodiment of the present application is shown in FIG. Figure 3 As shown, the method includes:

[0114] Step 201: If a crash event occurs during the operation of the operating system, log information and kernel source code related to the crash event are obtained.

[0115] For example, Figure 4 A flowchart of another operating system kernel processing method provided in an embodiment of the present application is shown as follows: Figure 4As shown, it includes: kernel source code module, kernel crash log module, kernel crash call stack information extraction module, data flow graph construction module, data structure identification module, control flow graph construction module, and influence judgment module. Specifically, the kernel crash call stack information module refers to the crash scene printed by the kernel log when the kernel crashes, including the crash location of the kernel and the function call stack running to the location; the data flow graph construction module refers to the possible direction of data transmission in the code; the data structure identification module refers to the data structure to which the current variable belongs; the control flow graph construction module refers to the possible direction of the current code running; the influence judgment module refers to the possibility of the current variable causing the crash. The extracted crash information mainly includes the following three types: one is the type and data structure of the key variable. This key information is the most basic attribute of the variable. On the one hand, the data structure information can be used to analyze the same type of variables that do not belong to the function call stack. On the other hand, different types of key variables do not affect each other during dynamic scheduling; the second is the location of the key variable, which is used for subsequent insertion of piles at this location to realize functions such as recording and switching processes; the third is the influence of the variable. The key variable with a larger influence value will be scheduled for testing first.

[0116] In this step, if a crash event occurs during the operation of the operating system, the electronic device obtains log information and kernel source code related to the crash event in the kernel crash log module.

[0117] Step 202, compile the kernel source code, and during the compilation process, insert a stub for each key variable in the kernel source code to obtain the insertion information of each key variable; wherein the insertion information includes different function calls inserted at the front end and the back end of the key variable respectively.

[0118] For example, since it is difficult to perform static analysis on the kernel source code, the kernel source code needs to be compiled into an LLVM bitcode intermediate file to facilitate the static analysis framework to analyze the code. During the compilation process, each key variable in the kernel source code is plugged according to a preset plugging module to obtain the plugging information of each key variable, which includes different function calls inserted at the front end and the back end of the key variable.

[0119] Step 203: Determine the type of the crash event in the crash information according to the log information and the compiled kernel source code.

[0120] Exemplarily, the electronic device judges and determines the type of the crash event in the crash information according to the log information and the compiled kernel source code.

[0121] Step 204: extract multiple function call sequences at the time of the crash and multiple function call stacks that caused the crash event from the log information and the kernel source code.

[0122] For example, Figure 4 As shown, the electronic device extracts multiple function call sequences at the time of the crash and multiple function call stacks that cause the crash event in the kernel crash call stack information extraction module.

[0123] Step 205: Find the source code position and line number of the function in the function call stack, analyze and extract the key variables under the line number of the source code position.

[0124] Exemplarily, the electronic device searches for the source code location and line number of the function in each function call stack, analyzes and extracts key variables under the line number of the source code location, and obtains multiple key variables.

[0125] Step 206: Generate a data flow graph and / or a control flow graph in the crash information according to the key variables.

[0126] In one example, step 206 includes: for each key variable, tracing the data transfer of the key variable from back to front, determining the forward instruction that initiates the value of the key variable; and determining the type of the forward instruction; if the forward instruction is a data structure-related instruction, then transferring to a preset data structure identification module for recording, or, if the forward instruction is a read, write or declaration instruction for shared memory, then transferring to a preset control flow graph construction module; and generating a data flow graph according to the transferred path; in the preset data structure identification module, recording the data structure to which the key variable belongs and the field position of the key variable in the structure; in the control flow graph construction module, recording from the forward instruction to the control flow graph construction module; Starting from the current position of the instruction, trace back upward to find the forward code block that can run to the current position, and extract the jump condition variable of the forward code block; and for the jump condition variable, repeat the steps of tracing the data transfer of the key variable from back to front, and determining the forward instruction that initiates the value of the key variable; if the forward instruction related to the jump condition variable does not appear at present, select the function of the next layer from the function call stack, and continue to trace the data transfer of the key variable from back to front for each key variable, and determine the step of executing the forward instruction that initiates the value of the key variable, until the last layer function in the last function call stack is traced, and a control flow graph is generated.

[0127] For example, Figure 4As shown, the kernel source code module includes the kernel source code of the operating system. In the data flow graph construction module, the electronic device, for each key variable, tracks the data transfer of the current variable in the kernel source code from back to front, tracks which forward instruction the value of the current variable is transferred from, and determines the type of the forward instruction. If the electronic device determines that the forward instruction is a data structure-related instruction, it is transferred to the preset data structure identification module for recording. If the forward instruction is a read, write or declaration instruction for shared memory, it is transferred to the preset control flow graph construction module, and a data flow graph is generated according to the transferred path. In the preset data structure identification module, the data structure to which the key variable belongs and the field position of the key variable in the structure are recorded, and a deduplication function is included. In the preset control flow graph construction module, starting from the current position where the forward instruction is located, trace back upward to find which forward code blocks can run to the current position, and extract the jump condition variable of the forward code block and pass it into the preset data flow graph construction module, and repeat the step of "tracking the data transfer of the key variable from back to front, and determining the forward instruction that initiates the value of the key variable", that is, in the data flow graph construction module, the electronic device tracks the data transfer of the jump condition variable from back to front, and determines the forward instruction that initiates the value of the jump condition variable. Each function call stack includes multiple layers of functions. If the electronic device determines that there is no forward instruction related to the jump condition variable at present, it selects the function of the next layer from the function call stack, and continues to execute the step of "tracking the data transfer of the key variable from back to front, and determining the forward instruction that initiates the value of the key variable" for each key variable, until the last layer of function in the last function call stack is tracked to generate a control flow graph.

[0128] Step 207: Determine the influence value of the key variable in the crash information according to the line number of the key variable in the function call stack at the source code location.

[0129] For example, Figure 4 As shown, the electronic device can assign influence values ​​to variables in a preset influence judgment module. Specifically, the position of the key variable in the function call stack is determined according to the line number of the key variable in the source code position in the function call stack. For the key variable at the top of the function call stack, the influence value is the largest, and the farther the other variables are from the top variable, the lower the influence value. For variables that are not in the function call stack but meet the data structure characteristics, the influence value is lower than the influence value of the key variable in the function call stack.

[0130] Step 208: Run multiple system call sequences input before the crash in the compiled kernel, and after the run is completed, obtain the instrumentation results of each system call sequence based on the instrumentation information of the key variables called during the run; wherein the instrumentation results are the executed code location, the memory address read and written, and the read and written values.

[0131] Exemplarily, multiple system call sequences input before the crash are run in the compiled kernel, and after the run is completed, the instrumentation results of each system call sequence are obtained based on the instrumentation information of key variables called during the run. The instrumentation results are the executed code location, the memory address read and written, and the read and written values.

[0132] Step 209: Generate a data read and write flow graph for each system call sequence based on the instrumentation data for each system call sequence.

[0133] Exemplarily, a data read and write flow graph of each system call sequence is generated according to the instrumentation data of each system call sequence.

[0134] Step 210: Among the generated multiple data read and write flow graphs, at least two data read and write flow graphs are grouped together, and a scheduling graph corresponding to each group is generated according to a preset scheduling strategy.

[0135] In one example, the scheduling strategy includes any one or more of the following:

[0136] Directed acyclic strategy, three-node scheduling strategy, three-node mutation strategy, high-impact priority strategy, merge execution strategy, and deduplication strategy.

[0137] For example, this step can be referred to Figure 1 Step 103 in the above is not described in detail.

[0138] Step 211: Execute the scheduling graph corresponding to each group.

[0139] Exemplarily, each group of corresponding scheduling graphs is executed.

[0140] Step 212: for each group of corresponding scheduling graphs, if it is determined that the current scheduling graph has been executed according to the plugging information of the key variables involved in the current scheduling graph, then the execution result information of the current scheduling graph is generated.

[0141] Exemplarily, for each group of corresponding scheduling graphs, if it is determined that the current scheduling graph has been executed based on the insertion information of the key variables involved in the current scheduling graph, the execution result information of the current scheduling graph is generated. The execution result information represents whether the operating system has crashed, and then the scheduling graph that triggered the crash event, the key variables in the scheduling graph, the source code location of the key variables, etc. can be verified, so as to facilitate targeted system repairs.

[0142] Therefore, the present application realizes a kernel crash recurrence scheme combining static analysis and dynamic analysis, through static analysis of the function call stack and kernel source code when the kernel crashes, the key variables affecting the kernel crash are determined, these key variables are tracked through dynamic execution to determine the values ​​of each variable and the relationship between each other, and then the kernel crash is stably triggered by reasonable scheduling of these key variables. The core of the present application is that in the process of kernel crash recurrence, the function call stack of the kernel crash is fully utilized, and the kernel source code is guided by data flow analysis and control flow analysis, so as to analyze the key variables affecting the kernel crash, and then these key variables are recorded and tracked through dynamic execution, and the data read and write flow graph of these key variables is further constructed, and the kernel crash is reproduced through multi-strategy scheduling of the data read and write flow graph. The key technology is that based on the function call stack of the kernel crash, the kernel source code is subjected to bottom-up data flow analysis and control flow analysis to locate the key variables; when scheduling the data read and write flow graph composed of these key variables, scheduling is performed based on multiple scheduling strategies, and the control flow edges and process scheduling edges are reasonably arranged on the data read and write flow graph to generate a scheduling graph that can cause the kernel crash.

[0143] In an embodiment of the present application, if a crash event occurs during the operation of the operating system, log information and kernel source code related to the crash event are obtained. The kernel source code is compiled, and during the compilation process, each key variable in the kernel source code is plugged to obtain the plugging information of each key variable; wherein the plugging information includes different function calls inserted at the front end and the back end of the key variable, respectively. According to the log information and the compiled kernel source code, the type of the crash event in the crash information is determined. Multiple function call sequences at the time of the crash and multiple function call stacks that caused the crash event are extracted from the log information and the kernel source code. The source code position and line number to which the function of the function call stack belongs are searched, and the key variables under the line number of the source code position are analyzed and extracted. According to the key variables, a data flow graph and / or a control flow graph in the crash information are generated. According to the line number of the key variable in the function call stack at the source code position, the influence value of the key variable in the crash information is determined. Run multiple system call sequences input before the crash in the compiled kernel, and after the run is completed, obtain the instrumentation results of each system call sequence based on the instrumentation information of the key variables called during the run; wherein the instrumentation results are the executed code location, the memory address read and written, and the read and written values. Generate a data read and write flow graph for each system call sequence based on the instrumentation data of each system call sequence. Among the generated multiple data read and write flow graphs, at least two data read and write flow graphs are grouped together, and a scheduling graph corresponding to each group is generated according to a preset scheduling strategy. Execute each group of corresponding scheduling graphs. For each group of corresponding scheduling graphs, if it is determined that the current scheduling graph has been executed based on the instrumentation information of the key variables involved in the current scheduling graph, the execution result information of the current scheduling graph is generated. In this solution, by statically analyzing the log information and kernel source code, the key variables that affect the kernel crash are determined, and these key variables are tracked through dynamic execution to determine the values ​​of each key variable and the relationship between them, and then the data read and write flow graphs of these key variables are further constructed. Then, at least two data read and write flow graphs are grouped together to generate multiple scheduling graphs, and it is tested whether the scheduling scheme corresponding to each scheduling graph can trigger a crash, thereby reproducing the kernel crash efficiently and stably, solving the technical problem of the difficulty of reproducing the kernel crash of the operating system.

[0144] For example, Figure 5 The overall architecture diagram of a kernel processing method of an operating system provided in an embodiment of the present application is as follows: Figure 5 As shown, it includes: the static analysis module is used to perform static analysis on the kernel source code in combination with the function call stack when the kernel crashes, and extract key variable information. The stub module is used to use the automated analysis script to stub the key variables obtained from the static analysis during the kernel compilation process. The dynamic analysis module is used to run the stubbed kernel, extract the data read and write flow graph, and generate a scheduling graph of the data read and write flow graph according to the scheduling strategy, and trigger the crash by reasonably scheduling the scheduling graph, as follows:

[0145] 1. Static analysis module:

[0146] This module is mainly divided into two small steps: intermediate file generation and key variable information extraction

[0147] (1) Intermediate file generation

[0148] It is difficult to perform static analysis on the kernel source code, so the kernel source code needs to be compiled into an LLVM bitcode intermediate file to facilitate the static analysis framework to analyze the code. It should be noted that the kernel compilation process will first compile and generate object files for each module, and then merge the used object files into a kernel image. In order to change the behavior of kernel compilation in this process, this application modifies the compiler so that it can generate LLVM bitcode files while the kernel generates object files. The generated LLVM bitcode files cannot be merged directly, because the merged LLVM bitcode files are too large, which will seriously increase the time of static analysis. Therefore, it is necessary to first analyze the function call stack when the kernel crashes, and find the required module files, and then perform merge analysis.

[0149] (2) Extraction of key variable information

[0150] This application develops an LLVM pass for static analysis of the merged LLVM bitcode intermediate file. The pass is loaded using the opt tool that comes with LLVM. During static analysis, you need to first scan the function call stack when the kernel crashes, locate the top function call position, obtain the file path and number of code lines at that position, and traverse all instructions to find the instruction at that position as the starting point for analysis. At the same time, it is necessary to consider the situation where the target call stack has Sanitizer turned on. When the top function is a Sanitizer or kernel heap, the function call needs to be discarded and the code position at the lower level needs to be selected instead. For the instructions to be analyzed, use LLVM's use-def chain function to track data flow, and use LLVM's code block forward function to track control flow. For the key variables found, it is necessary to record their type, location, influence value and other information and export them to a file.

[0151] 2. Kernel instrumentation module:

[0152] This module is mainly divided into two steps: kernel instrumentation module development and kernel instrumentation.

[0153] (1) Kernel instrumentation module development

[0154] Before kernel plugging, it is necessary to develop the corresponding kernel plugging module first. This application writes the source code of the plugging module directly into the kernel source code, and modifies the kernel-related compilation configuration file so that the plugging module is loaded into the kernel by default. At the same time, in order to increase stability, the plugging function of this application turns on process isolation by default. Each process needs to request this kernel module separately to turn on the plugging function of the current process. The record buffer of each process is saved in the task structure of the process, and different processes do not affect each other. This module exports multiple pile functions, and the plugging tool only needs to call this function directly at the plugging position, and the plugging module and the pile function function can be smoothly linked together when the final link is made.

[0155] (2) Kernel instrumentation

[0156] This application develops an LLVM pass for instrumenting key variables of the kernel during the compilation process. The kernel compilation process will first compile and generate object files for each module, so this instrumentation pass needs to be run once when each module is compiled. The static analysis tool will save the crash information required by the instrumentation tool to the configuration file. The instrumentation tool needs to read this configuration file every time it instruments a new module. When an instruction that matches the configuration information is scanned, a different function call to the kernel instrumentation module is inserted before and after the instruction to complete the instrumentation.

[0157] 3. Dynamic analysis module:

[0158] Figure 6 A schematic diagram of the architecture of a dynamic analysis module provided in an embodiment of the present application, such as Figure 6 As shown, this module is mainly divided into two steps: dynamic single-process analysis and dynamic multi-process analysis.

[0159] (1). Dynamic single process analysis

[0160] In order to obtain available data read and write flow graphs for scheduling, this application designs a dynamic analysis manager, that is, a dynamic single-process analysis tool. This tool modifies the replay module of the fuzz testing tool Syzkaller (including executor, ipc, execprog, etc.) to support the call to the aforementioned kernel plug-in module, so that the tool can execute all system call sequences in sequence in one process. At the same time, after each system call sequence is executed, the kernel plug-in module is called to obtain the plug-in results and export them to a file. When all the input system call sequences are completed, the data read and write flow graphs for each system call sequence are generated by merging and analyzing these plug-in results and stored in the data read and write flow graph database.

[0161] (2) Dynamic multi-process analysis

[0162] The dynamic single process analysis step can obtain the data read-write flow graph of each system call sequence, and the multiple scheduling strategies proposed by the application can analyze the data read-write flow graph and generate a scheduling graph for at least two data read-write flow graphs. In order to stably realize kernel scheduling, the application has designed a process scheduling strategy based on the pile insertion function, and the read-write instruction of the key variable is protected by two pile functions before and after the pile insertion process, so for the key variable that needs to be scheduled, the pile function in front of it is used for forcing the current process to be suspended, and then continues to allow when the opportunity allows, and the pile function behind it is used to identify that the current key variable has been read and written, and notifies other processes that it can continue to execute. After a complete scheduling operation is completed, it is judged whether the kernel crashes to judge whether the reproduction is successful. In addition, in order to increase the speed, the instrument can run multiple virtual machine instances simultaneously to test by the virtual machine manager, which greatly improves efficiency.

[0163] Therefore, by directional analysis of the function call stack and multiple scheduling strategies of the kernel crash, the crash point of the kernel can be approached in a directional manner. Compared with the infinite loop and random scheduling schemes in the prior art, the present application can test process scheduling and trigger crashes faster, more accurately and more stably. In addition, by combining the crashed function call stack for static analysis, the key variables that have an impact on the function call stack can be automatically identified, and these key variables are recorded and sorted according to multiple scheduling strategies. Compared with the existing method of monitoring all variables globally, the present application can increase the efficiency of reproduction by reducing the monitoring of useless variables. Through the multi-strategy scheduling method for data read and write flow graphs, key variables that are more related to the crash can be prioritized, increasing the probability of kernel crash reproduction. Compared with the existing random scheduling scheme, the present application allows factors with greater probability to be prioritized, increasing the speed of reproduction.

[0164] Figure 7 A schematic diagram of the structure of a kernel processing device of an operating system provided in an embodiment of the present application is shown in FIG. Figure 7 As shown, the device comprises:

[0165] The acquisition module 31 is used to acquire log information and kernel source code related to a crash event if a crash event occurs during the operation of the operating system.

[0166] The analysis module 32 is used to perform static analysis on the log information and kernel source code to obtain crash information; wherein the crash information includes a plurality of key variables.

[0167] The first generating module 33 is used to run multiple system call sequences input before the crash in the kernel source code based on multiple key variables, and generate a data read and write flow graph corresponding to each system call sequence.

[0168] The second generating module 34 is used to generate a scheduling graph corresponding to each group of at least two data read / write flow graphs among the generated multiple data read / write flow graphs according to a preset scheduling strategy.

[0169] The execution module 35 is used to execute each group of corresponding scheduling graphs to obtain the execution result information of each group of corresponding scheduling graphs, and the execution result information represents whether the operating system crashes.

[0170] The device of this embodiment can execute the technical solution in the above method. Its specific implementation process and technical principles are the same and will not be repeated here.

[0171] Figure 8 A schematic diagram of the structure of a kernel processing device of another operating system provided in an embodiment of the present application, in Figure 7 Based on the embodiment shown, Figure 8 As shown, the scheduling strategy includes any one or more of the following:

[0172] Directed acyclic strategy, three-node scheduling strategy, three-node mutation strategy, high-impact priority strategy, merge execution strategy, and deduplication strategy.

[0173] Furthermore, the analysis module 32 includes:

[0174] The first determining unit 321 is used to determine the type of the crash event in the crash information according to the log information and the kernel source code.

[0175] The first extraction unit 322 is used to extract multiple function call sequences at the time of the crash and multiple function call stacks causing the crash event from the log information and the kernel source code.

[0176] The second extraction unit 323 is used to find the source code position and line number of the function in the function call stack, and analyze and extract the key variables under the line number of the source code position.

[0177] The generating unit 324 is used to generate a data flow graph and / or a control flow graph in the crash information according to the key variables.

[0178] The second determining unit 325 is used to determine the influence value of the key variable in the crash information according to the line number of the key variable in the function call stack at the source code position.

[0179] Further, the generating unit 324 includes:

[0180] The first determining subunit 3241 is used for tracing the data transfer of the key variable from back to front for each key variable, determining the forward instruction for initiating the value of the key variable; and determining the type of the forward instruction.

[0181] The second determination subunit 3242 is used to transfer the forward instruction to the preset data structure identification module for recording if it is a data structure related instruction, or to transfer the forward instruction to the preset control flow graph construction module if it is a read, write or declaration instruction of the shared memory; and generate a data flow graph according to the transferred path.

[0182] The recording subunit 3243 is used to record, in a preset data structure identification module, the data structure to which the key variable belongs and the field position of the key variable in the structure.

[0183] The third determination subunit 3244 is used to, in the control flow graph construction module, start from the current position of the forward instruction, trace back upward to find the forward code block that can run to the current position, and extract the jump condition variable of the forward code block; and for the jump condition variable, repeatedly execute the step of tracing the data transfer of the key variable from back to front to determine the forward instruction that initiates the value of the key variable.

[0184] The fourth determination subunit 3245 is used to select the next layer function from the function call stack if no forward instruction related to the jump condition variable currently appears, and continue to trace the data transfer of the key variable from back to front for each key variable, determine the step of executing the forward instruction that initiates the value of the key variable, until the last layer function in the last function call stack is traced, and a control flow graph is generated.

[0185] Furthermore, the device also includes:

[0186] The plugging module 41 is used to compile the kernel source code, and during the compilation process, plug each key variable in the kernel source code to obtain the plugging information of each key variable; wherein the plugging information includes different function calls inserted at the front end and the back end of the key variable respectively.

[0187] The analysis module 32 is specifically used for:

[0188] Perform static analysis on the log information and compiled kernel source code to obtain crash information.

[0189] Furthermore, the first generating module 33 includes:

[0190] The acquisition unit 331 is used to run multiple system call sequences input before the crash in the compiled kernel, and after the operation is completed, obtain the instrumentation results of each system call sequence based on the instrumentation information of the key variables called during the operation; wherein the instrumentation results are the executed code location, the memory address read and written, and the read and written values.

[0191] The generating unit 332 is used to generate a data read and write flow graph of each system call sequence according to the instrumentation data of each system call sequence.

[0192] Further, the execution module 35 includes:

[0193] The execution unit 351 is used to execute each group of corresponding scheduling graphs.

[0194] The generating unit 352 is used for generating the execution result information of the current scheduling graph for each group of corresponding scheduling graphs if it is determined that the current scheduling graph has been executed according to the plugging information of the key variables involved in the current scheduling graph.

[0195] The device of this embodiment can execute the technical solution in the above method. Its specific implementation process and technical principles are the same and will not be repeated here.

[0196] Fig. 9 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application is shown in FIG. Fig. 9 As shown, the electronic device includes: a memory 51 and a processor 52.

[0197] The memory 51 stores a computer program that can be executed on the processor 52 .

[0198] The processor 52 is configured to execute the method provided in the above embodiment.

[0199] The electronic device further includes a receiver 53 and a transmitter 54. The receiver 53 is used to receive instructions and data sent by an external device, and the transmitter 54 is used to send instructions and data to the external device.

[0200] Fig.10 This is a block diagram of an electronic device provided in an embodiment of the present application. The electronic device may be a mobile phone, a computer, a digital broadcast terminal, a message transceiver, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.

[0201] The device 600 may include one or more of the following components: a processing component 602 , a memory 604 , a power component 606 , a multimedia component 608 , an audio component 610 , an input / output (I / O) interface 612 , a sensor component 614 , and a communication component 616 .

[0202] The processing component 602 generally controls the overall operation of the device 600, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 602 may include one or more processors 620 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 602 may include one or more modules to facilitate the interaction between the processing component 602 and other components. For example, the processing component 602 may include a multimedia module to facilitate the interaction between the multimedia component 608 and the processing component 602.

[0203] The memory 604 is configured to store various types of data to support operations on the device 600. Examples of such data include instructions for any application or method operating on the device 600, contact data, phone book data, messages, pictures, videos, etc. The memory 604 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The power supply component 606 provides power to various components of the device 600. The power supply component 606 may include a power management system, one or more power supplies, and other components associated with generating, managing and distributing power for the device 600.

[0204] The multimedia component 608 includes a screen that provides an output interface between the device 600 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 608 includes a front camera and / or a rear camera. When the device 600 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability. The audio component 610 is configured to output and / or input audio signals. For example, the audio component 610 includes a microphone (MIC), and when the device 600 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is configured to receive external audio signals. The received audio signal may be further stored in the memory 604 or sent via the communication component 616. In some embodiments, the audio component 610 also includes a speaker for outputting the audio signal. The I / O interface 612 provides an interface between the processing component 602 and the peripheral interface module, which may be a keyboard, a click wheel, buttons, etc. These buttons may include, but are not limited to, a home button, a volume button, a start button, and a lock button.

[0205] The sensor assembly 614 includes one or more sensors for providing various aspects of status assessment for the device 600. For example, the sensor assembly 614 can detect the open / closed state of the device 600, the relative positioning of components, such as the display and keypad of the device 600, the sensor assembly 614 can also detect the position change of the device 600 or a component of the device 600, the presence or absence of user contact with the device 600, the orientation or acceleration / deceleration of the device 600 and the temperature change of the device 600. The sensor assembly 614 can include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 614 can also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 614 can also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor or a temperature sensor.

[0206] The communication component 616 is configured to facilitate wired or wireless communication between the device 600 and other devices. The device 600 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 616 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 616 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0207] In an exemplary embodiment, the apparatus 600 may be implemented by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors or other electronic components to perform the above method.

[0208] In an exemplary embodiment, a non-temporary computer-readable storage medium including instructions is also provided, such as a memory 604 including instructions, and the above instructions can be executed by the processor 620 of the device 600 to complete the above method. For example, the non-temporary computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, and an optical data storage device, etc. The embodiment of the present application also provides a non-temporary computer-readable storage medium, when the instructions in the storage medium are executed by the processor of the electronic device, the electronic device can execute the method provided by the above embodiment. The embodiment of the present application also provides a computer program product, the computer program product includes: a computer program, the computer program is stored in a readable storage medium, at least one processor of the electronic device can read the computer program from the readable storage medium, and at least one processor executes the computer program so that the electronic device executes the solution provided by any of the above embodiments.

[0209] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any modification, use or adaptation of the present disclosure, which follows the general principles of the present disclosure and includes common knowledge or customary technical means in the art that are not disclosed in the present disclosure. The specification and examples are considered to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims. It should be understood that the present disclosure is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of the present disclosure is limited only by the appended claims.

Claims

1. A kernel processing method of an operating system, characterized in that: include: If a crash event occurs during the operation of the operating system, log information and kernel source code related to the crash event are obtained, and static analysis is performed on the log information and the kernel source code to obtain crash information; wherein the crash information includes a plurality of key variables; Based on the multiple key variables, running multiple system call sequences input before the crash in the kernel source code, generating a data read and write flow graph corresponding to each system call sequence; Among the generated multiple data read and write flow graphs, at least two data read and write flow graphs are grouped together, and a scheduling graph corresponding to each group is generated according to a preset scheduling strategy; Execute each group of corresponding scheduling graphs to obtain execution result information of each group of corresponding scheduling graphs, wherein the execution result information indicates whether the operating system crashes.

2. The method according to claim 1, characterized in that The scheduling strategy includes any one or more of the following: Directed acyclic strategy, three-node scheduling strategy, three-node mutation strategy, high-impact priority strategy, merge execution strategy, and deduplication strategy.

3. The method according to claim 1, characterized in that: The performing static analysis on the log information and the kernel source code to obtain crash information includes: Determining the type of the crash event in the crash information according to the log information and the kernel source code; Extracting multiple function call sequences at the time of the crash and multiple function call stacks causing the crash event from the log information and the kernel source code; Find the source code position and line number of the function in the function call stack, and analyze and extract key variables under the line number of the source code position; Generate a data flow graph and / or a control flow graph in the crash information according to the key variables; The influence value of the key variable in the crash information is determined according to the line number of the key variable in the function call stack at the source code location.

4. The method according to claim 3, characterized in that The step of generating a data flow graph and / or a control flow graph in the crash information according to the key variables includes: For each key variable, trace the data transfer of the key variable from back to front, determine the forward instruction that initiates the value of the key variable; and determine the type of the forward instruction; If the forward instruction is a data structure related instruction, it is transferred to a preset data structure identification module for recording; or, if the forward instruction is a read, write or declaration instruction for a shared memory, it is transferred to a preset control flow graph construction module; and a data flow graph is generated according to the transferred path; In a preset data structure identification module, the data structure to which the key variable belongs and the field position of the key variable in the structure are recorded; In the control flow graph construction module, starting from the current position of the forward instruction, backtracking upward to find the forward code block that can run to the current position, extracting the jump condition variable of the forward code block; and for the jump condition variable, repeatedly executing the step of tracing the data transfer of the key variable from back to front to determine the forward instruction that initiates the value of the key variable; If no forward instruction related to the jump condition variable appears at present, the next layer function is selected from the function call stack, and the data transfer of the key variable is traced from back to front for each key variable, and the step of executing the forward instruction that initiates the value of the key variable is determined until the last layer function in the last function call stack is traced to generate a control flow graph.

5. The method according to claim 1, characterized in that The method further comprises: Compiling the kernel source code, and during the compilation process, inserting a stub for each key variable in the kernel source code to obtain the stub information of each key variable; wherein the stub information includes different function calls inserted at the front end and the back end of the key variable respectively; The performing static analysis on the log information and the kernel source code to obtain crash information includes: Static analysis is performed on the log information and the compiled kernel source code to obtain crash information.

6. The method according to claim 5, characterized in that The method of running multiple system call sequences input before the crash in the kernel source code based on the multiple key variables to generate a data read and write flow graph corresponding to each system call sequence includes: Running multiple system call sequences input before the crash in the compiled kernel, and after the running is completed, obtaining the plugging result of each system call sequence according to the plugging information of the key variables called during the running process; wherein the plugging result is the executed code position, the memory address read and written, and the read and written value; According to the instrumentation data of each system call sequence, a data read and write flow graph of each system call sequence is generated.

7. The method according to claim 5, characterized in that The executing each group of corresponding scheduling graphs to obtain the execution result information of each group of corresponding scheduling graphs includes: Execute the scheduling graph corresponding to each group; For each group of corresponding scheduling graphs, if it is determined that the current scheduling graph has been executed according to the plugging information of the key variables involved in the current scheduling graph, the execution result information of the current scheduling graph is generated.

8. A kernel processing device of an operating system, characterized in that: include: An acquisition module is used to acquire log information and kernel source code related to a crash event if a crash event occurs during operation of the operating system; An analysis module, used for performing static analysis on the log information and the kernel source code to obtain crash information; wherein the crash information includes a plurality of key variables; A first generating module is used to run multiple system call sequences input before the crash in the kernel source code based on the multiple key variables to generate a data read and write flow graph corresponding to each system call sequence; A second generating module is used to generate a scheduling graph corresponding to each group of at least two data read and write flow graphs among the generated multiple data read and write flow graphs according to a preset scheduling strategy; The execution module is used to execute each group of corresponding scheduling graphs to obtain execution result information of each group of corresponding scheduling graphs, wherein the execution result information indicates whether the operating system crashes.

9. An electronic device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program executable on the processor, and the processor implements the method according to any one of claims 1 to 7 when executing the computer program.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 7 when executed by a processor.