Memory deletion method and device, equipment and medium

By creating memory snapshots and comparing before and after virtual machine deletion, identifying and clearing residual data, the problem of residual data after virtual machine deletion is solved, and thorough memory cleaning and effective resource utilization is achieved.

CN119806735APending Publication Date: 2025-04-11INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411875448.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-18
Publication Date
2025-04-11

AI Technical Summary

Technical Problem

After the virtual machine is deleted, there may be residual data in the host memory, resulting in waste of resources and security issues, such as information leakage or unauthorized access.

Method used

Make sure the memory state is restored to available state by creating a memory snapshot.

Benefits of technology

It realizes the thorough cleaning of memory after virtual machine deletion, prevents resource waste and information leakage, and improves system security and resource utilization efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119806735A_ABST
    Figure CN119806735A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a memory deletion method and device, equipment and a medium, and relates to the field of virtual machine management. The method comprises the following steps: in response to a deletion instruction for a virtual machine deployed on a host, creating a memory snapshot of the host, then deleting the virtual machine deployed on the host, scanning the memory of the host, comparing a scanning result with the memory snapshot, identifying residual data of the virtual machine, and sending the residual data to the host. And the residual data is cleared, and finally the memory state of the memory page related to the virtual machine is recovered to an available state, so that the host distributes the memory page related to the virtual machine to other virtual machines. Through the mode, the problem that residual data exists after the virtual machine is deleted is efficiently and thoroughly solved, more effective storage space is released, the safety of the system can be improved, user information is prevented from being leaked by the residual data after deletion, effective cyclic utilization of resources is facilitated, and the use experience of a user is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of virtual machine management, and in particular to a memory deletion method, device, equipment and medium. Background Art

[0002] With the rapid development of cloud computing and virtualization technology, virtual machines (VMs) have become a key tool for resource management and allocation. In a virtualized environment, the operation of virtual machines depends on the physical resources of the host, especially the memory resources. When a virtual machine is deleted, the resources allocated to it in the host memory should be completely released and recycled. However, due to the complex interaction mechanism between the virtual machine and the host, it is possible that the virtual machine is deleted but the data in the virtual machine is not completely cleared. This not only wastes precious memory resources, but may also cause security issues due to the residual virtual machine data, such as information leakage or unauthorized access.

[0003] Therefore, at the end of the life cycle of a virtual machine, that is, after the virtual machine is deleted, how to ensure that no relevant data of the virtual machine remains in the host memory to prevent potential information leakage or resource waste has become an urgent problem to be solved. Summary of the invention

[0004] Based on the above technical problems, the embodiments of the present application provide a memory deletion method, device, equipment and medium, aiming to accurately, efficiently and thoroughly delete the memory of the host occupied by the virtual machine.

[0005] A first aspect of an embodiment of the present application provides a memory deletion method, the method comprising:

[0006] In response to a deletion instruction for a virtual machine deployed on a host, creating a memory snapshot of the host, the memory snapshot being used to record memory pages related to the virtual machine in the memory of the host before the virtual machine is deleted;

[0007] Execute the deletion instruction to delete the virtual machine deployed on the host;

[0008] Scan the host memory to obtain a scanning result, wherein the scanning result is used to record memory pages related to the virtual machine in the host memory after the virtual machine is deleted;

[0009] Comparing the scan result with the memory snapshot to identify residual data of the virtual machine;

[0010] Performing a clearing operation on the residual data of the virtual machine;

[0011] The memory state of the memory page related to the virtual machine is restored to an available state, so that the host can allocate the memory page related to the virtual machine to other virtual machines.

[0012] Optionally, executing the deletion instruction to delete the virtual machine deployed on the host, the method includes:

[0013] Marking all memory pages associated with the virtual machine as releasable;

[0014] Delete the memory pages marked as releasable;

[0015] After the deletion operation is completed, verify whether the virtual machine is removed from the host and does not occupy the hardware resources of the host.

[0016] Optionally, the scanning result is compared with the memory snapshot to identify residual data of the virtual machine, and the method includes:

[0017] Comparing the scan result with the memory snapshot to identify memory areas that have not been released or marked as abnormal;

[0018] Checking the attributes, access mode and association of the identified memory area with the virtual machine metadata to determine whether the data in the identified memory area is residual data of the virtual machine;

[0019] The method further comprises:

[0020] The physical address, size, and content summary of the residual data of the virtual machine are recorded in a log.

[0021] Optionally, performing a clearing operation on residual data of the virtual machine, the method includes:

[0022] Using a target clearing method to clear the residual data of the virtual machine, the target clearing method at least includes: a multiple overwriting method that does not affect other data of the host, and a physical erasing method that does not affect other data of the host;

[0023] After performing a clearing operation on the residual data of the virtual machine, verifying whether the residual data of the virtual machine is completely cleared;

[0024] When the residual data of the virtual machine is not completely cleared, the residual data of the virtual machine is repeatedly cleared.

[0025] Optionally, scanning the host memory to obtain a scanning result, the method includes:

[0026] A target scanning method is adopted to scan the memory area of ​​the virtual machine starting from the memory start address of the virtual machine. The target scanning method is a scanning method in which each memory unit is accessed once.

