Process observation method and apparatus, electronic device, and readable storage medium

By generating and installing interceptors to the kernel virtual machine in user mode and binding system call functions, the problem of high performance overhead and limited observation points of existing process observation tools is solved, real-time and accurate monitoring of malicious processes is achieved, and the system is enhanced. Security.

WO2024183409A1PCT designated stage expired Publication Date: 2024-09-12CHINA TELECOM CLOUD TECH CO LTD

Patent Information

Application Number
PCT/CN2023/140351
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-03-09
Filing Date
2023-12-20
Publication Date
2024-09-12

AI Technical Summary

Technical Problem

Existing process observation tools have high performance overhead and limited observation points, and cannot accurately capture malicious processes that exist for a short period of time, resulting in system security risks.

Method used

Obtain observation parameters in user mode, generate an interceptor and install it into the kernel virtual machine, bind the interceptor to the system call function, realize the observation of the process tree, reduce the number of system calls, and when the process reaches the preset interception point Trigger the interceptor for observation.

Benefits of technology

It implements process tree observation with low performance overhead, ensures real-time and accurate observation of target ancestor processes, and enhances system security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2023140351_12092024_PF_FP_ABST
    Figure CN2023140351_12092024_PF_FP_ABST
Patent Text Reader

Abstract

Embodiments of the present application relate to the field of computer technology, and provide a process observation method and apparatus, an electronic device, and a readable storage medium. The process observation method comprises: in a user mode, obtaining observation parameters inputted by a user; in the user mode, generating, according to the observation parameters, interceptors corresponding to preset interception points; installing the interceptors into a kernel-based virtual machine in a kernel mode; in the kernel-based virtual machine, binding the interceptors to system call functions of the corresponding interception points; and when a first process calls the system call function corresponding to any interception point, performing, according to a target ancestor process and a target feature attribute and by means of the interceptor bound to the system call function in the kernel-based virtual machine, an observation operation on a process tree to which the first process belongs, and when there is an observation result, outputting the observation result to the user mode for display. The observation of the running state of a process tree corresponding to a target ancestor process can be accurately carried out in real time.
Need to check novelty before this filing date? Find Prior Art

Description

Process observation method, device, electronic device and readable storage medium

[0001] CROSS-REFERENCE TO RELATED APPLICATIONS

[0002] This application claims priority to the Chinese patent application filed with the China Patent Office on March 9, 2023, with application number 202310220220.4 and application name “Process Observation Method, Device, Electronic Device and Readable Storage Medium”, all contents of which are incorporated by reference into this application. Technical Field

[0003] The present application belongs to the field of computer technology, and in particular relates to a process observation method, device, electronic device and readable storage medium. Background Art

[0004] With the development of computer technology, more and more system software has emerged. The observation of the running process of system software can ensure the security and stability of the system software operation.

[0005] Currently, process observation tools are usually used to observe system processes.

[0006] However, currently used process observation tools primarily focus on observing a single process and require extensive reading of the contents of designated file directories and frequent system calls, resulting in significant performance overhead and limited observation points. Furthermore, regarding software security, when malicious processes released by malicious programs are short-lived, it is difficult to accurately capture them, posing a significant risk to system security.

[0007] Overview

[0008] The present application provides a process observation method, device, electronic device and readable storage medium to solve the technical problems of high performance overhead and limited observation points in current software process observation methods.

[0009] In a first aspect, the present application provides a process observation method, the method comprising:

[0010] In user mode, obtain observation parameters input by the user; the observation parameters include target ancestor process, target feature attributes and preset interception points;

[0011] In user mode, an interceptor corresponding to a preset interception point is generated according to the observed parameters; and the interceptor is installed into the kernel virtual machine in kernel mode;

[0012] In the kernel virtual machine, bind the interceptor to the system call function of the corresponding interception point;

[0013] When the first process calls the system call function corresponding to any interception point, the interceptor bound to the system call function in the kernel virtual machine is used to observe the process tree to which the first process belongs based on the target ancestor process and target characteristic attributes, and output the observation results to the user state for display if there are any observation results.

[0014] In a second aspect, the present application provides a process observation system, the system comprising: a parameter transfer component, a code installation component, a kernel virtual machine, and a result display component;

[0015] The parameter transfer component is used to obtain the observation parameters input by the user and send the observation parameters to the code installation component in the user state; the observation parameters include the target ancestor process, the target feature attributes and the preset interception point;

[0016] The code installation component is used to receive the observation parameters sent by the parameter transfer component; in user mode, generate an interceptor corresponding to a preset interception point according to the observation parameters; and install the interceptor into the kernel virtual machine in kernel mode;

[0017] The kernel virtual machine is used to bind the interceptor installed by the code installation component to the system call function of the corresponding interception point; and when the first process calls the system call function corresponding to any interception point, the interceptor bound to the system call function in the kernel virtual machine is used to observe the process tree to which the first process belongs according to the target ancestor process and the target characteristic attributes; and when the observation result exists, the observation result is output to the result display component in the user state for display;

[0018] The result display component is used to obtain the observation results output by the kernel virtual machine and display the observation results in user mode.

[0019] In a third aspect, the present application provides an electronic device comprising: a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned process observation method when executing the program.

[0020] In a fourth aspect, the present application provides a readable storage medium, which, when the instructions in the storage medium are executed by a processor of an electronic device, enables the electronic device to execute the above-mentioned process observation method.

[0021] In an embodiment of the present application, an interceptor corresponding to an interception point preset in the observation parameters is generated in user mode according to the observation parameters input by the user, and then the interceptor is installed in the kernel virtual machine in kernel mode, and the interceptor is bound to the system call function of the corresponding interception point in the kernel virtual machine, and the system running process tree is observed based on the interceptor running in the kernel virtual machine. In this way, kernel functions can be adjusted, used and expanded without modifying the kernel, the number of system calls can be reduced, and low performance overhead of process tree observation can be achieved; further, binding the interceptor to the system call function of the corresponding interception point can ensure that when the process runs to the preset interception point, the interceptor bound to the system call function corresponding to the interception point is triggered to observe the process tree, and the running status of the process tree corresponding to the target ancestor process can be observed in real time and accurately according to the observation parameters set by the user. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0023] FIG1 is a flowchart of a process observation method provided by an embodiment of the present application;

[0024] FIG2 is a flowchart of another process observation method provided by an embodiment of the present application;

[0025] FIG3 is a flowchart of another process observation method provided in an embodiment of the present application;

[0026] FIG4 is a schematic diagram of a process creation logic provided in an embodiment of the present application;

[0027] FIG5 is a logic block diagram of a process observation system provided by an embodiment of the present application;

[0028] FIG6 is a logic block diagram of another process observation system provided in an embodiment of the present application;

[0029] FIG7 is a logic block diagram of an electronic device provided in an embodiment of the present application.

[0030] Reference numerals: 500 : process observation system; 510 : parameter passing component; 520 : code installation component; 530 : kernel virtual machine; 540 : result presentation component; 531 : interceptor component, 550 : data processing component; 560 : data storage component.

[0031] Detailed description

[0032] The following will be combined with the accompanying drawings to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the described embodiments are only part of the embodiments of this application, not all of them. All other embodiments derived by persons of ordinary skill in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.

[0033] FIG1 is a flowchart of a process observation method provided by an embodiment of the present application. As shown in FIG1 , the method may include:

[0034] Step 110: In user mode, obtain the observation parameters input by the user.

[0035] Among them, the observation parameters include target ancestral processes, target characteristic attributes and preset interception points.

[0036] In an embodiment of the present application, the target ancestor process is the ancestor process selected by the user to be observed, and the target ancestor process can be selected based on the PID (process identification) of the target ancestor process; the target characteristic attribute is the target characteristic attribute of the target ancestor process and its descendant processes. It should be noted that the target characteristic attribute is the information of at least one field in the PCB (process ctrl block) of the target ancestor process and its descendant processes that needs to be obtained when observing the process tree, selected by the user from the PCB of the target ancestor process and its descendant processes according to the needs of process observation.

[0037] Specifically, in the Linux system (GNU / Linux, a free and freely disseminated Unix-like operating system), the characteristic attributes of a process are described using a PCB. The PCB corresponds to a task structure, which includes fields such as the process identification number (pid), process command (comm), and process status (state). The real_parent pointer points to the task_struct structure of the parent process. By recursively accessing the real_parent through the task_struct of any process, the creation relationship of the process can be obtained, and ultimately the PCB information of process No. 1 can be obtained. By comparing whether the process ancestor is the target ancestor process PID, it is determined whether the process needs to be included in the observation range.

