A debugging method for kernel memory access out-of-bounds based on global memory protection
By building a kernel monitor and a virtual kernel debugger, dynamically modifying memory page access permissions and triggering clear operations, the problem of kernel-state memory access out-of-bounds debugging is solved, and the first-time identification and dynamic analysis of kernel memory access out-of-bounds are achieved, which is suitable for Non-open source operating system.
Patent Information
- Application Number
- CN202410979870.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-22
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2044-07-22
AI Technical Summary
The existing technology makes it difficult to perform dynamic debugging and analysis immediately when a memory access out of bounds occurs in a kernel-mode program. Especially in non-open source operating systems, it is impossible to add debugging options or print statements in the kernel for auxiliary debugging, resulting in difficulty in positioning.
Build a kernel monitor and a virtual kernel debugger. By monitoring the loading process of kernel modules and threads, dynamically modify the access permissions of memory pages, and trigger clearing operations when memory access exceptions occur, to realize the identification and processing of out-of-bounds memory access, and use LibVMI Communicate with the Hypervisor and use the Hook function to monitor memory access.
It realizes the immediate detection and dynamic debugging analysis of kernel memory access out-of-bounds without operating system kernel source code, and can effectively identify and deal with kernel heap memory access out-of-bounds issues.
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of computer software development, and in particular relates to a kernel memory access out-of-bounds debugging method based on global memory protection. Background Art
[0002] A memory access out of bounds is a programming error that occurs when a program attempts to access memory beyond its allocated range. This error can cause program crashes, data corruption, undefined behavior, and security vulnerabilities. Common causes of memory access out of bounds include array out of bounds, string operation out of bounds, and pointer out of bounds. For example, when a program attempts to access an illegal index of an array, or when using a pointer to point to a memory area that does not belong to it, it will cause a memory access out of bounds. In addition, string operations without checking the string length, or incorrect memory allocation size when using functions such as malloc, can also easily cause memory access out of bounds.
[0003] According to the different running levels of programs, memory access out-of-bounds can be divided into user-mode program memory access out-of-bounds and kernel-mode program memory access out-of-bounds. In the prior art, there are many methods for locating, debugging and diagnosing user-mode program memory access out-of-bounds, and there are also many relatively effective auxiliary tools.
[0004] Problems caused by out-of-bounds memory access by kernel-mode programs often cause the operating system to experience a blue screen failure and then restart. Although this process may generate a dump file that saves memory information for subsequent problem location, the limitations of the existing mechanism make location location still very difficult. The main problems are: it is impossible to perform dynamic debugging and analysis at the scene where the exception occurs. Specifically, since the fault phenomenon has a certain lag, that is, when a memory access is out of bounds, the system often runs for a while before the kernel crashes, and the dump file generated at this time is difficult to restore the call stack information when the memory access is out of bounds. In addition, for non-open source operating systems, it is impossible to use debugging options or print statements in the kernel for auxiliary debugging. Summary of the invention
[0005] In view of this, the present invention provides a kernel memory access out-of-bounds debugging method based on global memory protection, which realizes the first-time detection of kernel memory access out-of-bounds without operating system kernel source code.
[0006] The present invention provides a kernel memory access out-of-bounds debugging method based on global memory protection, which specifically includes the following steps:
[0007] Build a kernel monitor to monitor the kernel module loading process and kernel thread creation process, and build a virtual kernel debugger to monitor heap memory access, perform heap memory area clearing, and capture memory access exceptions;
[0008] When the system to be tested is started, a kernel monitor and a virtual kernel debugger are loaded, and the kernel monitor performs monitoring of kernel modules and kernel threads; the physical memory page to which the kernel address space is mapped is recorded as the kernel physical memory page, and the virtual kernel debugger starts monitoring of heap memory access and initializes a first heap memory address list, and the first heap memory address list is used to record instruction addresses of heap memory accesses without memory access out of bounds;
[0009] During the operation of the system under test, the kernel monitor obtains the base address and module size of the kernel module when detecting the loading operation of the kernel module, obtains the stack base address and stack limit of the new thread when detecting the kernel creating a new thread, and sends the base address and module size, the stack base address and stack limit to the virtual kernel debugger;
[0010] The virtual kernel debugger saves the received base address and module size in the first kernel module address list, saves the address space determined by the stack base address and the stack limit in the kernel stack memory list; sets the memory area in the kernel physical memory page other than the memory area recorded in the first stack memory address list and the kernel stack memory list to be inaccessible;
[0011] When the virtual kernel debugger detects a heap memory allocation operation, it records the instruction address corresponding to the Hook function established for the heap memory allocation operation as the target instruction address and adds it to the target instruction address list, and clears the relevant heap memory area;
[0012] When the virtual kernel debugger detects a memory access exception, the exception instruction address is obtained. If the exception instruction address is in the first heap memory address list, the system under test is suspended, the call stack is restored according to the exception instruction address to determine the exception position, and the exception instruction address is compared with the address in the first kernel module address list to determine the kernel module related to the exception; if the exception instruction address is not in the first heap memory address list and is in the target instruction address list, the current heap memory area is set to be accessible, the exception instruction address is added to the first heap memory address list, the address of the currently executed instruction is changed to the exception instruction address, the exception flag is cleared, and the system execution is restored; if the exception instruction address is not in the first heap memory address list and is not in the target instruction address list, the system under test is suspended, the call stack is restored according to the exception instruction address to determine the exception position, and the exception instruction address is compared with the address in the first kernel module address list to determine the kernel module related to the exception.
[0013] Furthermore, the kernel monitor is constructed in a kernel-driven manner.
[0014] Furthermore, the construction in the kernel driver mode is to register a callback function using a kernel interface provided by the system, and when the kernel module is loaded, the callback function is called to realize monitoring of the kernel module.
[0015] Furthermore, the base address and module size, the stack base address and the stack limit are sent to the virtual kernel debugger, and are transmitted via a communication interface between an operating system and a Hypervisor implemented using LibVMI.
[0016] Furthermore, the virtual kernel debugger is constructed in a Hypervisor manner based on hardware virtualization.
[0017] Furthermore, the hardware virtualization-based Hypervisor is constructed by establishing a Hook function for the heap memory access operation.
[0018] Furthermore, the establishment of the Hook function is implemented by using the ExAllocatePool, ExAllocatePool2, ExAllocatePool3 or ExAllocatePoolWithTag function of the Hook kernel.
[0019] Furthermore, the current heap memory area related to the target instruction address is cleared by writing it into the kernel of the system under test in the form of binary code. Beneficial Effects
[0020] The present invention constructs a kernel monitor and a virtual kernel debugger for a system to be tested. The kernel monitor monitors the loading process of a kernel module and the creation process of a kernel thread in the system to be tested, and sends the acquired address information of the kernel module and the kernel thread to the virtual kernel debugger. The virtual kernel debugger dynamically modifies the access rights of a specific kernel physical memory page according to the received address information, and performs a clearing operation on a related memory area to trigger a memory access exception when a heap memory allocation access operation is detected. The kernel heap memory access out-of-bounds identification and processing are realized by judging the memory access exception, thereby realizing the first-time detection of the kernel memory access out-of-bounds in the absence of an operating system kernel source code, and the kernel dynamic debugging analysis based on the detection result. DETAILED DESCRIPTION
[0021] The present invention is described in detail with reference to the following embodiments.
[0022] The present invention provides a kernel memory access out-of-bounds debugging method based on global memory protection, the core idea of which is to build a kernel monitor and a virtual kernel debugger for a system to be tested, the kernel monitor monitors the loading process of the kernel module and the creation process of the kernel thread in the system to be tested, and sends the acquired address information of the kernel module and the kernel thread to the virtual kernel debugger, the virtual kernel debugger dynamically modifies the access rights of a specific kernel physical memory page according to the received address information, and performs a clearing operation on the relevant memory area to trigger a memory access exception when a heap memory allocation access operation is detected, so as to realize timely identification and processing of kernel heap memory access out-of-bounds by judging the memory access exception.
[0023] The present invention provides a kernel memory access out-of-bounds debugging method based on global memory protection, which specifically includes the following steps:
[0024] The kernel monitor is built in the form of kernel driver. The kernel monitor is used to monitor the loading process of kernel modules and the creation process of kernel threads in the system, obtain the relevant information of kernel modules and kernel threads, and then send the information to the virtual kernel debugger. The relevant information of kernel modules includes the kernel module base address and module size, and the relevant information of kernel threads includes the stack base address (StackBase) and stack limit (StackLimit).
[0025] Among them, the kernel monitor is constructed in the kernel driver mode, and the callback function can be registered by using the kernel interface provided by the system, and the callback function is called when the kernel module is loaded to realize the monitoring of the kernel module. In addition, the information can be sent to the virtual kernel debugger by using the communication interface between the operating system and the hypervisor implemented by LibVMI.
[0026] Based on hardware virtualization, a virtual kernel debugger is built in Hypervisor mode. By establishing a Hook function for heap memory access operations, it monitors heap memory access operations and executes the clearing operation of the heap memory area allocated for the heap memory access operations. The memory access exceptions of the system under test are captured to complete the debugging of kernel memory access out of bounds.
[0027] For Windows systems, the virtual kernel debugger can monitor heap memory access operations by hooking the kernel's ExAllocatePool, ExAllocatePool2, ExAllocatePool3, or ExAllocatePoolWithTag memory allocation functions. During the implementation process, the heap memory area allocated by the heap memory access operation is cleared and written into the kernel of the system under test in the form of binary code.
[0028] When the system to be tested is started, a kernel monitor and a virtual kernel debugger are loaded, and the kernel monitor performs monitoring of kernel modules and kernel threads; the physical memory page to which the kernel address space is mapped is recorded as the kernel physical memory page, and the virtual kernel debugger starts monitoring of heap memory access operations and initializes a first heap memory address list, and the first heap memory address list is used to record instruction addresses related to heap memory access operations that are monitored and confirmed to not have memory access out of bounds.
[0029] During the operation of the system under test, the kernel monitor obtains the base address and module size of the kernel module when detecting the loading operation of the kernel module, and obtains the stack base address and stack limit of the new thread when detecting the kernel creating a new thread, and then sends the base address and module size of the kernel module, the stack base address and stack limit of the kernel thread to the virtual kernel debugger.
[0030] The virtual kernel debugger saves the received base address and module size of the kernel module in the first kernel module address list, uses the address space determined by the stack base address and stack limit of the kernel thread as the kernel thread stack memory, and saves it in the kernel stack memory list; updates the access setting of the kernel physical memory page according to the first heap memory address list and the kernel stack memory list, that is, sets the memory area in the kernel physical memory page except the memory area recorded in the first heap memory address list and the kernel stack memory list as inaccessible. The first kernel module address list is a list for saving the base address and module size of the kernel module.
[0031] During the execution of the system, some basic types of variables and object reference variables defined in the function are allocated in the stack memory of the function. When a variable is defined in a code block, memory space is allocated for the variable in the stack. These variables are local variables. When the scope of the variable is exceeded, the system will automatically release the memory space allocated for the variable, that is, the memory space can be immediately used for other purposes. Therefore, to determine whether there is an out-of-bounds access problem in the stack memory, it is necessary to obtain the data type of the variable from the source code. In the absence of source code, such out-of-bounds access problems are basically impossible to locate. Therefore, the present invention only detects out-of-bounds access problems of the kernel heap memory.
[0032] When the virtual kernel debugger detects a heap memory allocation operation, it obtains the instruction address corresponding to the operation, records the instruction address corresponding to the Hook function established for the memory allocation operation as the target instruction address, saves the target instruction address in a target instruction address list, and performs a zeroing operation on the relevant heap memory area;
[0033] When the virtual kernel debugger detects a memory access exception, it obtains the exception instruction address, determines whether the exception instruction address exists in the first heap memory address list, and if so, it indicates that the current heap memory access operation has caused a memory access out-of-bounds, and then suspends the system under test, restores the call stack according to the exception instruction address to determine the exception location, and compares the exception instruction address with the address in the first kernel module address list to determine the kernel module related to the exception;
[0034] If it does not exist, determine whether the exception instruction address exists in the target instruction address list. If it does, it means that the target instruction address is used for the first time, and the current memory access exception is caused by the memory area corresponding to the exception instruction address being set to inaccessible, then set the current heap memory area to be accessible, add the exception instruction address to the first heap memory address list, change the instruction address currently to be executed to the instruction address where the exception occurred, clear the exception flag, and restore system execution (i.e., re-execute); if it does not exist, it means that the current heap memory access operation has caused a memory access out of bounds, then suspend the system under test, restore the call stack according to the exception instruction address to determine the exception location, and compare the exception instruction address with the address in the first kernel module address list to determine the kernel module related to the exception.
[0035] The target instruction address list is a list used to store target instruction addresses. Example
[0036] In this implementation, a kernel memory access out-of-bounds debugging method based on global memory protection provided by the present invention is adopted to implement the judgment and debugging of memory access out-of-bounds for heap memory in the Windows system, which specifically includes:
[0037] S1. Create a Windows kernel driver named kernelMonitor to monitor the loading process of Windows kernel modules and send the kernel module information to the built virtual kernel debugger hyperDebugger, including:
[0038] S1.1. Call Windows kernel API: PsSetLoadImageNotifyRoutine to register a callback function. When a new kernel module including a driver is loaded, the callback function is called to monitor the loading of the kernel module and kernel driver.
[0039] S1.2. Set the registered callback function as LoadImageNotifyRoutine, implement analysis and reconstruction of the relevant information of the loaded kernel module in the callback function, and send this information to the hyperDebugger, including:
[0040] (1) The definition example of the callback function LoadImageNotifyRoutine is as follows:
[0041] LoadImageNotifyRoutine(
[0042] _In_opt_ PUNICODE_STRING FullImageName,
[0043] _In_ HANDLE ProcessId,
[0044] _In_ PIMAGE_INFO ImageInfo )
[0046] The definition of IMAGE_INFO is as follows:
[0047] typedef struct _IMAGE_INFO {
[0048] union {
[0049] ULONG Properties;
[0050] struct {
[0051] ULONGImageAddressingMode: 8;
[0052] ULONG SystemModeImage : 1;
[0053] ULONGImageMappedToAllPids : 1;
[0054] ULONGExtendedInfoPresent: 1;
[0055] ULONG MachineTypeMismatch: 1;
[0056] ULONGImageSignatureLevel: 4;
[0057] ULONG ImageSignatureType : 3;
[0058] ULONG ImagePartialMap : 1;
[0059] ULONG Reserved: 12;
[0060] };
[0061] };
[0062] PVOID ImageBase;
[0063] ULONG ImageSelector;
[0064] SIZE_T ImageSize;
[0065] ULONG ImageSectionNumber;
[0066] } IMAGE_INFO, *PIMAGE_INFO;
[0067] (2) Based on the ImageBase, ImageSize and other information in IMAGE_INFO, the memory layout information of each kernel module of the Windows kernel is constructed, that is, the starting address and length of each kernel module.
[0068] (3) Get the full path of the system file represented by FullImageName, and extract the manufacturer information of the kernel module, such as Microsoft, by parsing the PE file header information.
[0069] (4) The above information of each loaded kernel driver is passed to the hyperDebugger through the communication interface implemented by LibVMI.
[0070] S2. In the hyperDebugger, protect all kernel heap memory, that is, set the heap memory to be inaccessible, and monitor the access operations to the heap memory to monitor the access out of bounds. Specifically:
[0071] S2.1. After kernelMonitor is loaded in the Windows kernel, when kernelMonitor's DriverEntry is executed, hyperDebugger is notified to execute the following steps:
[0072] (1) At the Hypervisor layer, use LibVMI to hook the ExAllocatePool memory allocation function in the Windows kernel to be tested, so that the allocated memory area is cleared after the ExAllocatePool is executed. After the kernel memory is allocated, the first access to the memory must not be a general kernel module, but a Windows kernel module, and the access range is the allocated memory area. The specific steps are as follows:
[0073] With the help of the interface provided by LibVMI, we can hook the API functions related to heap memory allocation. The sample code is as follows:
[0074] void hook_function(vmi_instance_t vmi, addr_t target_fn_addr) {
[0075] / / Save original bytes of the target function
[0076] unsigned char original_bytes[5];
[0077] vmi_read_pa(vmi, target_fn_addr, 5, original_bytes);
[0078] / / Write hook to target function
[0079] unsigned char hook_bytes[5] = {0xE9, HOOK_OFFSET}; / / Example forx86 JMP
[0080] vmi_write_pa(vmi, target_fn_addr, 5, hook_bytes);
[0081] …
[0082] }
[0083] Among them, vmi_read_pa and vmi_write_pa are functions provided by LibVMI to read and write upper-level OS memory in the Hypervisor.
[0084] The steps to implement the Hook function are as follows:
[0085] The standard API function that performs heap memory allocation, that is, the original function being hooked;
[0086] Clear the allocated heap memory area to zero, written in assembly code, as follows:
[0087] section .text
[0088] global _start
[0089] _start:
[0090] ; The addresses allocated by the above function are all return values, which are stored in rax, so rax needs to be copied to rdi, that is, rdi points to the memory area to be cleared, and rcx saves the size of the area
[0091] ; The following are hypothetical initializations. In actual use, these values need to be set according to specific circumstances.
[0092] mov rdi, rax
[0093] mov rdi, buffer ; buffer is the starting address of the memory area
[0094] mov rcx, buf_size ; buf_size is the size of the memory area
[0095] ; Use the rep stosq instruction to clear the area in a high-speed manner
[0096] xor rax, rax ; set rax to zero
[0097] rep stosq ; store rax (0) in [rdi], (rdi += 8), decrement rcx until rcx == 0
[0098] ; Program ends, exit
[0099] mov rax, 60 ; syscall: exit
[0100] xor rdi, rdi ; exit code 0
[0101] syscall
[0102] section .bss
[0103] buffer:
[0104] resb 1024 ; define a 1024-byte buffer
[0105] buf_size equ $ - buffer ; calculate buffer size
[0106] S2.2, kernelMonitor detects that the kernel has created a new thread named newKernelThread, and uses LibVMI to notify hyperDebugger. HyperDebugger sets all physical memory pages mapped by the kernel address space, all physical memory pages marked as non-executable and not stack, to inaccessible. The specific steps are as follows:
[0107] (1) Use the LibVMI interface to obtain the KTHREAD information of newKernelThread, extract the two key information StackBase and StackLimit, which determine the address range of the thread stack memory, and record the address range in listThreadStackBound.
[0108] (2) Traverse the kernel address space that has not been checked before and is not in listThreadStackBound, and mark these physical memory pages as inaccessible, that is, unreadable, unwritable, and unexecutable. Sample code for each hyperDebugger corresponding to the physical memory page:
[0109] / / Define some macros to assist page table parsing
[0110] #define PAGE_SHIFT 12
[0111] #define PML4_SHIFT 39
[0112] #define PDP_SHIFT 30
[0113] #define PD_SHIFT 21
[0114] #define PT_SHIFT 12
[0115] #define PML4_MASK 0x1FF
[0116] #define PDP_MASK 0x1FF
[0117] #define PD_MASK 0x1FF
[0118] #define PT_MASK 0x1FF
[0119] / / Function to get the value of CR3 register
[0120] unsigned __int64 GetCr3()
[0121] {
[0122] unsigned __int64 cr3_value;
[0123] __asm {
[0124] mov rax, cr3
[0125] mov cr3_value, rax
[0126] }
[0127] return cr3_value;
[0128] }
[0129] / / virtual_address is the address of the virtual memory page
[0130] / / Function used to parse the page table and get the physical address
[0131] unsigned void ProtectVirtualToPhysical(PVOID virtual_address)
[0132] {
[0133] unsigned __int64 cr3 = GetCr3();
[0134] unsigned __int64* pml4_base = (unsigned __int64*)((cr3 & ~0xFFF) +0xFFFFF80000000000);
[0135] unsigned __int64 pml4_index = ((unsigned __int64)virtual_address >> PML4_SHIFT) & PML4_MASK;
[0136] unsigned __int64 pdp_index = ((unsigned __int64)virtual_address >>PDP_SHIFT) & PDP_MASK;
[0137] unsigned __int64 pd_index = ((unsigned __int64)virtual_address >>PD_SHIFT) & PD_MASK;
[0138] unsigned __int64 pt_index = ((unsigned __int64)virtual_address >>PT_SHIFT) & PT_MASK;
[0139] unsigned __int64* pdp_base = (unsigned __int64*)(pml4_base[pml4_index] & ~0xFFF);
[0140] if (!pdp_base) return 0;
[0141] unsigned __int64* pd_base = (unsigned __int64*)(pdp_base[pdp_index] & ~0xFFF);
[0142] if (!pd_base) return 0;
[0143] unsigned __int64* pt_base = (unsigned __int64*)(pd_base[pd_index]& ~0xFFF);
[0144] if (!pt_base) return 0;
[0145] unsigned __int64 physical_address = (pt_base[pt_index] & ~0xFFF) +((unsigned __int64)virtual_address & 0xFFF);
[0146] / / Then mark the physical memory page corresponding to physical_address as inaccessible, that is, unreadable, unwritable, and unexecutable, etc.
[0147] }
[0148] S2.3. Monitor memory access anomalies and detect memory access out of bounds.
[0149] The specific process is to make the following judgments when a memory access exception is detected:
[0150] If the instruction address corresponding to the current memory access exception is the first time the exception occurs, and the instruction address of the exception is in the code of the Hook function added by the hyperDebugger, it means that this is the first time to access the heap memory, and the access range is exactly the allocated size. It can be confirmed that the current operation does not cross the boundary, and the attributes of these memory pages are set to read and write, and the execution of the Windows system to be tested is restored;
[0151] Otherwise, it means that a memory access out of bounds has indeed occurred. In this case, the Windows system to be tested will be suspended, the call stack will be restored based on the address of the exception instruction, and basic Windows debugging functions such as memory access, register access, and data structure analysis will be provided based on LibVMI to complete the debugging of the memory access out of bounds.
[0152] In summary, the above are only preferred embodiments of the present invention and are not intended to limit the protection scope of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A kernel memory access out-of-bounds debugging method based on global memory protection, characterized in that: The specific steps include: Build a kernel monitor to monitor the kernel module loading process and kernel thread creation process, and build a virtual kernel debugger to monitor heap memory access, perform heap memory area clearing, and capture memory access exceptions; When the system to be tested is started, a kernel monitor and a virtual kernel debugger are loaded, and the kernel monitor performs monitoring of kernel modules and kernel threads; the physical memory page to which the kernel address space is mapped is recorded as the kernel physical memory page, and the virtual kernel debugger starts monitoring of heap memory access and initializes a first heap memory address list, and the first heap memory address list is used to record instruction addresses of heap memory accesses without memory access out of bounds; During the operation of the system under test, the kernel monitor obtains the base address and module size of the kernel module when detecting the loading operation of the kernel module, obtains the stack base address and stack limit of the new thread when detecting the kernel creating a new thread, and sends the base address and module size, the stack base address and stack limit to the virtual kernel debugger; The virtual kernel debugger saves the received base address and module size in the first kernel module address list, and saves the address space determined by the stack base address and the stack limit in the kernel stack memory list; Set the memory areas in the kernel physical memory page other than the memory areas recorded in the first heap memory address list and the kernel stack memory list to be inaccessible; When the virtual kernel debugger detects a heap memory allocation operation, it records the instruction address corresponding to the Hook function established for the heap memory allocation operation as the target instruction address and adds it to the target instruction address list, and clears the relevant heap memory area; When the virtual kernel debugger detects a memory access exception, it obtains the exception instruction address. If the exception instruction address is in the first heap memory address list, it suspends the system under test, restores the call stack according to the exception instruction address to determine the exception position, and compares the exception instruction address with the address in the first kernel module address list to determine the kernel module related to the exception; if the exception instruction address is not in the first heap memory address list and is in the target instruction address list, it sets the current heap memory area to be accessible, adds the exception instruction address to the first heap memory address list, changes the currently executed instruction address to the exception instruction address, clears the exception flag, and resumes system execution; If the exception instruction address is not in the first heap memory address list and is not in the target instruction address list, the system under test is suspended, the call stack is restored according to the exception instruction address to determine the exception location, and the exception instruction address is compared with the address in the first kernel module address list to determine the kernel module related to the exception.
2. The debugging method according to claim 1, characterized in that: The kernel monitor is constructed in a kernel driver manner.
3. The debugging method according to claim 2, characterized in that: The construction in the kernel driver mode is to register a callback function using the kernel interface provided by the system, and when the kernel module is loaded, the callback function is called to realize the monitoring of the kernel module.
4. The debugging method according to claim 1, characterized in that: The base address and module size, stack base address and stack limit are sent to the virtual kernel debugger, and are transmitted to the communication interface between the operating system and the Hypervisor implemented by using LibVMI.
5. The debugging method according to claim 1, characterized in that: The virtual kernel debugger is constructed in a Hypervisor manner based on hardware virtualization.
6. The debugging method according to claim 5, characterized in that: The hardware virtualization is constructed in a Hypervisor manner and is implemented by establishing a Hook function for the heap memory access operation.
7. The debugging method according to claim 6, characterized in that: The establishment of the Hook function is implemented by the ExAllocatePool, ExAllocatePool2, ExAllocatePool3 or ExAllocatePoolWithTag function of the Hook kernel.
8. The debugging method according to claim 1, characterized in that: The current heap memory area related to the target instruction address is cleared by writing it into the kernel of the system under test in the form of binary code.