[0027] Optionally, in response to a deletion instruction for a virtual machine deployed on a host, creating a memory snapshot of the host, the method comprising:

[0028] Determining whether sensitive data is stored in a memory page associated with the virtual machine, and / or determining whether a response rate of an application on the host is lower than a target response rate;

[0029] When sensitive data is stored in the memory pages related to the virtual machine, or when the response rate of the application on the host is lower than the target response rate, a memory snapshot of the host is created to perform a clearing operation on the residual data of the virtual machine based on the memory snapshot of the host.

[0030] Optionally, the method further comprises:

[0031] In response to a restore instruction for other virtual machines deployed on the host, or in response to a migration instruction for other virtual machines deployed on the host, a delete instruction for the virtual machine is generated, and a memory snapshot of the host is created, where the memory snapshot is used to record memory pages related to the virtual machine in the memory of the host before the virtual machine is deleted;

[0032] Execute the deletion instruction to delete the virtual machine deployed on the host;

[0033] Scan the host memory to obtain a scanning result, wherein the scanning result is used to record memory pages related to the virtual machine in the host memory after the virtual machine is deleted;

[0034] Comparing the scan result with the memory snapshot to identify residual data of the virtual machine;

[0035] Performing a clearing operation on the residual data of the virtual machine;

[0036] The other virtual machines are restored on the memory pages related to the virtual machine, or the other virtual machines are migrated to the memory pages related to the virtual machine.

[0037] A second aspect of an embodiment of the present application provides a memory deletion device, the device comprising:

[0038] A snapshot creation module, configured to create a memory snapshot of the host in response to a deletion instruction for a virtual machine deployed on the host, wherein the memory snapshot is used to record memory pages related to the virtual machine in the memory of the host before the virtual machine is deleted;

[0039] A deletion module, used to execute the deletion instruction to delete the virtual machine deployed on the host;

[0040] A scanning module, used to scan the host memory to obtain a scanning result, wherein the scanning result is used to record the memory pages related to the virtual machine in the memory of the host after the virtual machine is deleted;

[0041] A scanning result comparison module, used to compare the scanning result with the memory snapshot to identify residual data of the virtual machine;

[0042] A clearing module, used to perform a clearing operation on the residual data of the virtual machine;

[0043] The state recovery module is used to restore the memory state of the memory page related to the virtual machine to an available state, so that the host can allocate the memory page related to the virtual machine to other virtual machines.

[0044] Optionally, the deletion module further includes:

[0045] A releasable state marking submodule, used for marking all memory pages related to the virtual machine as being in a releasable state;

[0046] The memory page deletion submodule is used to delete the memory pages marked as releasable;

[0047] The deletion verification submodule is used to verify whether the virtual machine is removed from the host and does not occupy the hardware resources of the host after the deletion operation is completed.

[0048] Optionally, the scanning result comparison module further includes:

[0049] A result comparison submodule, used to compare the scan result with the memory snapshot to identify memory areas that have not been released or marked as abnormal;

[0050] A residual data determination submodule, used to check the attributes, access mode and association with the virtual machine metadata of the identified memory area to determine whether the data in the identified memory area is residual data of the virtual machine;

[0051] The log recording submodule is used to record the physical address, size, and content summary of the residual data of the virtual machine in a log.

[0052] Optionally, the clearing module further includes:

[0053] A clearing execution submodule, configured to clear the residual data of the virtual machine by adopting a target clearing method, wherein the target clearing method includes at least: a multiple overwriting method that does not affect other data of the host, and a physical erasing method that does not affect other data of the host;

[0054] A clearing verification submodule, used to verify whether the residual data of the virtual machine is completely cleared after the residual data of the virtual machine is cleared;

[0055] The repeated clearing submodule is used to repeatedly clear the residual data of the virtual machine when the residual data of the virtual machine is not completely cleared.

[0056] Optionally, the scanning module includes:

[0057] The memory scanning submodule is used to scan the memory area of ​​the virtual machine starting from the memory start address of the virtual machine by adopting a target scanning method, wherein each memory unit is accessed once.

[0058] Optionally, the snapshot creation module includes:

[0059] A situation confirmation submodule, used to determine whether sensitive data is stored in the memory page related to the virtual machine, and / or determine whether the response rate of the application on the host is lower than the target response rate;

[0060] A memory snapshot creation submodule is used to create a memory snapshot of the host when sensitive data is stored in the memory pages related to the virtual machine, or when the response rate of the application on the host is lower than the target response rate, so as to perform a clearing operation on the residual data of the virtual machine based on the memory snapshot of the host.

[0061] Optionally:

[0062] The snapshot creation module is further used to generate a deletion instruction for the virtual machine in response to a recovery instruction for other virtual machines deployed on the host, or in response to a migration instruction for other virtual machines deployed on the host, and to create a memory snapshot of the host, wherein the memory snapshot is used to record memory pages related to the virtual machine in the memory of the host before the virtual machine is deleted;

[0063] The state recovery module is further used to restore the other virtual machines on the memory pages related to the virtual machine, or migrate the other virtual machines to the memory pages related to the virtual machine.