[0038] In an embodiment of the present application, a preset interception point is a system call corresponding to a system call operation performed when a target process is running. The target process is a target ancestor process and its descendant processes. When the target ancestor process and its descendant processes perform the system call, an observation operation is performed on the process tree corresponding to the target ancestor process. The preset interception point is at least one preset interception point, and different preset interception points correspond to different system calls. The user can input different preset interception points into the user state according to different observation needs.

[0039] Step 120: In user mode, generate an interceptor corresponding to a preset interception point according to the observation parameters; and install the interceptor into the kernel virtual machine in kernel mode.

[0040] It should be noted that, in user state, after obtaining the observation parameters input by the user and before generating the interceptor corresponding to the preset interception point based on the observation parameters, the observation parameters input by the user can also be processed, combined with the actual business logic code and compiled into an observation parameter code corresponding to the observation parameters that can be recognized by the kernel virtual machine in the kernel state, and then in user state, the step of generating the interceptor corresponding to the preset interception point based on the observation parameters is executed.

[0041] Specifically, an interceptor is an execution code generated based on user-input observation parameters and corresponding to a preset interception point. Different preset interception points correspond to different interceptors. For example, a first interceptor includes execution logic corresponding to its corresponding first preset interception point. When the target process runs to the first interception point, the first interceptor is executed and outputs an observation result corresponding to the observation parameters.

[0042] It should be noted that in the embodiments of the present application, the kernel virtual machine (VM) is an eBPF (Extended Berkeley Packet Filter) virtual machine. The eBPF virtual machine is a register-based virtual machine that uses a custom 64-bit RISC (Reduced Instruction Set Computer) instruction set. It can run just-in-time natively compiled "BPF (Berkeley Packet Filter) programs" within the Linux system kernel and can access a subset of kernel functions and memory.

[0043] In an embodiment of the present application, after an interceptor corresponding to an interception point preset in the observation parameters is generated based on the observation parameters, the interceptor is installed into a kernel virtual machine in kernel state. The kernel virtual machine may include an interceptor module, and installing the interceptor into the kernel virtual machine in kernel state may specifically include writing the execution code corresponding to the interceptor into the interceptor module in the kernel virtual machine in kernel state.

[0044] It should be noted that installing the interceptor into the kernel virtual machine in kernel state may specifically be copying the code of the interceptor into the space of the kernel virtual machine in kernel state.

[0045] Step 130: In the kernel virtual machine, bind the interceptor to the system call function of the corresponding interception point.

[0046] The system call is the set of all system calls implemented by the operating system, also known as the application programming interface (API). It is the interface between applications and the system. The main function of an operating system is to manage hardware resources and provide a good environment for application developers to enhance application compatibility. To achieve this, the kernel state provides a series of multi-kernel functions with predefined functions, also known as system call functions, which are presented to users through a set of interfaces called system calls. System calls transmit application requests to the kernel state, which then calls the corresponding kernel function to complete the required processing and returns the results to the application.

[0047] In an embodiment of the present application, binding the interceptor to the system call function of the corresponding interception point is specifically as follows: after installing the interceptor into the kernel virtual machine in kernel state, in the kernel virtual machine, the interceptor corresponding to the preset interception point is bound to the system call function corresponding to the preset interception point provided by the kernel virtual machine, so that when the first process calls the system call function corresponding to the interception point, the interceptor bound to the system call function is triggered to execute, that is, the execution code of the interceptor is executed, and the process tree to which the first process belongs is observed.

[0048] Step 140: When the first process calls the system call function corresponding to any interception point, the interceptor bound to the system call function in the kernel virtual machine is used to observe the process tree to which the first process belongs according to the target ancestor process and target characteristic attributes, and output the observation results to the user state for display if there are any observation results.

[0049] It should be noted that the first process is any process in the currently running system process. The first process can be the target ancestor process and any process in the descendant process of the target ancestor process, or it can be a non-target ancestor process and the descendant process of the non-target ancestor process.

[0050] In an embodiment of the present application, when the first process calls the system call function corresponding to any interception point, the interceptor bound to the system call function corresponding to the interception point in the kernel virtual machine will be triggered, and the process tree to which the first process belongs will be observed by the interceptor based on the target ancestor process and target characteristic attributes in the observation parameters input by the user.

[0051] Specifically, when the first process is the target ancestor process or the descendant process of the target ancestor process, the process tree to which the first process belongs is observed according to the target ancestor process and the target characteristic attributes, and an observation result can be obtained. If an observation result exists, the step of outputting the observation result to the user state for display can be executed; when the first process is not the target ancestor process or the descendant process of the target ancestor process, the process tree to which the first process belongs is observed according to the target ancestor process and the target characteristic attributes. When it is confirmed that the first process is not the target ancestor process or the descendant process of the target ancestor process, the interceptor will terminate the observation operation on the process tree to which the first process belongs, and no observation result can be obtained. There is no need to execute the step of outputting the observation result to the user state for display if an observation result exists.

[0052] In summary, in the embodiment of the present application, an interceptor corresponding to the preset interception point in the observation parameters is generated according to the observation parameters input by the user in the user state, and then the interceptor is installed in the kernel virtual machine in the kernel state, and the interceptor is bound to the system call function of the corresponding interception point in the kernel virtual machine, and the system running process tree is observed based on the interceptor running in the kernel virtual machine. In this way, the kernel functions can be adjusted, used and expanded without modifying the kernel, the number of system calls can be reduced, and low performance overhead of process tree observation can be achieved; further, binding the interceptor to the system call function of the corresponding interception point can ensure that when the process runs to the preset interception point, the interceptor bound to the system call function corresponding to the interception point is triggered to observe the process tree, and the running status of the process tree corresponding to the target ancestor process can be observed in real time and accurately according to the observation parameters set by the user.

[0053] FIG2 is a flowchart of another process observation method provided by an embodiment of the present application. As shown in FIG2 , the method may include:

[0054] Step 210: In user mode, obtain the observation parameters input by the user.

[0055] This step can be referred to the detailed description of step 110 and will not be repeated here.

[0056] Step 220: In user mode, generate an interceptor corresponding to a preset interception point according to the observation parameters; and install the interceptor into the kernel virtual machine in kernel mode.

[0057] This step can be referred to the detailed description of step 120 and will not be repeated here.

[0058] Step 230: In the kernel virtual machine, write the interceptor code into the header information of the system call function corresponding to the interception point provided by the kernel virtual machine.

[0059] Specifically, the system call function includes a head space and a tail space for execution of the system call function. Header information of the system call function is stored in the head space of the system call function. The head information may be empty before executing step 230.

[0060] In an embodiment of the present application, in the kernel virtual machine, after the code of the interceptor is written into the header information of the system call function corresponding to the interception point provided by the kernel virtual machine, a jump instruction can be set in the header information of the system call function corresponding to the interception point. When the first process calls the system call function corresponding to the interception point, the jump instruction in the header information of the system call function is executed, and the process jumps to the interceptor written in the header information of the system call function and executes the code of the interceptor. After the execution of the interceptor code is completed, the process returns again through the jump instruction.

[0061] It should be noted that when the system call function is empty, when the first process calls the system call function corresponding to any interception point, that is, when the interceptor code is not written into the header information of the system call function corresponding to the interception point provided by the kernel virtual machine, the interceptor will not be triggered to execute the interceptor code.

[0062] Step 240: When the first process calls the process creation function corresponding to the process creation interception point, the first process is added to the target process set through the interceptor bound to the process creation function in the kernel virtual machine, and when it is confirmed that the ancestor process of the first process is the target ancestor process.

[0063] The preset interception point in the observation parameters input by the user includes a process creation interception point; and the system call function corresponding to the process creation interception point is a process creation function. Furthermore, in user mode, an interceptor corresponding to the preset interception point is generated based on the observation parameters, specifically a process creation interceptor corresponding to the process creation interception point. After the process creation interceptor is bound to the process creation function corresponding to the process creation interception point in the kernel virtual machine, step 240 is executed.

[0064] In an embodiment of the present application, when the first process calls the process creation function corresponding to the process creation interception point, the process creation interceptor bound to the process creation function in the kernel virtual machine is used to add the first process to the target process set when it is confirmed that the ancestor process of the first process is the target ancestor process.

[0065] It should be noted that the process creation interception point is a hook point (system call point) that intercepts the creation operation of any process in the system process. Specifically, the process creation function corresponding to the process creation interception point is sys_clone (the system call under Linux creates a child process, and the child process copies all the flag attributes of the parent process). It should be noted that sys_execve (the system call under Linux creates a child process and copies the content of the parent process) and sys_fork (the system call under Linux creates a child process and copies the content of the parent process) can also create processes or threads. Sys_execve and sys_fork are encapsulated based on sys_clone, that is, when sys_execve and sys_fork are called, sys_clone will eventually be called. Therefore, setting the process creation interception point at sys_clone can intercept the process creation operation more comprehensively.

[0066] Specifically, the ancestor process of the first process can obtain the PCB information of the first process through the program variable pointer, determine whether the direct ancestor process of the first process is the target ancestor process based on the PCB information of the direct ancestor process of the first process in the PCB information of the first process, and determine whether the direct ancestor process of the direct ancestor of the first process is the target ancestor process based on the PCB information of the direct ancestor process of the first process in the PCB information of the direct ancestor process of the first process, so as to trace back whether the target ancestor process is included in all the ancestor processes of the first process; and when it is confirmed that the target ancestor process is included in all the ancestor processes of the first process, the first process is added to the target process set; when it is confirmed that the target ancestor process is not included in all the ancestor processes of the first process, it means that the first process is not the target process that needs to be observed, and the step of adding the first process to the target process set is not executed, and the execution flow of the current process creation interceptor is ended.

[0067] In this embodiment of the present application, a target process set is created based on observation parameters input by the user and corresponding to a target ancestor process. The target process set includes the target ancestor process and its descendant processes that are currently running in the current system process. The target process set can be created based on the target ancestor process in the observation parameters, and the target ancestor process is included in the target process set as the first element of the target process set. After executing step 240, the target process set is updated to ensure that the target process set includes all currently running target processes.

[0068] It should be noted that all processes in the target process set are stored in a preset format for process family relationships. For example, if the target process set includes the target ancestor process P1, its direct descendant process P33, its direct descendant process P55, and its direct descendant process P66, then processes P1, P33, P55, and P66 are stored in the target process set in the format {P1, P1→P33, P33→P55, P55→P66}. This preset storage format allows the target process set to intuitively present the relationships between target processes corresponding to the target ancestor process, i.e., the process tree.

[0069] The target ancestor process in the observation parameter may be several different target ancestor processes, and the several different target ancestor processes correspond to several different target process sets.

[0070] In an embodiment of the present application, the first process is added to the target process set in step 240, that is, after the update of the target process set is completed, the updated target process set is the observation result when the first process is created, and the observation result is output to the user state for display.

[0071] In an embodiment of the present application, the preset interception points include process creation interception points, which can be accurately intercepted by the process creation interceptor when any descendant process of the target ancestor process is created, avoiding the problem that some processes cannot be accurately observed because they exist for a short time. When the first process calls the process creation function corresponding to the process creation interception point, the interceptor bound to the process creation function in the kernel virtual machine is used to add the first process to the target process set when it is confirmed that the ancestor process of the first process is the target ancestor process. This ensures that the target process set can be updated in real time when any descendant process of the target ancestor process is created, thereby ensuring the accuracy of the observation results output to the user state.

[0072] Optionally, step 240 may be followed by the following steps:

[0073] Step 241: When the first process calls the process destruction function corresponding to the process destruction interception point, the interceptor bound to the process destruction function in the kernel virtual machine is used to remove the first process from the target process set after confirming that the first process is in the target process set.

[0074] The preset interception points in the observation parameters input by the user may also include process-destroying interception points; and the system call function corresponding to the process-destroying interception points is a process-destroying function. Furthermore, in user mode, the interceptor corresponding to the preset interception points generated based on the observation parameters is specifically a process-destroying interceptor corresponding to the process-destroying interception points. In the kernel virtual machine, after the process-destroying interceptor is bound to the process-destroying function corresponding to the process-destroying interception point, step 241 is executed.

[0075] In an embodiment of the present application, when the first process calls the process destruction function corresponding to the process destruction interception point, the process destruction interceptor bound to the process destruction function in the kernel virtual machine will remove the first process from the target process set after confirming that the first process is in the target process set.

[0076] It should be noted that the process destruction interception point is a hook point that intercepts the destruction or exit operation of any process in the system process. Specifically, the process destruction function corresponding to the process destruction interception point can be sys_exit_group (the system call destroys the child process under Linux).

[0077] Specifically, when the first process calls the process destruction function corresponding to the process destruction interception point, whether the first process is in the target process set can be confirmed by the process identification number of the first process. The process identification number of the first process can be determined based on the PCB information of the first process.

[0078] In an embodiment of the present application, when it is confirmed that the first process is in the target process set, the first process is removed from the target process set; when it is confirmed that the first process is not in the target process set, it means that the first process is not the target process that needs to be observed, and the step of removing the first process from the target process set is not executed, and the execution flow of the current process destruction interceptor is ended.

[0079] Among them, in step 241, the first process is removed from the target process set, that is, after the update of the target process set is completed, the updated target process set is the observation result when the first process is destroyed, and the observation result is output to the user state for display.

[0080] In an embodiment of the present application, the preset interception points include not only process creation interception points but also process destruction interception points. The creation and destruction of any descendant process of the target ancestor process can be accurately intercepted by a process creation interceptor and a process destruction interceptor respectively. After any descendant process of the target ancestor process is destroyed, the process destruction operation can be accurately captured by the process destruction interceptor, and the target process set can be updated by removing the destroyed process from the target process set, further ensuring the accuracy of the observation results output to the user state.

[0081] Optionally, step 240 may be followed by the following steps:

[0082] Step 242: When the first process calls the target function corresponding to the target function interception point, through the interceptor bound to the target function in the kernel virtual machine, after confirming that the first process is in the target process set, obtain the attribute information of the target characteristic attributes of each process in the target process set.

[0083] Among them, the preset interception points in the observation parameters input by the user can also include at least one target function interception point; and the system call function corresponding to each target function interception point is the target function function; it should be noted that one target function interception point corresponds to one target function function, and different target function interception points correspond to different target function functions.

[0084] Furthermore, in user mode, an interceptor corresponding to a preset interception point is generated based on the observation parameters, specifically a target function interceptor corresponding to the target function interception point. In the kernel virtual machine, after the target function interceptor is bound to the target function function corresponding to the target function interception point, step 242 is executed.

[0085] In an embodiment of the present application, when the first process calls the target function function corresponding to the target function interception point, through the target function interceptor bound to the target function in the kernel virtual machine, when it is confirmed that the first process is in the target process set, the attribute information of the target characteristic attributes of each process in the target process set is obtained.

[0086] It should be noted that the target function interception point is a hook point that intercepts the execution of the target function of any process in the system process. Specifically, the target function interception point corresponds to different target functions. Specifically, when the target function is a write function, the target function function corresponding to the target function interception point can be sys_write (system call write under Linux); when the target function is a read function, the target function function corresponding to the target function interception point can be sys_read (system call read under Linux); when the target function is a file opening function, the target function function corresponding to the target function interception point can be sys_open (system call open file under Linux); the specific target function can be set by the user according to different process observation needs, and the embodiment of the present application does not make specific limitations on this.

[0087] Specifically, when the first process calls the target function corresponding to the target function interception point, whether the first process is in the target process set can be confirmed by the process identification number of the first process. The process identification number of the first process can be determined based on the PCB information of the first process.

[0088] In an embodiment of the present application, when it is confirmed that the first process is within the target process set, the attribute information of the target characteristic attributes of each process in the target process set is obtained; when it is confirmed that the first process is not within the target process set, it means that the first process is not the target process that needs to be observed, and the step of obtaining the attribute information of the target characteristic attributes of each process in the target process set is not executed, and the execution flow of the current target function interceptor is ended.

[0089] It should be noted that the attribute information of the target characteristic attributes of each process in the target process set is the attribute information corresponding to the target characteristic attributes obtained from the PCB information of each process in the target process set based on the target characteristic attributes in the observation parameters. It should be noted that the attribute information of the target characteristic attributes of a process can be information on all characteristic attributes in the PCB information of the process, or information on some characteristic attributes in the PCB information of the process. The user can set the target characteristic attributes according to the actual process observation and analysis needs, and this embodiment of the application does not specifically limit this.