[0064] A third aspect of an embodiment of the present application provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the computer program is executed by the processor, the memory deletion method of the first aspect of the embodiment of the present application is implemented.

[0065] A fourth aspect of an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the memory deletion method of the first aspect of the embodiment of the present application is implemented.

[0066] A fifth aspect of an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the memory deletion method of the first aspect of the embodiment of the present application.

[0067] Through the memory deletion method of the embodiment of the present application, in response to a deletion instruction for a virtual machine deployed on a host, a memory snapshot of the host is created, and memory pages related to the virtual machine in the memory of the host before the virtual machine is deleted are recorded. Then the deletion instruction is executed to delete the virtual machine deployed on the host. After the deletion is completed, the host memory is scanned to obtain the scanning result, and the memory pages related to the virtual machine in the memory of the host after the virtual machine is deleted are recorded. The scanning result is then compared with the memory snapshot to identify the residual data of the virtual machine. Then, a clearing operation is performed on the residual data of the virtual machine, thereby ensuring that the memory occupied by the virtual machine has been deleted. The memory state of the memory pages related to the virtual machine can be restored to an available state, so that the host can allocate the memory pages related to the virtual machine to other virtual machines.

[0068] In this application, on the basis of simply deleting the memory occupied by the virtual machine in the related art, a method of creating a memory snapshot and comparing the memory snapshots before and after the deletion operation is added before and after the deletion operation. In this way, the residual data that has not been completely deleted after the deletion operation is determined, and then the residual data is further cleared through targeted clearing operations to ensure that the memory deletion work has been completed thoroughly. In this way, the residual data after deletion is detected more efficiently, and the problem of incomplete memory deletion is effectively solved, which not only releases more effective storage space, but also improves the security of the system, avoids the leakage of user information by residual data after deletion, and at the same time, thoroughly cleans up the host memory after deleting the virtual machine, which also helps to promote the effective recycling of resources, avoid waste of resources, reduce operating costs, and improve the user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0069] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments of the present application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0070] Figure 1 It is a flow chart of a memory deletion method proposed in one embodiment of the present application;

[0071] Figure 2 It is a specific implementation block diagram of a memory deletion method proposed in one embodiment of the present application;

[0072] Figure 3 It is a structural block diagram of a memory deletion device provided in an embodiment of the present application;

[0073] Figure 4 It is a schematic diagram of an electronic device shown in an embodiment of the present application. DETAILED DESCRIPTION

[0074] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0075] In the drawings, the size of the constituent elements, the thickness of the layer or the area may be exaggerated for the sake of clarity. Therefore, any implementation of the present application is not necessarily limited to the size shown in the drawings, and the shape and size of the components in the drawings do not reflect the true proportion. In addition, the drawings schematically show ideal examples, and any implementation of the present application is not limited to the shape or value shown in the drawings.

[0076] Please refer to Figure 1 , Figure 1 This is a flow chart of a memory deletion method of the present application. Figure 1 As shown, the method may include steps S101 to S106:

[0077] Step S101: in response to a deletion instruction for a virtual machine deployed on a host, creating a memory snapshot of the host, wherein the memory snapshot is used to record memory pages related to the virtual machine in the memory of the host before the virtual machine is deleted;

[0078] Step S102: Execute the deletion instruction to delete the virtual machine deployed on the host;

[0079] Step S103: Scan the host memory to obtain a scan result, where the scan result is used to record memory pages related to the virtual machine in the host memory after the virtual machine is deleted;

[0080] Step S104: comparing the scan result with the memory snapshot to identify residual data of the virtual machine;

[0081] Step S105: performing a clearing operation on the residual data of the virtual machine;

[0082] Step S106: restoring the memory state of the memory page associated with the virtual machine to an available state, so that the host can allocate the memory page associated with the virtual machine to other virtual machines.

[0083] In the related art, a host can be configured to run multiple virtual machines through a virtualization management platform. When the life cycle of a virtual machine ends and the virtual machine needs to be deleted, it often relies on a system-level cleanup mechanism, that is, simply deleting the memory space occupied by the virtual machine, and after deletion, setting the memory page associated with the deleted virtual machine to an available state for use by the host or other virtual machines. However, in actual situations, a single deletion operation at the system level is often not enough to delete all the data in the memory page associated with the virtual machine, and there will be residual data that has not been deleted. These residual data will not only have a negative impact on the subsequent use process, but also when the deleted virtual machine contains sensitive information of the user, the residual data may have the risk of leaking user information.

[0084] Therefore, the present application proposes a method for efficient and thorough memory deletion. In the method proposed in the present application, before the deletion operation of the related technology, a memory snapshot operation is added to record the contents of the memory page associated with the virtual machine before deletion, and then the memory page associated with the virtual machine is scanned again after deletion. The scan result is compared with the previous memory snapshot to determine the residual data in the memory page associated with the virtual machine, and then the residual data is cleared in a targeted manner through a clearing operation to ensure that the memory page associated with the virtual machine is completely deleted, and then marked as available for subsequent use. By adding the comparison before and after deletion, the subsequent clearing operation can more accurately locate the residual data position, so that the efficiency of the entire deletion operation is improved, and the residual data can be effectively and thoroughly cleared, avoiding the risk of information leakage and affecting the overall work efficiency.

[0085] Step S101: in response to a deletion instruction for a virtual machine deployed on a host, creating a memory snapshot of the host, wherein the memory snapshot is used to record memory pages related to the virtual machine in the memory of the host before the virtual machine is deleted.

[0086] In an embodiment of the present application, after receiving a deletion instruction for a virtual machine in a host proposed by a user, a memory snapshot is first required to record the contents of the memory pages occupied by the virtual machine to be deleted before the deletion operation, for subsequent comparison with the results after deletion. The memory snapshot should record at least a series of information including: the contents, attributes, access modes of the memory pages, and the relevance of the virtual machine metadata. The more comprehensive the information recorded, the more accurate the results of subsequent comparisons will be.

[0087] Step S102: Execute the deletion instruction to delete the virtual machine deployed on the host.

[0088] In an embodiment of the present application, after taking a memory snapshot of the virtual machine, the virtual machine can be deleted. Through the virtualization management platform, the content in the host memory space occupied by the virtual machine is deleted in preparation for subsequent verification operations.

[0089] Step S103: Scan the host memory to obtain a scanning result, wherein the scanning result is used to record memory pages related to the virtual machine in the host memory after the virtual machine is deleted.

[0090] In an embodiment of the present application, after executing the deletion operation, it is necessary to scan the host memory again, that is, according to the address originally occupied by the virtual machine, scan the content of the corresponding memory page, and record the scanning results of this scan, wherein the scanning results of various memory pages should include at least the following different states: a memory page that was originally free, a memory page that originally stored content and has been cleared after deletion, a memory page that originally stored content and has not been cleared after deletion, and a memory page that may be damaged by a fault. The content stored in the memory page in the above scanning results is used for subsequent comparison with the virtual machine memory snapshot before and after deletion.

[0091] Step S104: Compare the scan result with the memory snapshot to identify residual data of the virtual machine.

[0092] In an embodiment of the present application, after obtaining the scanning results of the relevant memory pages corresponding to the virtual machine after deletion, the scanning results are compared with the memory snapshot before the deletion operation, and whether the data contained in the memory page is consistent before and after deletion is judged to determine whether it is residual data of the virtual machine. Specifically, whether it is residual data can be judged based on the content, attributes, access mode and correlation with the virtual machine metadata in the memory page.

[0093] Step S105: performing a clearing operation on the residual data of the virtual machine.

[0094] In an embodiment of the present application, it is determined in the above steps that the residual data after the deletion operation needs to be cleared to ensure that all data associated with the virtual machine are completely deleted during the deletion process. According to the memory page determined to contain residual data, a clearing operation is performed to ensure that the residual data is completely cleared through physical erasing, multiple overwriting, etc., and confirmation and verification are performed after the clearing operation is performed to ensure that there is no other residual data.

[0095] Step S106: restoring the memory state of the memory page associated with the virtual machine to an available state, so that the host can allocate the memory page associated with the virtual machine to other virtual machines.

[0096] In the embodiment of the present application, after completing the above series of operations such as memory snapshot, memory deletion, residual data confirmation, and residual data clearing for the memory occupied by the virtual machine, it can be confirmed that the data in the host memory space occupied by the virtual machine after deletion has been completely cleared, and the storage space has been released. Generally speaking, the status of the memory space in the host that is allocated to a virtual machine for use is displayed as unavailable to the outside, that is, the memory pages related to the virtual machine cannot be called by other virtual machines or host functions. After the process described in the memory deletion method in this application, the memory page status associated with the completely deleted virtual machine is restored to an available state, and the user can use the virtualization management platform on the host to make subsequent use of the released memory space, which can be allocated to other virtual machines for use, or can be used to perform other host functions according to user needs, and no restrictions are made here.

[0097] In combination with the above embodiments, in one implementation, the present application further provides a memory deletion method, which executes the deletion instruction to perform a deletion operation on the virtual machine deployed on the host, specifically including the following contents:

[0098] First, all memory pages related to the virtual machine are marked as being in a releasable state.

[0099] In an embodiment of the present application, before executing a deletion operation, it is first necessary to mark the memory pages related to the virtual machine to be deleted as releasable. The releasable status is used to indicate that the content in the memory page is allowed to be deleted. During the process of the system executing the deletion operation, only the memory pages marked as releasable can be deleted.

[0100] Then, a deletion operation is performed on the memory page marked as being in a releasable state; finally, after the deletion operation is completed, it is verified whether the virtual machine is removed from the host and does not occupy the hardware resources of the host.

[0101] In an embodiment of the present application, after the memory pages related to the virtual machine to be deleted are marked as releasable, a deletion operation can be performed on these memory pages. In an embodiment proposed in the present application, the deletion operation is performed through a virtualization management platform. After performing the deletion operation, it is also necessary to verify whether the virtual machine has been removed from the host, that is, the related processes of the virtual machine in the virtualization management platform have been completely removed, and the various information related to the deleted virtual machine no longer exists in the virtualization management platform, and no longer occupies platform resources.