[0090] In the embodiment of the present application, the preset interception points may include not only process creation interception points but also target function interception points. After the first process is created and when the first process calls the target function function corresponding to the target function interception point, the target function interceptor bound to the target function function in the kernel virtual machine, after confirming that the first process is in the target process set, obtains the attribute information of the target characteristic attributes of each process in the target process set. When the target function interception point input by the user calls the target function function corresponding to the target function interception point, the target ancestor process and its descendant processes can be accurately intercepted and the attribute information of the target characteristic attributes of each target process in the target process set at this time can be obtained, thereby achieving accurate observation of the running status of the process tree corresponding to the target ancestor process; in addition, the target function interception point can be adjusted according to actual observation needs, which improves the diversity and flexibility of process tree observation while ensuring the accuracy of process tree observation.

[0091] Optionally, if an observation result exists, outputting the observation result to the user state for display may include:

[0092] Sub-step 2421: Adjust the attribute information of the target characteristic attributes of each process to the observation results in a preset format.

[0093] It should be noted that, when obtaining the attribute information of the target characteristic attributes of each process in the target process set, the specific moment when the first process calls the target function function corresponding to the target function interception point can also be obtained, and the process identification number of the first process, the specific moment when the first process calls the target function function corresponding to the target function interception point, and the obtained attribute information of the target characteristic attributes of each process in the target process set are organized into an observation result in a preset format. The observation result in the preset format can be set according to specific presentation needs, and the embodiment of the present application does not make specific restrictions on this. For example, when the number of processes included in the target process set is N, the observation result in the preset format can be [{process 1, moment 1, attribute information 1}, {process 2, moment 2, attribute information 2}, ..., {process N, moment N, attribute information N}].

[0094] Sub-step 2422: Output the observation results to the user state for display.

[0095] In an embodiment of the present application, the observation results are output to the user state for display. Specifically, the observation results can be output to the data processing component of the user state, the observation results are processed by the data processing component, and a log corresponding to the observation results is generated, and the log is delivered to the result display component, and the result display component formats and displays the log corresponding to the observation results.

[0096] It should be noted that the processing of the observation results by the data processing component may specifically include sorting, deduplication, normalization, formatting and other processing operations on the observation results.

[0097] Step 250: Send the observation result to the target storage area in kernel mode, and provide a target file handle based on the target storage area.

[0098] It should be noted that the target file handle is a target file handle corresponding to the target storage area, and the user-mode display process obtains the observation result from the target storage area through the target file handle.

[0099] Step 260: The user-mode display process obtains the observation results from the target storage area by accessing the target file handle and displays them.

[0100] In the embodiment of the present application, after the kernel virtual machine sends the observation results to the target storage area in kernel mode, the user mode presentation process obtains the observation results from the target storage area by accessing the target file handle. The user mode presentation process may specifically include an observation result processing process and an observation result presentation process.

[0101] Optionally, the observation result is sent to a target storage area in kernel mode, and a target file handle based on the target storage area is provided, which may include:

[0102] Sub-step 2601: When the observation result is a target process set, the target process set is sent to a first target storage sub-area in kernel mode, and a first target file handle based on the first target storage sub-area is provided.

[0103] Sub-step 2602: When the observation result is the attribute information of the target characteristic attributes of each process, the attribute information of the target characteristic attributes of each process is sent to the second target storage sub-area in the kernel state, and a second target file handle based on the second target storage sub-area is provided.

[0104] The target storage area may include a first target storage sub-area and a second target storage sub-area; specifically, the first target sub-storage area is used to store a set of target processes, and the second target sub-storage area is used to store attribute information of target characteristic attributes of each process.

[0105] In the embodiment of the present application, the observation result may include a target process set and attribute information of target characteristic attributes of each process.

[0106] Specifically, when the first process calls the process creation function corresponding to the process creation interception point, through the interceptor bound to the process creation function in the kernel virtual machine, after confirming that the ancestor process of the first process is the target ancestor process, the first process is added to the target process set. At this time, the observation result is the target process set after the first process is added to the target process set.

[0107] When the first process calls the process destruction function corresponding to the process destruction interception point, the interceptor bound to the process destruction function in the kernel virtual machine will remove the first process from the target process set after confirming that the first process is in the target process set. At this time, the observation result is the target process set after the first process is removed from the target process set.

[0108] When the first process calls the target function function corresponding to the target function interception point, through the interceptor bound to the target function function in the kernel virtual machine, after confirming that the first process is in the target process set, the attribute information of the target characteristic attributes of each process in the target process set is obtained. At this time, the observation result is the attribute information of the target characteristic attributes of each process in the target process set.

[0109] In an embodiment of the present application, based on the correspondence between the target storage area and the target file handle, a first target file handle based on the first target storage sub-area and a second target file handle based on the second target storage sub-area are provided, so that the user-state display process can obtain observation results from the first target storage area and the second target storage area respectively by accessing the first target file handle and the second target file handle, and display them.

[0110] Optionally, after sub-step 262, the following steps may also be included:

[0111] Sub-step 263: When the target storage area is the second target storage sub-area, release the memory in the second target storage sub-area corresponding to the attribute information of the target characteristic attribute of each process.

[0112] In an embodiment of the present application, after the user-mode presentation process accesses the second target file handle, obtains the observation results from the second target storage area, processes and displays the observation results, the memory of the observation results in the second target storage sub-area can be released. Because the memory capacity of the target storage area has an upper limit, after the attribute information of the target characteristic attributes of each process stored in the second target storage area is obtained from the second target storage area by the user-mode presentation process through accessing the second target file handle, the attribute information of the target characteristic attributes of each process is processed, thereby avoiding the problem of the second target storage area being full and causing the newly generated observation results to be lost.

[0113] Optionally, when the first process calls the system call function corresponding to any interception point, an interceptor bound to the system call function in the kernel virtual machine is used to observe the process tree to which the first process belongs based on the target ancestor process and the target characteristic attributes, which may include:

[0114] Sub-step 1401: When the first process calls the system call function corresponding to any interception point, read the first information in the process control block of the first process through the interceptor bound to the system call function in the kernel virtual machine.

[0115] It should be noted that the first information in the process control block of the first process is the PCB information of the first process.

[0116] Sub-step 1402: Based on the first information, obtain second information in the process control block of each ancestor process corresponding to the first process.

[0117] In the embodiment of the present application, the process control block of the first process and the process control block of the first process's direct ancestor process are connected via a doubly linked list. Similarly, the process control blocks of the first process's direct ancestor process and the process control blocks of the first process's direct ancestor process are also connected via a doubly linked list. Therefore, based on the first information of the first process, the second information of all ancestor processes corresponding to the first process can be obtained by recursively searching the doubly linked list.