[0102] In combination with the above embodiments, in one implementation, the present application further provides a memory deletion method, which compares the scan result with the memory snapshot to identify the residual data of the virtual machine, and specifically includes the following contents:

[0103] First, the scan result is compared with the memory snapshot to identify memory areas that have not been released or marked as abnormal.

[0104] In the embodiment of the present application, after the above-mentioned deletion operation and scanning operation are completed, it is necessary to compare the scanned content with the memory snapshot before the deletion operation. Since the memory pages related to the virtual machine are in different states after the deletion operation, they need to be identified first. The memory pages are in at least the following states: the memory pages that were originally idle, the memory pages that originally stored content and were cleared after deletion, the memory pages that originally stored content and were not cleared after deletion, and the memory pages that may be damaged by faults. Among them, the memory pages that were originally idle and the memory pages that have been verified to have been cleared after the deletion operation do not have residual data, so no other operations are required. The memory area marked as abnormal usually refers to the memory pages that may be damaged by faults. In the process of normal use, the memory pages may also be damaged by faults due to various reasons. The damaged memory pages are no longer used and are not within the scope of the present application. Therefore, the main purpose of comparing the scan results with the memory snapshot is to identify the unreleased area, that is, the memory pages that originally stored content and were not cleared after the deletion operation.

[0105] Optionally, in one embodiment, the above screening process can also be expressed by the following formula:

[0106] R=M(initial)∩M(final)-M(valid)

[0107] Among them, R represents the residual data that needs to be identified, M (initial) represents the memory snapshot before the deletion operation, M (final) represents the scan result after the deletion operation, and M (valid) represents the expected valid data, including the memory pages that were originally free and the memory pages that originally stored content and have been cleared after deletion. The residual data that needs to be identified can be determined by obtaining the intersection of the relevant memory pages of the virtual machine before and after the deletion operation and subtracting the expected valid data from it.

[0108] Then, the attributes, access mode and association with the virtual machine metadata of the identified memory area are checked to determine whether the data in the identified memory area is residual data of the virtual machine.

[0109] In an embodiment of the present application, after obtaining the data in the above-mentioned unreleased memory area in the above-mentioned steps, it is still necessary to verify the data to determine whether the data is associated with the virtual machine and is residual data of the virtual machine. The specific method can be achieved by checking the correlation between the content, attributes, access mode and virtual machine metadata stored in the identified memory area, and determining whether the data in the identified memory area is the residual data of the virtual machine through the above-mentioned judgment conditions, and performing subsequent clearing operations on the part determined to be residual data.

[0110] The physical address, size, and content summary of the residual data of the virtual machine also need to be recorded in the log.

[0111] The log recorded here is the output result of the above comparison and screening process, which records the physical address, size, content summary and other information of the residual data in the memory page determined to be associated with the virtual machine, and uses this as input to continue to perform subsequent clearing operations.

[0112] In combination with the above embodiments, in one implementation, the present application further provides a memory deletion method, which performs a clearing operation on the residual data of the virtual machine, specifically including the following contents:

[0113] First, a target clearing method is used to clear the residual data of the virtual machine. The target clearing method at least includes: a multiple overwriting method that does not affect other data of the host, and a physical erasing method that does not affect other data of the host.

[0114] In an embodiment of the present application, after the residual data in the memory page related to the virtual machine is determined in the above steps, it is necessary to perform further clearing operations on the residual data to ensure that the host memory space occupied by the virtual machine is completely released, and the clearing method adopted should at least include: multiple overwriting methods that do not affect other data of the host, and physical erasing methods that do not affect other data of the host. It should be noted that when performing the clearing operation, only the memory pages related to the virtual machine are targeted, and the clearing operation is performed in a targeted manner according to the addresses of the residual data recorded in the log generated after the above scanning and comparison, without affecting the contents of other memory pages in the host.

[0115] Then, after the residual data of the virtual machine is cleared, it is verified whether the residual data of the virtual machine is completely cleared; when the residual data of the virtual machine is not completely cleared, the residual data of the virtual machine is repeatedly cleared.

[0116] In an embodiment of the present application, after performing a clearing operation on residual data in memory pages related to the virtual machine, it is necessary to verify the clearing result to ensure that all residual data has been completely cleared after the clearing operation. Since a single clearing operation on the memory may not be thorough, when it is verified that residual data still exists, it is necessary to repeat the clearing operation on the related memory pages until the residual data in the memory pages related to the virtual machine is completely cleared.

[0117] In summary, the method flow proposed in this application is as follows: Figure 2 As shown, Figure 2 This is a specific implementation block diagram of a memory deletion method proposed in an embodiment of the present application. First, on a server platform equipped with virtualization service technology, in response to a deletion instruction of a virtual machine, a memory snapshot is created, and then a deletion operation is performed, including virtual machine deletion and deletion completion verification. Then, residual data monitoring is performed based on the deletion result, and the scan result is compared with the memory snapshot to determine the residual data, and the verified result is recorded in a log. If there is residual data, the clearing operation is repeatedly performed to ensure that the residual data is completely cleared, and then the memory pages related to the virtual machine are restored to a usable state.