[0118] It should be noted that the ancestor processes corresponding to the first process may include {the first process's direct ancestor process, the first process's direct ancestor process's direct ancestor process, ..., process number 1 corresponding to the first process}. For example, when the first process is P66, the creation relationship of P66 is: P1 → P33 → P55 → P66, then the ancestor processes of P66 include {P1, P33, P55}; when the first process is P66, the creation relationship of P66 is: P1 → P2 → P10 → P23 → P34 → P66, then the ancestor processes of P66 include {P1, P2, P10, P23, P34}.

[0119] Among them, the second information in the process control block of each ancestor process corresponding to the first process can be the PCB information of each ancestor process corresponding to the first process.

[0120] Sub-step 1403: performing an observation operation on the process tree to which the first process belongs based on the second information and the target characteristic attribute.

[0121] Specifically, the second information and target characteristic attributes in the process control block of each ancestor process corresponding to the first process are used to observe the process tree to which the first process belongs.

[0122] Optionally, before step 130, the following steps may also be included:

[0123] Step 131: In user mode, receive an observation enable instruction.

[0124] In this embodiment of the present application, the observation enable instruction is an instruction that controls the kernel virtual machine to perform process observation. In step 120, in user mode, an interceptor corresponding to a preset interception point is generated based on the observation parameters. After the interceptor is installed in the kernel virtual machine in kernel mode, step 130 is executed based on the received observation enable instruction.

[0125] Step 132: Input the observation enable instruction into the kernel virtual machine.

[0126] Step 133: The kernel virtual machine binds the interceptor corresponding to the observation enable instruction to the system call function of the corresponding interception point.

[0127] In an embodiment of the present application, a user can input an enable observation instruction corresponding to a preset interception point based on different preset interception points. After the kernel virtual machine receives the enable observation instruction, based on the enable observation instruction corresponding to a preset interception point input by the user, the interceptor corresponding to the observation enable instruction is bound to the system call function of the corresponding interception point; after the interceptor corresponding to the observation enable instruction is bound to the system call function of the corresponding interception point, when the first process calls the system call function corresponding to the interception point, the process tree corresponding to the target ancestor process can be observed by the interceptor bound to the system call function in the kernel virtual machine.

[0128] FIG3 is a flowchart of another process observation method provided by an embodiment of the present application. As shown in FIG3 , the method may include:

[0129] Step 301, start.

[0130] Step 302: Obtain observation parameters input by the user.

[0131] In an embodiment of the present application, in user mode, observation parameters input by the user are obtained; wherein the observation parameters may include a target ancestor process, a target characteristic attribute, and a preset interception point.

[0132] Step 303: Create a target storage area.

[0133] Specifically, a target storage area is opened according to the target characteristic attributes in the observation parameters transmitted in step 302 and the current terminal device memory capacity; the target storage area is used to store the observation results output by the kernel virtual machine on the process tree.

[0134] Step 304: Install the interceptor into the kernel virtual machine and bind the interceptor to the system call function corresponding to the preset interception point.

[0135] Specifically, the interceptor is an interceptor generated according to the observation parameters and corresponding to the preset interception point in the observation parameters; the interceptor is essentially a code with certain functional significance.

[0136] Among them, installing the interceptor into the kernel virtual machine can specifically be copying the interceptor code into the space of the kernel virtual machine in kernel state; binding the interceptor with the system call function corresponding to the preset interception point can specifically be writing the interceptor code into the header information of the system call function corresponding to the interception point provided by the kernel virtual machine in the kernel virtual machine.

[0137] Step 305: Determine whether the execution reaches the preset interception point.

[0138] Specifically, during the operation of the system process, the calling of the system call function corresponding to any interception point by the first process is monitored, and when the first process calls the system call function corresponding to any interception point, it is determined that the preset interception point is executed, and step 306 is executed; when the first process does not call the system call function corresponding to any interception point, it is determined that the preset interception point is not executed, and step 308 is executed.

[0139] Step 306: Observe the process tree.

[0140] It should be noted that, when the first process calls the system call function corresponding to any interception point, after determining that the execution reaches the preset interception point, the process tree is observed.

[0141] Specifically, when the first process calls the system call function corresponding to any interception point, the interceptor bound to the system call function in the kernel virtual machine is used to observe the process tree to which the first process belongs based on the target ancestor process and target characteristic attributes.

[0142] Step 307: The observation results are sent to the target storage area.

[0143] Specifically, if an observation result exists, the observation result is sent to the target storage area. If the first process is the target ancestor process or a descendant process of the target ancestor process, the observation result exists and the observation result is sent to the target storage area. If the first process is not the target ancestor process or a descendant process of the target ancestor process, it indicates that the first process is not the target process to be observed, no observation result exists, and the execution flow of the current target function interceptor is terminated.

[0144] Step 308: Determine whether the process tree is terminated.

[0145] Specifically, if it is determined that the process tree is ended, step 309 is executed; if it is determined that the process tree is not ended, step 305 is executed.

[0146] Among them, the end of the process tree can be the case where both the target ancestor process and the descendant processes of the target ancestor process have ended. When the process tree ends, it indicates that the process tree observation task based on the target ancestor process has ended, and step 309 can be executed to end the observation of the process tree corresponding to the target ancestor process.

[0147] If it is determined that the process tree has not ended, the process returns to step 305 to continue monitoring and determine whether the system process has been executed to a preset interception point.

[0148] Step 309, end.

[0149] For example, an embodiment of the present application further provides a process observation method, which may include:

[0150] Step 401: In user mode, obtain observation parameters input by the user.

[0151] Among them, the observation parameters include the target ancestor process, target characteristic attributes and preset interception points; specifically, the PID of the target ancestor process is P1; the preset interception points include the process creation interception point corresponding to the creation of the descendant process of P1 of the target ancestor process, and the process creation function corresponding to the process creation interception point can be sys_clone, the destruction interception point corresponding to the destruction of the descendant process of P1 of the target ancestor process, and the process destruction function corresponding to the process destruction interception point can be sys_exit_group, and the target function interception point, and the target function function corresponding to the target function interception point is sys_open; the target characteristic attributes include the process command comm and the opened file name filename (file name).

[0152] Step 402: Create a target storage area.

[0153] This step can refer to the detailed description of step 303 and will not be repeated here.

[0154] Step 403: Install the interceptor into the kernel virtual machine.

[0155] Specifically, the interceptor is an interceptor generated according to the observation parameters and corresponding to the preset interception point in the observation parameters; the interceptor is essentially a code with certain functional significance.

[0156] Among them, installing the interceptor into the kernel virtual machine may specifically include copying the interceptor code into the space of the kernel virtual machine in kernel state.

[0157] Step 404: Enable the interceptor and enable the result display component.

[0158] In an embodiment of the present application, enabling the interceptor can be performed by binding the interceptor to a system call function corresponding to a preset interception point. Furthermore, binding the interceptor to a system call function corresponding to a preset interception point can be performed by writing the interceptor code into the header information of the system call function corresponding to the interception point provided by the kernel virtual machine in the kernel virtual machine.

[0159] Among them, after enabling the interceptor, when the first process calls the system call function corresponding to any interception point, the interceptor bound to the system call function in the kernel virtual machine can be used to observe the process tree to which the first process belongs based on the target ancestor process and the target characteristic attributes, and when the first process is the target ancestor process or a descendant process of the target ancestor process, there will be an observation result output. Therefore, after enabling the interceptor, the result display component must also be enabled so that the observation results output by the kernel virtual machine can be displayed in the user state in a timely manner through the result display component.

[0160] Step 405: When the first process calls the process creation function sys_clone corresponding to the process creation interception point, the first process is added to the target process set through the interceptor bound to the process creation function in the kernel virtual machine, and when it is confirmed that the ancestor process of the first process is the target ancestor process.

[0161] Exemplarily, Figure 4 is a schematic diagram of a process creation logic provided by an embodiment of the present application. As shown in Figure 4, the first process can be a P2 process. By confirming that the ancestor process of the P2 process is the P1 process, that is, the target ancestor process, the P2 process can be added to the target process set. After the P2 process is added to the target process set, the target process set can be expressed as {P1, P1→P2}; similarly, the first process can also be a P4 process. By confirming that the ancestors of the P4 process are the P2 process and the P1 process, and the P1 process is the target ancestor process, the P4 process can be added to the target process set. After the P4 process is added to the target process set, the target process set can be expressed as {P1, P1→P2, P1→P3, P2→P4}.

[0162] Step 406: When the first process calls the process destruction function sys_exit_group corresponding to the process destruction interception point, the first process is removed from the target process set through the interceptor bound to the process destruction function in the kernel virtual machine after confirming that the first process is in the target process set.

[0163] Exemplarily, as shown in Figure 4, the first process can be the P4 process. By confirming that the P4 process is in the target process set {P1, P1→P2, P1→P3, P2→P4}, the P4 process can be removed from the target process set {P1, P1→P2, P1→P3, P2→P4}. After removing the P4 process from the target process set, the target process set can be expressed as {P1, P1→P2, P1→P3}.

[0164] Step 407: When the first process calls the target function function sys_open corresponding to the target function interception point, through the interceptor bound to the target function in the kernel virtual machine, after confirming that the first process is in the target process set, the attribute information of the target characteristic attributes of each process in the target process set is obtained.

[0165] For example, as shown in FIG4 , the first process may be process P4. By confirming that process P4 is in the target process set {P1, P1→P2, P1→P3, P2→P4}, the attribute information of the target characteristic attributes of each process in the target process set can be obtained. That is, the attribute information of the target characteristic attributes of processes P1, P2, P3, and P4 can be obtained respectively, and the attribute information of the target characteristic attributes of processes P1, P2, P3, and P4 can be used as the observation result at time T4. The observation result at time T4 can be adjusted to the preset format of [{P1, T1, attribute information 1}, {P2, T2, attribute information 2}, {P3, T3, attribute information 3}, {P4, T4, attribute information 4}]; it should be noted that if process P3 has been destroyed at time T4, the obtained observation result can be [{P1, T1, attribute information 1}, {P2, T2, attribute information 2}, {P4, T4, attribute information 4}].

[0166] It should be noted that, time T1, time T2, time T3 and time T4 are the times when the P1 process, the P2 process, the P3 process and the P4 process call the system call function sys_open corresponding to the interception point respectively; file 2, file 3 and file 4 are the file names filename of the files opened when the P2 process, the P3 process and the P4 process call the system call function sys_open corresponding to the interception point respectively.

[0167] Step 408: The observation results are sent to the target storage area.

[0168] This step can be referred to the detailed description of step 307 and will not be repeated here.

[0169] Step 409: The data processing component extracts the observation results from the target storage area.

[0170] Specifically, the data processing component in the user state extracts the observation results from the target storage area, processes the observation results, generates a log corresponding to the observation results, and sends the log to the result display component.

[0171] Step 410: The result display component formats and displays the acquired observation results.

[0172] Specifically, the result display component in the user state obtains the log corresponding to the observation result sent by the data processing component, formats the log, and then displays it.

[0173] In summary, in the embodiment of the present application, an interceptor corresponding to the preset interception point in the observation parameters is generated according to the observation parameters input by the user in the user state, and then the interceptor is installed in the kernel virtual machine in the kernel state, and the interceptor is bound to the system call function of the corresponding interception point in the kernel virtual machine, and the system running process tree is observed based on the interceptor running in the kernel virtual machine. In this way, the kernel functions can be adjusted, used and expanded without modifying the kernel, the number of system calls can be reduced, and low performance overhead of process tree observation can be achieved; further, binding the interceptor to the system call function of the corresponding interception point can ensure that when the process runs to the preset interception point, the interceptor bound to the system call function corresponding to the interception point is triggered to observe the process tree, and the running status of the process tree corresponding to the target ancestor process can be observed in real time and accurately according to the observation parameters set by the user.

[0174] FIG5 is a logic block diagram of a process observation system provided by an embodiment of the present application. As shown in FIG5 , the process observation system 500 may include: a parameter transfer component 510, a code installation component 520, a kernel virtual machine 530, and a result display component 540;

[0175] The parameter transmission group 510 is used to obtain the observation parameters input by the user and send the observation parameters to the code installation component 520 in the user state; the observation parameters include the target ancestor process, the target characteristic attributes and the preset interception point;

[0176] The code installation component 520 is used to receive the observation parameters sent by the parameter transmission group 510; in user mode, generate an interceptor corresponding to a preset interception point based on the observation parameters; and install the interceptor into the kernel virtual machine 530 in kernel mode;

[0177] The kernel virtual machine 530 is used to bind the interceptor installed by the code installation component 520 to the system call function of the corresponding interception point; and when the first process calls the system call function corresponding to any interception point, the interceptor bound to the system call function in the kernel virtual machine 530 is used to observe the process tree to which the first process belongs based on the target ancestor process and the target characteristic attributes; and when the observation results exist, the observation results are output to the result display component 540 in the user state for display;

[0178] The result display component 540 is used to obtain the observation results output by the kernel virtual machine 530 and display the observation results in user mode.

[0179] Optionally, the process observation system 500 may further include a data storage component;

[0180] The data storage component is used to open a target storage area in kernel state, and the target storage area is used to receive the observation results output by the kernel virtual machine;

[0181] The result display component 540 is specifically used to obtain the observation results output by the kernel virtual machine 530 from the target storage area of ​​the data storage component and display the observation results in the user state;

[0182] The kernel virtual machine 530 is specifically used to output the observation results to the target storage area of ​​the data storage component when there are observation results, so that the user-state result display component 540 can obtain the observation results from the target storage area of ​​the data storage component and display the observation results in the user state.

[0183] Optionally, the preset interception point may include: a process creation interception point; the system call function corresponding to the process creation interception point is a process creation function;

[0184] The kernel virtual machine 530 is specifically used to, when the first process calls the process creation function corresponding to the process creation interception point, add the first process to the target process set through the interceptor bound to the process creation function in the kernel virtual machine 530, when it is confirmed that the ancestor process of the first process is the target ancestor process.

[0185] Optionally, the preset interception point may further include: a process destruction interception point; the system call function corresponding to the process destruction interception point is the process destruction function;

[0186] The kernel virtual machine 530 is specifically used to, when the first process calls the process destruction function corresponding to the process destruction interception point, remove the first process from the target process set through the interceptor bound to the process destruction function in the kernel virtual machine 530, if it is confirmed that the first process is in the target process set.

[0187] Optionally, the preset interception point may further include: at least one target function interception point; the system call function corresponding to each target function interception point is the target function function;

[0188] The kernel virtual machine 530 is specifically used to, when the first process calls the target function function corresponding to the target function interception point, obtain the attribute information of the target characteristic attributes of each process in the target process set through the interceptor bound to the target function function in the kernel virtual machine 530, when it is confirmed that the first process is in the target process set.

[0189] Optionally, the kernel virtual machine 530 is specifically configured to adjust the attribute information of the target characteristic attribute of each process into an observation result in a preset format; and output the observation result to the result display component 540 in the user state for display.

[0190] Optionally, the kernel virtual machine 530 is specifically used to, when the first process calls the system call function corresponding to any interception point, read the first information in the process control block of the first process through the interceptor bound to the system call function in the kernel virtual machine 530; based on the first information, obtain the second information in the process control block of each ancestor process corresponding to the first process; and observe the process tree to which the first process belongs based on the second information and the target characteristic attributes.

[0191] Optionally, the kernel virtual machine 530 is specifically used to write the interceptor code into the header information of the system call function corresponding to the interception point provided by the kernel virtual machine 530.

[0192] Optionally, the parameter transfer component 510 is further configured to, in user mode, receive an observation enable instruction and send the observation enable instruction to the code installation component 520;

[0193] The code installation component 520 is further configured to receive the observation enabling instruction sent by the parameter transfer component 510 and input the observation enabling instruction into the kernel virtual machine 530;

[0194] The kernel virtual machine 530 is further configured to receive the observation enable instruction input by the code installation component 520 and bind the interceptor corresponding to the observation enable instruction to the system call function of the corresponding interception point.

[0195] Optionally, FIG6 is a logic block diagram of another process observation system provided by an embodiment of the present application. As shown in FIG6 , the process observation system 500 may further include: an interceptor component 531 located in a kernel virtual machine 530, a data processing component 550, and a data storage component 560;

[0196] The kernel virtual machine 530 may include an interceptor component 531;

[0197] The code installation component 520 is specifically used to install the interceptor into the interceptor component 531 in the kernel virtual machine 530 in the kernel state;

[0198] The kernel virtual machine 530 is specifically used to bind the interceptor installed by the code installation component 520 to the system call function of the corresponding interception point through the interceptor component 531; and when the first process calls the system call function corresponding to any interception point, the interceptor bound to the system call function of the interceptor component 531 in the kernel virtual machine 530 is used to observe the process tree to which the first process belongs according to the target ancestor process and the target characteristic attributes; and when there is an observation result, the interceptor component is used to output the observation result to the target storage area in the kernel state data storage component 560.

[0199] The data storage component 560 is used to open a target storage area in the kernel state, and receive the observation results output by the interceptor component 531 in the kernel virtual machine 530 through the target storage area.

[0200] The data processing component 550 is used to obtain the observation results from the target storage area in the kernel-state data storage component 560, process the observation results to generate logs corresponding to the observation results, and send the logs to the result display component.

[0201] The result display component 540 is used to receive the log corresponding to the observation result sent by the data processing component 550, format the log corresponding to the observation result, and then display the observation result.

[0202] Optionally, the kernel virtual machine 530 is specifically configured to send the observation result to a target storage area in the kernel state data storage component 560 through the interceptor component 531;

[0203] The data storage component 560 is specifically used to provide a target file handle based on the target storage area after receiving the observation results sent by the interceptor component 531 in the kernel virtual machine 530; the user-state data processing component 550 obtains the observation results from the target storage area by accessing the target file handle.

[0204] Optionally, the target storage area includes a first target storage sub-area and a second target storage sub-area;

[0205] The kernel virtual machine 530 is specifically configured to, when the observation result is a target process set, send the target process set to the first target storage sub-area in the kernel-state data storage component 560 through the interceptor component 531; when the observation result is attribute information of target characteristic attributes of each process, send the attribute information of target characteristic attributes of each process to the second target storage sub-area in the kernel-state data storage component 560 through the interceptor component 531;

[0206] The data storage component 560 is specifically used to provide a first target file handle based on the first target storage sub-area after receiving the observation result sent by the interceptor component 531 in the kernel virtual machine 530; and provide a second target file handle based on the second target storage sub-area.

[0207] Optionally, the data storage component 560 is also used to release the memory corresponding to the attribute information of the target characteristic attributes of each process in the second target storage sub-area, after the user-state data processing component 550 obtains the observation results from the target storage area by accessing the target file handle and displays them through the result display component 540, if the target storage area is the second target storage sub-area.

[0208] In summary, in an embodiment of the present application, the observation parameters input by the user are obtained by the parameter transfer component 510 in the user state, and the observation parameters are sent to the code installation component 520. The code installation component 520 generates an interceptor corresponding to the preset interception point in the observation parameter according to the observation parameter input by the user, and then installs the interceptor into the kernel virtual machine 530 in the kernel state, and binds the interceptor to the system call function of the corresponding interception point in the kernel virtual machine 530. The system running process tree is observed based on the interceptor running in the kernel virtual machine 530, and the observation results are output to the result display component 540, and the observation results are displayed by the result display component 540. In this way, the kernel functions can be adjusted, used and expanded without modifying the kernel, the number of system calls can be reduced, and low performance overhead of process tree observation can be achieved; further, binding the interceptor to the system call function of the corresponding interception point can ensure that when the process runs to the preset interception point, the interceptor bound to the system call function corresponding to the interception point is triggered to observe the process tree, and the running status of the process tree corresponding to the target ancestor process can be observed in real time and accurately according to the observation parameters set by the user.

[0209] An embodiment of the present application provides a process observation device, which may include:

[0210] The observation parameter acquisition module is used to obtain the observation parameters input by the user in the user state; the observation parameters include the target ancestor process, target characteristic attributes and preset interception points;

[0211] The interceptor installation module is used to generate an interceptor corresponding to a preset interception point according to observation parameters in user mode; and install the interceptor into the kernel virtual machine in kernel mode;

[0212] A first interceptor binding module is used to bind the interceptor to the system call function of the corresponding interception point in the kernel virtual machine;

[0213] The process observation module is used to observe the process tree to which the first process belongs according to the target ancestor process and target characteristic attributes through the interceptor bound to the system call function in the kernel virtual machine when the first process calls the system call function corresponding to any interception point, and output the observation results to the user state for display if there are any observation results.

[0214] Optionally, the process observation module may include:

[0215] A first process observation submodule is configured to, when the first process calls a process creation function corresponding to a process creation interception point, add the first process to a target process set through an interceptor bound to the process creation function in the kernel virtual machine and confirm that an ancestor process of the first process is a target ancestor process;

[0216] The preset interception points include: a process creation interception point; and a system call function corresponding to the process creation interception point is a process creation function.

[0217] Optionally, the process observation module may include:

[0218] The second process observation submodule is configured to, when the first process calls the process destruction function corresponding to the process destruction interception point, remove the first process from the target process set through the interceptor bound to the process destruction function in the kernel virtual machine and confirming that the first process is in the target process set;

[0219] Among them, the preset interception points also include: a process destruction interception point; and the system call function corresponding to the process destruction interception point is the process destruction function.

[0220] Optionally, the process observation module may include:

[0221] The third process observation submodule is used to obtain the attribute information of the target characteristic attributes of each process in the target process set through the interceptor bound to the target function in the kernel virtual machine when the first process calls the target function corresponding to the target function interception point, and when it is confirmed that the first process is in the target process set;

[0222] Among them, the preset interception points also include: at least one target function interception point; and the system call function corresponding to each target function interception point is the target function function.

[0223] Optionally, the process observation module may include:

[0224] The observation result adjustment submodule is used to adjust the attribute information of the target characteristic attributes of each process into the observation result of the preset format;

[0225] The first observation result output submodule is used to output the observation result to the user state for display.

[0226] Optionally, the process observation module may include:

[0227] The file handle generation submodule is used to send the observation results to the target storage area in the kernel state and provide a target file handle based on the target storage area;

[0228] The second observation result output submodule is used for obtaining the observation result from the target storage area by accessing the target file handle through the user-mode display process, and displaying the result.

[0229] Optionally, the file handle generation submodule may include:

[0230] a first file handle generating unit configured to, when the observation result is a target process set, send the target process set to a first target storage sub-region in kernel mode and provide a first target file handle based on the first target storage sub-region;

[0231] a second file handle generating unit configured to, when the observation result is attribute information of the target characteristic attribute of each process, send the attribute information of the target characteristic attribute of each process to a second target storage sub-region in kernel state, and provide a second target file handle based on the second target storage sub-region;

[0232] The target storage area includes a first target storage sub-area and a second target storage sub-area.

[0233] Optionally, the process observation module may include:

[0234] an information reading submodule, configured to read, when the first process calls the system call function corresponding to any interception point, the first information in the process control block of the first process through the interceptor bound to the system call function in the kernel virtual machine;

[0235] an information acquisition submodule, configured to acquire, based on the first information, second information in a process control block of each ancestor process corresponding to the first process;

[0236] The fourth process observation submodule is used to observe the process tree to which the first process belongs based on the second information and the target characteristic attribute.

[0237] Optionally, the interceptor binding module can include:

[0238] The code writing submodule is used to write the interceptor code into the header information of the system call function corresponding to the interception point provided by the kernel virtual machine in the kernel virtual machine.

[0239] Optionally, the process observation device may further include:

[0240] An instruction receiving module, used for receiving an observation enabling instruction in a user mode;

[0241] An instruction input module, used for inputting an observation enable instruction into the kernel virtual machine;

[0242] The second interceptor binding module is used to bind the interceptor corresponding to the observation enable instruction to the system call function of the corresponding interception point by the kernel virtual machine.

[0243] Optionally, the process observation device may further include:

[0244] The memory release module is used to release the memory corresponding to the attribute information of the target characteristic attribute of each process in the second target storage sub-area when the target storage area is the second target storage sub-area.

[0245] In summary, in the embodiment of the present application, the observation parameters input by the user are obtained by the observation parameter acquisition module in the user state, and the interceptor installation module in the user state generates an interceptor corresponding to the interception point preset in the observation parameter according to the observation parameters input by the user, and then the interceptor is installed in the kernel virtual machine in the kernel state, and the first interceptor binding module in the kernel state binds the interceptor to the system call function of the corresponding interception point in the kernel virtual machine, and the process observation module in the kernel state observes the system running process tree based on the interceptor running in the kernel virtual machine. In this way, the kernel functions can be adjusted, used and expanded without modifying the kernel, the number of system calls can be reduced, and low performance overhead of process tree observation can be achieved; further, binding the interceptor to the system call function of the corresponding interception point can ensure that when the process runs to the preset interception point, the interceptor bound to the system call function corresponding to the interception point is triggered to observe the process tree, and the running status of the process tree corresponding to the target ancestor process can be observed in real time and accurately according to the observation parameters set by the user.

[0246] The present application also provides an electronic device, see Figure 7, including: a processor 701, a memory 702, and a computer program 7021 stored in the memory and executable on the processor, and when the processor executes the program, the process observation method of the aforementioned embodiment is implemented.

[0247] The present application also provides a 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 process observation method of the aforementioned embodiment.

[0248] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0249] It should be noted that the various information and data obtained in the embodiments of the present application are obtained with the authorization of the information / data holder.

[0250] The algorithms and displays provided herein are not inherently related to any particular computer, virtual system, or other device. Various general-purpose systems may also be used together with the teachings herein. Based on the above description, it is apparent that the structure required for constructing such systems is suitable. In addition, the present application is not directed to any specific programming language. It should be understood that various programming languages ​​may be utilized to implement the present application described herein, and the description of the specific languages ​​above is provided for the purpose of disclosing the preferred embodiment of the present application.

[0251] In the description provided herein, a large number of specific details are described. However, it is understood that the embodiments of the present application can be practiced without these specific details. In some instances, well-known methods, structures, and techniques are not shown in detail so as not to obscure the understanding of this description.

[0252] Similarly, it should be understood that in order to streamline the present application and aid in understanding one or more of the various inventive aspects, in the above description of the exemplary embodiments of the present application, various features of the present application are sometimes grouped together into a single embodiment, figure, or description thereof. However, this disclosed method should not be interpreted as reflecting an intention that the claimed application requires more features than are expressly recited in each claim. Rather, as reflected in the claims below, inventive aspects lie in fewer than all the features of the individual embodiments disclosed above. Accordingly, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim itself serving as a separate embodiment of the present application.

[0253] It will be appreciated by those skilled in the art that the components of the devices in the embodiments may be adaptively changed and arranged in one or more devices different from the embodiments. The components or units or assemblies in the embodiments may be combined into one component or unit or assembly, and further may be divided into a plurality of sub-assemblies or sub-units or sub-assemblies. All features disclosed in this specification (including the accompanying claims, abstract and drawings) and all processes or units of any method or device so disclosed may be combined in any combination, except that at least some of such features and / or processes or units are mutually exclusive. Unless expressly stated otherwise, each feature disclosed in this specification (including the accompanying claims, abstract and drawings) may be replaced by an alternative feature providing the same, equivalent or similar purpose.