[0118] In combination with the above embodiments, in one implementation, the present application further provides a memory deletion method, which scans the host memory to obtain a scanning result, specifically including the following contents:

[0119] A target scanning method is adopted to scan the memory area of ​​the virtual machine starting from the memory start address of the virtual machine. The target scanning method is a scanning method in which each memory unit is accessed once.

[0120] In an embodiment of the present application, after the deletion operation is performed, the method of scanning the memory pages related to the virtual machine again should be a scan traversal to ensure that all memory pages related to the virtual machine are scanned again to compare the result after deletion with the memory snapshot before deletion.

[0121] Optionally, the target scanning method can adopt a depth-first search algorithm (DFS, Depth First Search), which traverses the nodes of the tree along the depth of the tree and searches the branches of the tree as deeply as possible. When the edges where the node is located have been explored or the node does not meet the conditions during the search, the search will trace back to the starting node of the edge where the node is found, and the whole process is repeated until all nodes are visited. In this application, starting from the memory start address of the virtual machine, a deep scan of the memory area related to the virtual machine in the entire host memory is performed to ensure that each memory page related to the virtual machine has been scanned at least once, so as to ensure that there are no omissions in the scan results, which can be used for comparison with the memory snapshot to determine the residual data.

[0122] In combination with the above embodiments, in one implementation, the present application further provides a memory deletion method, which scans the host memory to obtain a scanning result, which specifically includes the following contents:

[0123] First, determining whether sensitive data is stored in a memory page related to the virtual machine, and / or determining whether a response rate of an application on the host is lower than a target response rate;

[0124] Then, when sensitive data is stored in the memory pages related to the virtual machine, or when the response rate of the application on the host is lower than the target response rate, a memory snapshot of the host is created to perform a clearing operation on the residual data of the virtual machine based on the memory snapshot of the host.

[0125] In an embodiment of the present application, in an optional application scenario, the method proposed in the present application can also be used to clean up sensitive data stored in memory pages related to the virtual machine to be deleted, and to release more storage space to optimize the response rate of the host. Therefore, when it is determined that sensitive data exists in the memory pages related to the virtual machine or the host response rate is lower than the target response rate, the memory deletion method proposed in the present application can effectively optimize these two situations.

[0126] Regarding the presence of sensitive data in the memory pages related to the virtual machine, as described above, the memory deletion method used in the relevant technology does not have the operation of re-detecting and repeatedly clearing the memory pages that have completed the deletion operation. Therefore, if some sensitive data is contained therein, the sensitive data may exist in the residual data after the deletion operation. At this time, if this part of the memory pages is directly allocated to other virtual machines for use through the virtualization management platform, the sensitive information may be restored based on the content in the residual data, causing a hidden danger of user information leakage. Therefore, in the case where sensitive data exists in the memory pages related to the virtual machine, it is necessary to create a memory snapshot according to the method proposed in this application, and clear the residual data according to the memory snapshot to ensure that the residual data is completely cleared and no user sensitive information exists in the memory pages related to the virtual machine.

[0127] In the case where the response rate of the application on the host is lower than the target response rate, after the deletion operation is performed in the relevant technology, the residual data in the memory page related to the virtual machine is not cleared. When other virtual machines use this part of the memory page, it will affect their processing rate. For example, when writing the same data to a blank memory page and a memory page containing residual data, the blank memory page only needs to be directly written, while the memory page with residual data needs to erase the residual data and then write it, which affects the user's efficiency. Therefore, in the case where the response rate of the application on the host is lower than the target response rate, a memory snapshot can be created by the method proposed in this application, and the residual data can be cleared according to the memory snapshot to ensure that the residual data is completely cleared, so as to optimize the subsequent virtual machine or host user's experience of the relevant memory pages.

[0128] In combination with the above embodiments, in one implementation, the present application further provides a memory deletion method, which specifically includes the following contents:

[0129] In response to a restore instruction for other virtual machines deployed on the host, or in response to a migration instruction for other virtual machines deployed on the host, a delete instruction for the virtual machine is generated, and a memory snapshot of the host is created, where the memory snapshot is used to record memory pages related to the virtual machine in the memory of the host before the virtual machine is deleted;

[0130] Execute the deletion instruction to delete the virtual machine deployed on the host;

[0131] Scan the host memory to obtain a scanning result, wherein the scanning result is used to record memory pages related to the virtual machine in the host memory after the virtual machine is deleted;

[0132] Comparing the scan result with the memory snapshot to identify residual data of the virtual machine;

[0133] Performing a clearing operation on the residual data of the virtual machine;

[0134] The other virtual machines are restored on the memory pages related to the virtual machine, or the other virtual machines are migrated to the memory pages related to the virtual machine.

[0135] In an embodiment of the present application, in an optional application scenario, the method proposed in the present application can also be used to utilize the memory space occupied by the virtual machine to perform recovery operations or migration operations on other virtual machines. Before restoring or migrating other virtual machines, the memory pages related to the virtual machine need to be completely cleared.