[0254] The various component embodiments of the present application can be implemented in hardware, or in software components running on one or more processors, or in a combination thereof. Those skilled in the art will appreciate that a microprocessor or digital signal processor (DSP) can be used in practice to implement some or all of the functions of some or all of the components in the sorting device according to the present application. The present application can also be implemented as a device or apparatus program for executing part or all of the methods described herein. Such a program implementing the present application can be stored on a computer-readable medium, or can have the form of one or more signals. Such a signal can be downloaded from an Internet website, or provided on a carrier signal, or provided in any other form.

[0255] It should be noted that the above embodiments illustrate rather than limit the present application, and that a person skilled in the art may devise alternative embodiments without departing from the scope of the appended claims. In the claims, any reference symbols placed between brackets should not be construed as limiting the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The present application may be implemented by means of hardware comprising several different elements and by means of appropriately programmed computers. In a unit claim enumerating several means, several of these means may be embodied by the same item of hardware. The use of the words first, second, and third etc. does not indicate any order. These words may be interpreted as names.

[0256] The user information involved in this application (including but not limited to the user's device information, user personal information, etc.) and related data are all information authorized by the user or authorized by all parties.

[0257] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0258] The above are only preferred embodiments of the present application and are not intended to limit the present application. Any modifications, equivalent replacements, and improvements made within the spirit and principles of the present application should be included in the scope of protection of the present application.