[0136] In the related art, after a simple deletion operation, the relevant memory pages are used to restore or migrate other virtual machines. However, this often brings a series of problems as mentioned above, such as resource occupation, sensitive information leakage, and reduced system work efficiency, due to the residual data being not cleared. Therefore, the method proposed in the present application can be used to first take a memory snapshot of the memory pages related to the virtual machine before restoring or migrating other virtual machines, and then perform a series of methods proposed in the present application such as deletion operation, scanning operation, comparing the scanning result with the memory snapshot, determining residual data, and repeatedly performing a clearing operation, so as to completely delete all the memory space associated with the virtual machine. On this basis, the virtual machine recovery or virtual machine migration operations required by the user are performed, thereby improving resource utilization, avoiding the risk of sensitive information leakage, and greatly improving user efficiency.

[0137] Based on the same design concept, an embodiment of the present application provides a memory deletion device. Figure 3 , Figure 3 : is a structural block diagram of a memory deletion device provided by an embodiment of the present application. Figure 3 As shown, the device comprises:

[0138] A snapshot creation module, configured to create a memory snapshot of the host in response to a deletion instruction for a virtual machine deployed on the host, wherein the memory snapshot is used to record memory pages related to the virtual machine in the memory of the host before the virtual machine is deleted;

[0139] A deletion module, used to execute the deletion instruction to delete the virtual machine deployed on the host;

[0140] A scanning module, used to scan the host memory to obtain a scanning result, wherein the scanning result is used to record the memory pages related to the virtual machine in the memory of the host after the virtual machine is deleted;

[0141] A scanning result comparison module, used to compare the scanning result with the memory snapshot to identify residual data of the virtual machine;

[0142] A clearing module, used to perform a clearing operation on the residual data of the virtual machine;

[0143] The state recovery module is used to restore the memory state of the memory page related to the virtual machine to an available state, so that the host can allocate the memory page related to the virtual machine to other virtual machines.

[0144] Optionally, the deletion module further includes:

[0145] A releasable state marking submodule, used for marking all memory pages related to the virtual machine as being in a releasable state;

[0146] The memory page deletion submodule is used to delete the memory pages marked as releasable;

[0147] The deletion verification submodule is used to verify whether the virtual machine is removed from the host and does not occupy the hardware resources of the host after the deletion operation is completed.

[0148] Optionally, the scanning result comparison module further includes:

[0149] A result comparison submodule, used to compare the scan result with the memory snapshot to identify memory areas that have not been released or marked as abnormal;

[0150] A residual data determination submodule, used to check the attributes, access mode and association with the virtual machine metadata of the identified memory area to determine whether the data in the identified memory area is residual data of the virtual machine;

[0151] The log recording submodule is used to record the physical address, size, and content summary of the residual data of the virtual machine in a log.

[0152] Optionally, the clearing module further includes:

[0153] A clearing execution submodule, configured to clear the residual data of the virtual machine by adopting a target clearing method, wherein the target clearing method includes at least: a multiple overwriting method that does not affect other data of the host, and a physical erasing method that does not affect other data of the host;

[0154] A clearing verification submodule, used to verify whether the residual data of the virtual machine is completely cleared after the residual data of the virtual machine is cleared;

[0155] The repeated clearing submodule is used to repeatedly clear the residual data of the virtual machine when the residual data of the virtual machine is not completely cleared.

[0156] Optionally, the scanning module includes:

[0157] The memory scanning submodule is used to scan the memory area of ​​the virtual machine starting from the memory start address of the virtual machine by adopting a target scanning method, wherein each memory unit is accessed once.

[0158] Optionally, the snapshot creation module includes:

[0159] A situation confirmation submodule, used to determine whether sensitive data is stored in the memory page related to the virtual machine, and / or determine whether the response rate of the application on the host is lower than the target response rate;

[0160] A memory snapshot creation submodule is used to create a memory snapshot of the host when sensitive data is stored in the memory pages related to the virtual machine, or when the response rate of the application on the host is lower than the target response rate, so as to perform a clearing operation on the residual data of the virtual machine based on the memory snapshot of the host.

[0161] Optionally:

[0162] The snapshot creation module is further used to generate a deletion instruction for the virtual machine in response to a recovery instruction for other virtual machines deployed on the host, or in response to a migration instruction for other virtual machines deployed on the host, and to create a memory snapshot of the host, wherein the memory snapshot is used to record memory pages related to the virtual machine in the memory of the host before the virtual machine is deleted;

[0163] The state recovery module is further used to restore the other virtual machines on the memory pages related to the virtual machine, or migrate the other virtual machines to the memory pages related to the virtual machine.

[0164] Based on the same design concept, another embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps in the memory deletion method described in any of the above embodiments of the present application are implemented.

[0165] Based on the same design concept, another embodiment of the present application provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the steps in the memory deletion method described in any of the above embodiments of the present application.

[0166] Based on the same design concept, another embodiment of the present application provides an electronic device, such as Figure 4 shown. Figure 4 1 is a schematic diagram of an electronic device shown in an embodiment of the present application. The electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes, the steps in the memory deletion method described in any of the above embodiments of the present application are implemented.

[0167] 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.