[0259] The above are only specific embodiments of the present application, but the scope of protection of this application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.

Claims

1. A process observation method, characterized in that: include: In user mode, obtain the observation parameters input by the user; The observation parameters include target ancestral processes, target characteristic attributes and preset interception points; In user mode, generating an interceptor corresponding to the preset interception point according to the observation parameter; And installing the interceptor into the kernel virtual machine in kernel state; In the kernel virtual machine, binding the interceptor to the system call function corresponding to the interception point; When the first process calls the system call function corresponding to any interception point, the interceptor bound to the system call function in the kernel virtual machine is used to observe the process tree to which the first process belongs according to the target ancestor process and target characteristic attributes, and output the observation results to the user state for display if there are any.

2. The method according to claim 1, characterized in that: The preset interception point includes: a process creation interception point; the system call function corresponding to the process creation interception point is a process creation function; When the first process calls the system call function corresponding to any interception point, the interceptor bound to the system call function in the kernel virtual machine is used to observe the process tree to which the first process belongs according to the target ancestor process and the target characteristic attribute, including: When the first process calls the process creation function corresponding to the process creation interception point, the first process is added to the target process set through the interceptor bound to the process creation function in the kernel virtual machine and the ancestor process of the first process is confirmed to be the target ancestor process.

3. The method according to claim 2, characterized in that The preset interception point also includes: a process destruction interception point; the system call function corresponding to the process destruction interception point is a process destruction function; When the first process calls the system call function corresponding to any interception point, the interceptor bound to the system call function in the kernel virtual machine is used to observe the process tree to which the first process belongs according to the target ancestor process and the target characteristic attribute, including: When the first process calls the process destruction function corresponding to the process destruction interception point, the interceptor bound to the process destruction function in the kernel virtual machine will remove the first process from the target process set if it is confirmed that the first process is in the target process set.

4. The method according to claim 2, characterized in that: The preset interception point also includes: at least one target function interception point; the system call function corresponding to each target function interception point is the target function function; When the first process calls the system call function corresponding to any interception point, the interceptor bound to the system call function in the kernel virtual machine is used to observe the process tree to which the first process belongs according to the target ancestor process and the target characteristic attribute, including: When the first process calls the target function function corresponding to the target function interception point, through the interceptor bound to the target function function in the kernel virtual machine, when it is confirmed that the first process is in the target process set, the attribute information of the target characteristic attributes of each process in the target process set is obtained.

5. The method according to claim 4, characterized in that The step of outputting the observation result to the user state for display when the observation result exists includes: Adjust the attribute information of the target characteristic attributes of each process into observation results in a preset format; The observation results are output to the user state for display.

6. The method according to claim 4, characterized in that The step of outputting the observation result to the user state for display when the observation result exists includes: Sending the observation result to a target storage area in kernel mode, and providing a target file handle based on the target storage area; The display process in user mode obtains the observation result from the target storage area by accessing the target file handle, and displays it.

7. The method according to claim 6, characterized in that The target storage area includes a first target storage sub-area and a second target storage sub-area; The step of sending the observation result to a target storage area in kernel mode and providing a target file handle based on the target storage area includes: In the case where the observation result is the target process set, sending the target process set to a first target storage sub-area in kernel mode, and providing a first target file handle based on the first target storage sub-area; In the case where the observation result is the attribute information of the target characteristic attribute of each process, the attribute information of the target characteristic attribute of each process is sent to the second target storage sub-area in kernel state, and a second target file handle based on the second target storage sub-area is provided.

8. The method according to claim 1, characterized in that When the first process calls the system call function corresponding to any interception point, the interceptor bound to the system call function in the kernel virtual machine is used to observe the process tree to which the first process belongs according to the target ancestor process and the target characteristic attribute, including: When the first process calls the system call function corresponding to any interception point, reading the first information in the process control block of the first process through the interceptor bound to the system call function in the kernel virtual machine; Based on the first information, obtaining second information in the process control block of each ancestor process corresponding to the first process; An observation operation is performed on the process tree to which the first process belongs based on the second information and the target characteristic attribute.

9. The method according to claim 1, characterized in that: The step of binding the interceptor to the system call function corresponding to the interception point in the kernel virtual machine includes: In the kernel virtual machine, the code of the interceptor is written into the header information of the system call function corresponding to the interception point provided by the kernel virtual machine.

10. The method according to claim 1, characterized in that In the kernel virtual machine, before binding the interceptor to the system call function corresponding to the interception point, the method further includes: In user mode, receiving an observation enable instruction; Inputting the observation enabling instruction into the kernel virtual machine; The kernel virtual machine binds the interceptor corresponding to the observation enable instruction to the system call function corresponding to the interception point.

11. The method according to claim 7, characterized in that After the display process in the user state accesses the target file handle, obtains the observation result from the target storage area, and displays it, the method further includes: In a case where the target storage area is a second target storage sub-area, memory in the second target storage sub-area corresponding to the attribute information of the target characteristic attributes of each process is released.

12. A process observation system, characterized in that: include: Parameter passing component, code installation component, kernel virtual machine and result display component; The parameter transfer component is used to, in user mode, obtain the observation parameters input by the user and send the observation parameters to the code installation component; The observation parameters include target ancestral processes, target characteristic attributes and preset interception points; The code installation component is used to receive the observation parameter sent by the parameter transfer component; in user mode, generate an interceptor corresponding to the preset interception point according to the observation parameter; and install the interceptor into the kernel virtual machine in kernel mode; The kernel virtual machine is used to bind the interceptor installed by the code installation component to the system call function corresponding to the interception point; and when the first process calls the system call function corresponding to any interception point, the interceptor bound to the system call function in the kernel virtual machine is used to observe the process tree to which the first process belongs according to the target ancestor process and the target characteristic attribute; and when there is an observation result, the observation result is output to the result display component in the user state for display; The result display component is used to obtain the observation results output by the kernel virtual machine and display the observation results in user mode.

13. The process observation system according to claim 12, characterized in that: Also included is a data storage component; The data storage component is used to open a target storage area in kernel state, and the target storage area is used to receive the observation results output by the kernel virtual machine; The result display component is specifically used to obtain the observation result output by the kernel virtual machine from the target storage area of ​​the data storage component, and display the observation result in the user state; The kernel virtual machine is specifically used to output the observation results to the target storage area of ​​the data storage component when there are observation results, so that the user-state result display component can obtain the observation results from the target storage area of ​​the data storage component and display the observation results in the user state.

14. An electronic device, characterized in that: include: A processor, a memory, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the process observation method according to any one of claims 1 to 11 is implemented.

15. A readable storage medium, characterized in that: When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the process observation method described in any one of claims 1 to 11.

Citation Information

Patent Citations

  • Screenshot processing method and device and electronic equipment

    CN106201468A

  • File access tracking method and device, storage medium and terminal

    CN110955631A

  • Storage software system tuning method and device and computer readable storage medium

    CN112269536A

  • Data fusion implementation method and device for observability system

    CN112395051A

  • Process observation method and device, electronic equipment and readable storage medium

    CN115906066A

Cited By

  • File operation tracking method and device, computer equipment and storage medium

    CN119862167A