[0168] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0169] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present application may adopt the form of complete hardware embodiments, complete software embodiments, or embodiments in combination with software and hardware. Moreover, the embodiments of the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.

[0170] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0171] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0172] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0173] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present application.

[0174] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.

[0175] The above is a detailed introduction to a memory deletion method, device, equipment and medium provided by the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for general technical personnel in this field, according to the idea of ​​the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A memory deletion method, characterized in that: include: In response to a deletion instruction for a virtual machine deployed on a host, creating a memory snapshot of the host, the memory snapshot being used to record memory pages related to the virtual machine in the memory of the host before the virtual machine is deleted; Execute the deletion instruction to delete the virtual machine deployed on the host; Scan the host memory to obtain a scanning result, wherein the scanning result is used to record memory pages related to the virtual machine in the host memory after the virtual machine is deleted; Comparing the scan result with the memory snapshot to identify residual data of the virtual machine; Performing a clearing operation on the residual data of the virtual machine; The memory state of the memory page related to the virtual machine is restored to an available state, so that the host can allocate the memory page related to the virtual machine to other virtual machines.

2. A memory deletion method according to claim 1, characterized in that: Executing the deletion instruction to delete the virtual machine deployed on the host includes: Marking all memory pages associated with the virtual machine as releasable; Delete the memory pages marked as releasable; After the deletion operation is completed, verify whether the virtual machine is removed from the host and does not occupy the hardware resources of the host.

3. A memory deletion method according to claim 1, characterized in that: Comparing the scan result with the memory snapshot to identify residual data of the virtual machine includes: Comparing the scan result with the memory snapshot to identify memory areas that have not been released or marked as abnormal; Checking the attributes, access mode and association of the identified memory area with the virtual machine metadata to determine whether the data in the identified memory area is residual data of the virtual machine; The method further comprises: The physical address, size, and content summary of the residual data of the virtual machine are recorded in a log.

4. A memory deletion method according to claim 1, characterized in that: Performing a clearing operation on the residual data of the virtual machine includes: Using a target clearing method to clear the residual data of the virtual machine, the target clearing method at least includes: a multiple overwriting method that does not affect other data of the host, and a physical erasing method that does not affect other data of the host; After performing a clearing operation on the residual data of the virtual machine, verifying whether the residual data of the virtual machine is completely cleared; When the residual data of the virtual machine is not completely cleared, the residual data of the virtual machine is repeatedly cleared.

5. A memory deletion method according to claim 1, characterized in that: Scan the host memory and obtain the scan results, including: A target scanning method is adopted to scan the memory area of ​​the virtual machine starting from the memory start address of the virtual machine. The target scanning method is a scanning method in which each memory unit is accessed once.

6. A memory deletion method according to claim 1, characterized in that: In response to a deletion instruction for a virtual machine deployed on a host, creating a memory snapshot of the host, including: Determining whether sensitive data is stored in a memory page associated with the virtual machine, and / or determining whether a response rate of an application on the host is lower than a target response rate; When sensitive data is stored in the memory pages related to the virtual machine, or when the response rate of the application on the host is lower than the target response rate, a memory snapshot of the host is created to perform a clearing operation on the residual data of the virtual machine based on the memory snapshot of the host.

7. A memory deletion method according to any one of claims 1 to 6, characterized in that: Also includes: In response to a restore instruction for other virtual machines deployed on the host, or in response to a migration instruction for other virtual machines deployed on the host, a delete instruction for the virtual machine is generated, and a memory snapshot of the host is created, where the memory snapshot is used to record memory pages related to the virtual machine in the memory of the host before the virtual machine is deleted; Execute the deletion instruction to delete the virtual machine deployed on the host; Scan the host memory to obtain a scanning result, wherein the scanning result is used to record memory pages related to the virtual machine in the host memory after the virtual machine is deleted; Comparing the scan result with the memory snapshot to identify residual data of the virtual machine; Performing a clearing operation on the residual data of the virtual machine; The other virtual machines are restored on the memory pages related to the virtual machine, or the other virtual machines are migrated to the memory pages related to the virtual machine.

8. A memory deletion device, characterized in that: The device comprises: A snapshot creation module, configured to create a memory snapshot of the host in response to a deletion instruction for a virtual machine deployed on the host, wherein the memory snapshot is used to record memory pages related to the virtual machine in the memory of the host before the virtual machine is deleted; A deletion module, used to execute the deletion instruction to delete the virtual machine deployed on the host; A scanning module, used to scan the host memory to obtain a scanning result, wherein the scanning result is used to record the memory pages related to the virtual machine in the memory of the host after the virtual machine is deleted; A scanning result comparison module, used to compare the scanning result with the memory snapshot to identify residual data of the virtual machine; A clearing module, used to perform a clearing operation on the residual data of the virtual machine; The state recovery module is used to restore the memory state of the memory page related to the virtual machine to an available state, so that the host can allocate the memory page related to the virtual machine to other virtual machines.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the computer program is executed by the processor, the memory deletion method according to any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the memory deletion method as described in any one of claims 1 to 7 is implemented.

Citation Information

Cited By

  • Memory sub-system testing and validation

    US12754813B2