CN112099904B - Nested page table management method and device of virtual machine, processor chip and server - Google Patents
Nested page table management method and device of virtual machine, processor chip and server Download PDFInfo
- Publication number
- CN112099904B CN112099904B CN202010866718.4A CN202010866718A CN112099904B CN 112099904 B CN112099904 B CN 112099904B CN 202010866718 A CN202010866718 A CN 202010866718A CN 112099904 B CN112099904 B CN 112099904B
- Authority
- CN
- China
- Prior art keywords
- virtual machine
- physical address
- page table
- nested page
- machine physical
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000007726 management method Methods 0.000 title abstract description 18
- 238000013507 mapping Methods 0.000 claims abstract description 43
- 238000000034 method Methods 0.000 claims abstract description 32
- 230000015654 memory Effects 0.000 claims description 51
- 238000004422 calculation algorithm Methods 0.000 claims description 25
- 238000001514 detection method Methods 0.000 claims description 9
- 238000005516 engineering process Methods 0.000 abstract description 4
- 230000003993 interaction Effects 0.000 description 6
- 238000010586 diagram Methods 0.000 description 5
- 230000009471 action Effects 0.000 description 3
- 230000006870 function Effects 0.000 description 3
- 230000008569 process Effects 0.000 description 3
- 238000004364 calculation method Methods 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 101100217298 Mus musculus Aspm gene Proteins 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000004590 computer program Methods 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000002955 isolation Methods 0.000 description 1
- 230000005055 memory storage Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000037361 pathway Effects 0.000 description 1
- 230000004044 response Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 230000001960 triggered effect Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
- G06F2009/45566—Nested virtual machines
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
- G06F2009/45583—Memory management, e.g. access or allocation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
- G06F2009/45587—Isolation or security of virtual machine instances
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Storage Device Security (AREA)
Abstract
The embodiment of the invention discloses a nested page table management method and device of a virtual machine, a processor chip and a server, relates to the technical field of computers, and can effectively improve the safety of the nested page table and the virtual machine. The method comprises the following steps: the virtual machine manager allocates a virtual machine physical address range and a host machine physical address range for a new page of a nested page table according to a nested page-missing interrupt request generated by the virtual machine; the virtual machine manager sends the virtual machine physical address range and the host machine physical address range to a security processor; and the secure processor establishes a mapping relation between the virtual machine physical address and the host machine physical address according to the virtual machine physical address range and the host machine physical address range and updates the nested page table so as to be used by the virtual machine. The method and the device are suitable for the related technology of the virtual machine.
Description
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for managing nested page tables of a virtual machine, a processor chip, and a server.
Background
Virtual machine technology is an infrastructure technology of cloud computing, which is implemented in a virtual machine as a basic unit. The virtual machine has the advantages of resource isolation, quick deployment and the like, but the traditional virtual machine has serious defects in the aspect of safety.
Secure encryption virtual machines are a new trend in the field of virtualization in recent years. The CPU manufacturer provides the encryption function for the memory of the virtual machine at the hardware level, and the VMM (Virtual Machine Monitor, virtual machine manager) and the security processor cooperate to start the virtual machine. After the virtual machine is started, the memory data is encrypted. Only the virtual machine itself can decrypt the memory data, the VMM cannot correctly decrypt the virtual machine memory, and cannot read the virtual machine memory, so that the security of the virtual machine is greatly improved.
However, since the nested page table of the secure encryption virtual machine is still in plain text and managed by the VMM, an attacker may acquire the memory data of the secure encryption virtual machine by attacking the nested page table of the secure encryption virtual machine, so that the secure encryption virtual machine still has a great potential safety hazard.
Disclosure of Invention
In view of the above, embodiments of the present invention provide a method, an apparatus, a processor chip, and a server for managing nested page tables of a virtual machine, which can effectively improve security of nested page tables and virtual machines.
In a first aspect, an embodiment of the present invention provides a method for managing nested page tables of a virtual machine, including: the virtual machine manager allocates a virtual machine physical address range and a host machine physical address range for a new page of a nested page table according to a nested page-missing interrupt request generated by the virtual machine; the virtual machine manager sends the virtual machine physical address range and the host machine physical address range to a security processor; and the secure processor establishes a mapping relation between the virtual machine physical address and the host machine physical address according to the virtual machine physical address range and the host machine physical address range and updates the nested page table so as to be used by the virtual machine.
Optionally, after the virtual machine manager sends the virtual machine physical address range and the host machine physical address range to the secure processor, before the secure processor establishes an address mapping relationship between a virtual machine physical address and a host machine physical address according to the virtual machine physical address range and the host machine physical address range and updates the nested page table, the method further includes: the secure processor detecting whether the nested page table has been tampered with; the secure processor establishing a mapping relationship between a virtual machine physical address and a host machine physical address and updating the nested page table according to the virtual machine physical address range and the host machine physical address range comprises: under the condition that the nested page table is not tampered, the secure processor establishes a mapping relation between a virtual machine physical address and a host machine physical address according to the virtual machine physical address range and the host machine physical address range and updates the nested page table; in the event that the nested page table has been tampered with, the secure processor refuses to update the nested page table.
Optionally, the secure processor detecting whether the nested page table is tampered with includes: the security processor determines a current characteristic value of a current nested page table according to a preset algorithm; and the security processor compares the consistency of the current characteristic value with a prestored characteristic value stored in the security processor so as to detect whether the nested page table is tampered.
Optionally, the pre-stored characteristic value is obtained by the secure processor executing the preset algorithm on the updated nested page table after updating the nested page table each time, and is stored in a private memory of the secure processor.
Optionally, the method further comprises: detecting whether the nested page table is tampered or not once every preset time by the security processor; and stopping running the virtual machine under the condition that the nested page table is tampered.
In a second aspect, an embodiment of the present invention further provides a nested page table management apparatus for a virtual machine, including: the allocation unit is used for allocating a virtual machine physical address range and a host machine physical address range for a new page of the nested page table according to the nested page fault interrupt request generated by the virtual machine through the virtual machine manager; the sending unit is used for sending the virtual machine physical address range and the host machine physical address range to the security processor through the virtual machine manager; the establishing unit is used for establishing a mapping relation between the virtual machine physical address and the host machine physical address and updating the nested page table by the secure processor according to the virtual machine physical address range and the host machine physical address range so as to be used by the virtual machine.
Optionally, the apparatus further includes: the first detection unit is used for detecting whether the nested page table is tampered or not by the security processor before the address mapping relation between the virtual machine physical address and the host machine physical address is established and the nested page table is updated according to the virtual machine physical address range and the host machine physical address range by the security processor after the virtual machine physical address range and the host machine physical address range are sent to the security processor by the virtual machine manager; the establishing unit includes: the establishing module is used for establishing a mapping relation between a virtual machine physical address and a host machine physical address and updating the nested page table through the secure processor according to the virtual machine physical address range and the host machine physical address range under the condition that the nested page table is not tampered; and the rejecting module is used for rejecting updating the nested page table through the secure processor under the condition that the nested page table is tampered.
Optionally, the first detection unit is specifically configured to: the determining module is used for determining the current characteristic value of the current nested page table according to a preset algorithm through the security processor; and the comparison module is used for comparing the consistency of the current characteristic value with a prestored characteristic value which is prestored by the security processor through the security processor so as to detect whether the nested page table is tampered or not.
Optionally, the pre-stored characteristic value is obtained by the secure processor executing the preset algorithm on the updated nested page table after updating the nested page table each time, and is stored in a private memory of the secure processor.
Optionally, the apparatus further includes: the second detection unit is used for detecting whether the nested page table is tampered or not once every preset time length by the safety processor; and the stopping unit is used for stopping running the virtual machine under the condition that the nested page table is tampered.
In a third aspect, embodiments of the present invention further provide a processor chip, including: a processor core and a secure processor; the processor core is configured to run a virtual machine manager and a virtual machine to execute the following procedures: the virtual machine sends a nested page fault interrupt request to the virtual machine manager; the virtual machine manager allocates a virtual machine physical address range and a host machine physical address range for a new page of a nested page table according to the nested page fault interrupt request, and sends the virtual machine physical address range and the host machine physical address range to a secure processor; the secure processor is configured to establish a mapping relationship between a virtual machine physical address and a host machine physical address according to the virtual machine physical address range and the host machine physical address range, and update the nested page table for use by the virtual machine.
Optionally, the secure processor is further configured to: after receiving the virtual machine physical address range and the host machine physical address range, before establishing an address mapping relation between a virtual machine physical address and a host machine physical address according to the virtual machine physical address range and the host machine physical address range and updating the nested page table, detecting whether the nested page table is tampered; under the condition that the nested page table is not tampered, establishing a mapping relation between a virtual machine physical address and a host machine physical address according to the virtual machine physical address range and the host machine physical address range and updating the nested page table; in the event that the nested page table has been tampered with, refusing to update the nested page table.
Optionally, the security processor is specifically configured to: determining a current characteristic value of a current nested page table according to a preset algorithm; and comparing the consistency of the current characteristic value with a prestored characteristic value stored in the security processor to detect whether the nested page table is tampered.
Optionally, the pre-stored characteristic value is obtained by the secure processor executing the preset algorithm on the updated nested page table after updating the nested page table each time, and is stored in a private memory of the secure processor.
Optionally, the secure processor is further configured to detect whether the nested page table is tampered once every predetermined time period; the processor core is further configured to stop running the virtual machine if the nested page table has been tampered with.
In a fourth aspect, an embodiment of the present invention further provides a server, including: the device comprises a shell, a processor, a memory, a circuit board and a power circuit, wherein the circuit board is arranged in a space surrounded by the shell, and the processor and the memory are arranged on the circuit board; a power supply circuit for supplying power to each circuit or device of the electronic apparatus; the memory is used for storing executable program codes; the processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory, and is used for executing any management method of the virtual machine nested page table provided by the embodiment of the invention.
According to the nested page table management method, the device, the processor chip and the server for the virtual machine, the virtual machine manager can allocate a virtual machine physical address range and a host machine physical address range for a new page of a nested page table according to a nested page fault interrupt request generated by the virtual machine, and send the virtual machine physical address range and the host machine physical address range to the secure processor, and the secure processor can establish a mapping relation between a virtual machine physical address and a host machine physical address according to the virtual machine physical address range and the host machine physical address range and update the nested page table for the virtual machine. Therefore, the mapping relation between the virtual machine physical address and the host machine physical address in the nested page table is separated from the grasp of the virtual machine manager, and is established and maintained by the security processor with higher security, so that threat software is difficult to break through the security protection of the security processor to attack the nested page table, the virtual machine manager and the security processor can be utilized to jointly complete the security read-write support of the memory data of the virtual machine, and the security of the nested page table and the virtual machine is effectively improved.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, it being obvious that the drawings in the following description are only some embodiments of the invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a method for nested page table management of a virtual machine according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of information interaction in a method for managing nested page tables of a virtual machine according to an embodiment of the present invention;
FIG. 3 is a flowchart of a method for managing nested page tables of a virtual machine according to an embodiment of the present invention;
FIG. 4 is a flow chart of checking the integrity of nested page tables in an embodiment of the present invention;
FIG. 5 is a schematic diagram of a device for managing nested page tables of a virtual machine according to an embodiment of the present invention;
FIG. 6 is a schematic diagram of a processor chip according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of a server according to an embodiment of the present invention.
Detailed Description
Embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
It should be understood that the described embodiments are merely some, but not all, embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
As described in the background art, in a conventional virtual machine, a virtual machine manager VMM maps a correspondence between a virtual machine physical address and a host machine physical address to generate a corresponding nested page table. Because the nested page table is stored in the common memory and is not encrypted, the virtual machine manager can acquire the memory data encrypted by the virtual machine by tampering with the nested page table, and the virtual machine memory safety has great hidden trouble.
For example, SEVered is an example of an attack on the AMD's SEV secure encrypted virtual machine nested page tables. In the SEVered attack example, it is assumed that the attacker has acquired the VMM authority so that the nested page tables of the virtual machine can be manipulated. And the attacker acquires the memory data responded by the virtual machine by sending a request to the http service of the secure encrypted virtual machine. After an attacker obtains the GPA (Guest PHYSICAL ADDRESS, virtual machine physical address) and HPA (Host PHYSICAL ADDRESS ) of the http response memory in some way, the nested page table is modified, and the HPA pointed by the GPA is replaced by other memories of the virtual machine. When the attacker sends the http request again, the memory returned by the virtual machine is illegally replaced memory content, so that the memory of the secure virtual machine is revealed.
In order to make up for the security vulnerability of the nested page table of the secure encryption virtual machine, the embodiment of the invention provides a nested page table management method of the virtual machine, which can effectively improve the security of the nested page table and the virtual machine.
In order that those skilled in the art will better understand the technical concepts, embodiments and advantageous technical effects of the examples of the present invention, a detailed description will be given below by way of specific examples.
As shown in fig. 1, an embodiment of the present invention provides a method for managing nested page tables of a virtual machine, including:
S11, the virtual machine manager allocates a virtual machine physical address range and a host machine physical address range for a new page of a nested page table according to a nested page missing interrupt request generated by the virtual machine;
The virtual machine in the embodiment of the invention can be a common virtual machine or a safe encryption virtual machine for encrypting the memory of the virtual machine. When the virtual machine performs read-write operation on the memory, a corresponding operation instruction can be transmitted to the virtual machine manager, and the virtual machine manager further interacts with the system.
In this step, when the virtual machine needs to perform data interaction with the memory, if the address range where the memory data is located is not included in the current nested page table, the virtual machine may generate a nested page fault interrupt request, apply for expanding the current nested page table, and further map the memory address required by the virtual machine to the host physical address, so as to perform data interaction with the memory.
After receiving the nested interrupt request, the virtual machine manager can allocate a virtual machine physical address range and a host machine physical address range for a new page of the nested page table according to the use condition of the system memory and the existing virtual machine physical address of the virtual machine. For example, in one embodiment of the invention, the virtual machine physical address range may be X0F10000 to X0F60000, the host physical address range may be X1240000 to X12A0000, and so on.
It should be noted that, the virtual machine manager only allocates an address range, and in this address range, the virtual machine manager does not have the right to allocate and learn how to specifically allocate the physical address of the virtual machine to the physical address of the host machine.
It should be further noted that in this step, the new page of the nested page table may be the first page of the newly created nested page table, or may be a page added to a subsequent page in the created nested page table. The embodiments of the present invention are not limited in this regard.
S12, the virtual machine manager sends the virtual machine physical address range and the host machine physical address range to a security processor;
After the virtual machine manager allocates the virtual machine physical address range and the host physical address range for the new page of the nested page table, the virtual machine manager may send the two address ranges to the secure processor.
In embodiments of the present invention, the virtual machine manager and virtual machine may run in a general purpose processor. Both the general purpose processor and the secure processor may be located internal to the processor chip. The safety processor does not perform general data processing and only performs safety management and safety configuration. The important security task is that the hardware only allows the security processor to execute and refuses the general purpose processor to execute, thereby improving the security.
In one embodiment of the invention, within a complete processor package, multiple processors exist in the form of cores, and the secure processor is a CPU core that is isomorphic or heterogeneous with the general purpose processor, with limited interaction pathways between the general purpose processor.
S13, the secure processor establishes a mapping relation between a virtual machine physical address and a host machine physical address according to the virtual machine physical address range and the host machine physical address range, and updates the nested page table for the virtual machine to use.
After the secure processor receives the virtual machine physical address range and the host machine physical address range sent by the virtual machine manager, the secure processor can establish an address mapping relationship in the two address ranges according to an algorithm preset in the secure processor. For example, virtual machine physical address X20300FF is mapped to host physical address X19600 according to a preset function.
After the mapping relation between the physical address of the virtual machine and the physical address of the host machine is established, the mapping relation can be added into a nested page table, so that the virtual machine performs data interaction with the memory according to the address mapping relation provided in the nested page table, and the nested page-missing interrupt request of the virtual machine is responded.
According to the nested page table management method of the virtual machine, the virtual machine manager can allocate a virtual machine physical address range and a host machine physical address range for a new page of the nested page table according to the nested page fault interrupt request generated by the virtual machine, and send the virtual machine physical address range and the host machine physical address range to the secure processor, and the secure processor can establish a mapping relation between a virtual machine physical address and a host machine physical address according to the virtual machine physical address range and the host machine physical address range and update the nested page table for the virtual machine. Therefore, the mapping relation between the virtual machine physical address and the host machine physical address in the nested page table is separated from the grasp of the virtual machine manager, and is established and maintained by the security processor with higher security, so that threat software is difficult to break through the security protection of the security processor to attack the nested page table, the virtual machine manager and the security processor can be utilized to jointly complete the security read-write support of the memory data of the virtual machine, and the security of the nested page table and the virtual machine is effectively improved.
Illustratively, in one embodiment of the invention, a schematic diagram of the interaction of a secure processor with a virtual machine manager may be as shown in FIG. 2.
In order to further improve the security of the nested page table and prevent the virtual machine manager from tampering with the nested page table with a minimum possibility, in one embodiment of the present invention, the nested page table may also be checked for integrity.
Specifically, in one embodiment of the present invention, after the virtual machine manager sends the virtual machine physical address range and the host machine physical address range to the secure processor in step S12, before the secure processor establishes an address mapping relationship between a virtual machine physical address and a host machine physical address according to the virtual machine physical address range and the host machine physical address range and updates the nested page table in step S13, the nested page table management method for a virtual machine provided in the embodiment of the present invention may further include: the secure processor detects whether the nested page table has been tampered with.
Based on this, the step S13, the secure processor establishing a mapping relationship between a virtual machine physical address and a host machine physical address according to the virtual machine physical address range and the host machine physical address range, and updating the nested page table specifically may include: under the condition that the nested page table is not tampered, the secure processor establishes a mapping relation between a virtual machine physical address and a host machine physical address according to the virtual machine physical address range and the host machine physical address range and updates the nested page table; in the event that the nested page table has been tampered with, the secure processor refuses to update the nested page table. Thus, even if the nested page table is tampered by the virtual machine manager with a small possibility, the security processor can find out, so that the nested page table is refused to be mapped for the virtual machine, and the security of the nested page table and the virtual machine is further improved.
In an implementation, the secure processor detecting whether the nested page table is tampered with may include:
the security processor determines a current characteristic value of a current nested page table according to a preset algorithm;
And the security processor compares the consistency of the current characteristic value with a prestored characteristic value stored in the security processor so as to detect whether the nested page table is tampered.
Optionally, the preset algorithm may be various algorithms such as a hash algorithm, which can characterize nested page tables. When the nested page table is modified, the characteristic value corresponding to the algorithm also changes greatly. The pre-stored characteristic value can be obtained by the security processor by executing the preset algorithm on the updated nested page table after updating the nested page table each time and is stored in the private memory of the security processor. The private memory is located inside the secure processor and cannot be read or modified by the VMM.
For example, in one embodiment of the invention, the secure processor hashes the entire contents of the nested page tables after each update of the nested page tables. For example, the SM3 algorithm or the SHA1 algorithm is used for hashing all non-empty page table entries, and the result is stored in the private memory storage of the secure processor. The hash value VMM cannot be read or modified. When the secure encryption virtual machine generates the nested page missing terminal again and requests the secure processor to map the page table, the secure processor can firstly perform hash calculation on the whole Zhang Yebiao and compare the hash value stored in the secure processor with the hash value stored in the secure processor, if the hash value is the same, the secure processor is used for updating the nested page table for two times, the nested page table is not modified, and the secure processor continues to map the page table. Otherwise, the secure processor considers that the nested page table has been tampered, and refuses to update the nested page table to serve the virtual machine.
By way of example, one processing scheme for a secure processor when updating a nested page table may be as shown in FIG. 3.
The nested page table can be effectively prevented from being tampered by the virtual machine manager by detecting the integrity of the nested page table. However, the inventors have further discovered in the study that if the virtual machine manager VMM tampers with the page table between two nested page table updates and restores the tampered content, the secure processor cannot discover this. In addition, after the running time of the secure encryption virtual machine is longer, the memory allocation of the virtual machine is finished, the nested page fault interrupt is not generated any more, the secure processor does not update the nested page table for the virtual machine any more, and at the moment, if the VMM falsifies the page table, the secure processor cannot find out.
To at least partially solve the above problems, the method for managing nested page tables of a virtual machine according to an embodiment of the present invention may further include: detecting whether the nested page table is tampered or not once every preset time by the security processor; and stopping running the virtual machine under the condition that the nested page table is tampered.
In specific implementation, a timer may be set in the secure processor or in the virtual machine manager, and the timing duration may be, for example, several seconds to several tens of seconds, and the timer is triggered by the timer interrupt to detect whether the nested page table is tampered with. For example, in one embodiment of the invention, a timer may be set in the VMM to periodically send a command requesting the secure processor to do an integrity check on the nested page tables. After receiving the command, the security processor performs hash calculation on the whole page table, compares the hash value with the stored hash value, and if the hash value is different, indicates that the nested page table is tampered, the virtual machine is attacked, and the virtual machine is stopped.
An exemplary scheme for the secure processor to periodically check the integrity of nested page tables may be as shown in fig. 4. Alternatively, the scheme shown in fig. 3 and the scheme shown in fig. 4 may be performed either individually or in combination.
The nested page table management method of the virtual machine provided by the embodiment of the invention strips the nested page table from the VMM. The nested page tables are no longer managed by the VMM but instead are transferred to the secure processor for management. The secure processor is responsible for creating and maintaining the nested page tables while the secure processor protects the integrity of the nested page tables by logging and comparing the hash values of the nested page tables. Because the security level of the security processor is higher than that of the VMM, the security processor is very difficult to attack, and the security processor is used for protecting the integrity of the nested page table, so that the attack on the nested page table can be prevented, and the security of the secure encryption virtual machine is improved.
Correspondingly, the embodiment of the invention also provides a nested page table management device of the virtual machine, which can effectively improve the security of the nested page table and the virtual machine.
As shown in fig. 5, a nested page table management device for a virtual machine according to an embodiment of the present invention includes:
an allocation unit 41, configured to allocate, by a virtual machine manager, a virtual machine physical address range and a host physical address range for a new page of a nested page table according to a nested page fault interrupt request generated by a virtual machine;
A sending unit 42, configured to send, by the virtual machine manager, the virtual machine physical address range and the host physical address range to a secure processor;
the establishing unit 43 is configured to establish, by using the secure processor, a mapping relationship between a virtual machine physical address and a host machine physical address according to the virtual machine physical address range and the host machine physical address range, and update the nested page table for use by the virtual machine.
According to the nested page table management device of the virtual machine, which is provided by the embodiment of the invention, a virtual machine manager can allocate a virtual machine physical address range and a host machine physical address range for a new page of a nested page table according to a nested page fault interrupt request generated by the virtual machine, and send the virtual machine physical address range and the host machine physical address range to a security processor, and the security processor can establish a mapping relation between a virtual machine physical address and a host machine physical address according to the virtual machine physical address range and the host machine physical address range and update the nested page table for the virtual machine. Therefore, the mapping relation between the virtual machine physical address and the host machine physical address in the nested page table is separated from the grasp of the virtual machine manager, and is established and maintained by the security processor with higher security, so that threat software is difficult to break through the security protection of the security processor to attack the nested page table, the virtual machine manager and the security processor can be utilized to jointly complete the security read-write support of the memory data of the virtual machine, and the security of the nested page table and the virtual machine is effectively improved.
Optionally, the nested page table management device of the virtual machine provided by the embodiment of the present invention may further include:
The first detection unit is used for detecting whether the nested page table is tampered or not by the security processor before the address mapping relation between the virtual machine physical address and the host machine physical address is established and the nested page table is updated according to the virtual machine physical address range and the host machine physical address range by the security processor after the virtual machine physical address range and the host machine physical address range are sent to the security processor by the virtual machine manager;
the setup unit 43 may include:
The establishing module is used for establishing a mapping relation between a virtual machine physical address and a host machine physical address and updating the nested page table through the secure processor according to the virtual machine physical address range and the host machine physical address range under the condition that the nested page table is not tampered;
And the rejecting module is used for rejecting updating the nested page table through the secure processor under the condition that the nested page table is tampered.
Optionally, the first detection unit may specifically be configured to:
The determining module is used for determining the current characteristic value of the current nested page table according to a preset algorithm through the security processor;
And the comparison module is used for comparing the consistency of the current characteristic value with a prestored characteristic value which is prestored by the security processor through the security processor so as to detect whether the nested page table is tampered or not.
Optionally, the pre-stored characteristic value is obtained by the secure processor executing the preset algorithm on the updated nested page table after updating the nested page table each time, and is stored in a private memory of the secure processor.
Optionally, the nested page table management device of the virtual machine provided by the embodiment of the present invention may further include:
the second detection unit is used for detecting whether the nested page table is tampered or not once every preset time length by the safety processor;
And the stopping unit is used for stopping running the virtual machine under the condition that the nested page table is tampered.
Accordingly, as shown in fig. 6, an embodiment of the present invention further provides a processor chip, including: a processor core 51 and a secure processor 52;
The processor core 51 is configured to run the virtual machine manager and the virtual machine to execute the following procedures:
the virtual machine sends a nested page fault interrupt request to the virtual machine manager;
The virtual machine manager allocates a virtual machine physical address range and a host machine physical address range for a new page of a nested page table according to the nested page fault interrupt request, and sends the virtual machine physical address range and the host machine physical address range to a secure processor;
And the secure processor 52 is configured to establish a mapping relationship between a virtual machine physical address and a host machine physical address according to the virtual machine physical address range and the host machine physical address range, and update the nested page table for use by the virtual machine.
In the processor chip provided by the embodiment of the invention, a virtual machine manager in the processor core 51 can allocate a virtual machine physical address range and a host machine physical address range for a new page of a nested page table according to a nested page fault interrupt request generated by a virtual machine, and send the virtual machine physical address range and the host machine physical address range to the secure processor 52, and the secure processor 52 can establish a mapping relation between a virtual machine physical address and a host machine physical address according to the virtual machine physical address range and the host machine physical address range and update the nested page table for use by the virtual machine. In this way, the mapping relation between the virtual machine physical address and the host machine physical address in the nested page table is separated from the grasp of the virtual machine manager, and is established and maintained by the security processor with higher security, so that threat software is difficult to break through the security protection of the security processor 52 to attack the nested page table, and therefore the security read-write support of the memory data of the virtual machine can be completed by the virtual machine manager and the security processor 52 together, and the security of the nested page table and the virtual machine is effectively improved.
Optionally, the security processor 52 is further configured to:
After receiving the virtual machine physical address range and the host machine physical address range, before establishing an address mapping relation between a virtual machine physical address and a host machine physical address according to the virtual machine physical address range and the host machine physical address range and updating the nested page table, detecting whether the nested page table is tampered;
under the condition that the nested page table is not tampered, establishing a mapping relation between a virtual machine physical address and a host machine physical address according to the virtual machine physical address range and the host machine physical address range and updating the nested page table;
in the event that the nested page table has been tampered with, refusing to update the nested page table.
Optionally, the security processor 52 may be specifically configured to:
Determining a current characteristic value of a current nested page table according to a preset algorithm;
And comparing the consistency of the current characteristic value with a prestored characteristic value stored in the security processor to detect whether the nested page table is tampered.
Optionally, the pre-stored characteristic value is obtained by the secure processor executing the preset algorithm on the updated nested page table after updating the nested page table each time, and is stored in a private memory of the secure processor.
Optionally, the secure processor 52 is further configured to detect whether the nested page tables are tampered with once every predetermined time period;
the processor core 51 is further configured to stop running the virtual machine if the nested page table has been tampered with.
Accordingly, as shown in fig. 7, the server provided by the embodiment of the present invention may include: the processor 62 and the memory 63 are arranged on the circuit board 64, wherein the circuit board 64 is arranged in a space surrounded by the shell 61; a power supply circuit 65 for supplying power to the respective circuits or devices of the above-described electronic apparatus; the memory 63 is for storing executable program code; the processor 62 executes a program corresponding to the executable program code by reading the executable program code stored in the memory 63, so as to implement any of the methods for managing nested page tables of virtual machines provided in the foregoing embodiments, so that corresponding beneficial technical effects can be achieved.
It is noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises an element.
In this specification, each embodiment is described in a related manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments.
In particular, for the device embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and reference is made to the description of the method embodiments in part.
For convenience of description, the above apparatus is described as being functionally divided into various units/modules, respectively. Of course, the functions of the various elements/modules may be implemented in the same piece or pieces of software and/or hardware when implementing the present invention.
Those skilled in the art will appreciate that implementing all or part of the above-described methods in accordance with the embodiments may be accomplished by way of a computer program stored on a computer readable storage medium, which when executed may comprise the steps of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a random-access Memory (Random Access Memory, RAM), or the like.
The foregoing is merely illustrative of the present invention, and the present invention is not limited thereto, and any changes or substitutions easily contemplated by those skilled in the art within the scope of the present invention should be included in the present invention. Therefore, the protection scope of the invention is subject to the protection scope of the claims.
Claims (13)
1. A method for nested page table management of a virtual machine, comprising:
The virtual machine manager allocates a virtual machine physical address range and a host machine physical address range for a new page of a nested page table according to a nested page-missing interrupt request generated by the virtual machine;
the virtual machine manager sends the virtual machine physical address range and the host machine physical address range to a security processor;
the secure processor establishes a mapping relation between a virtual machine physical address and a host machine physical address according to the virtual machine physical address range and the host machine physical address range and updates the nested page table for the virtual machine to use;
After the virtual machine manager sends the virtual machine physical address range and the host machine physical address range to the secure processor, before the secure processor establishes an address mapping relationship between a virtual machine physical address and a host machine physical address according to the virtual machine physical address range and the host machine physical address range and updates the nested page table, the method further includes:
the secure processor detecting whether the nested page table has been tampered with;
the secure processor establishing a mapping relationship between a virtual machine physical address and a host machine physical address and updating the nested page table according to the virtual machine physical address range and the host machine physical address range comprises:
Under the condition that the nested page table is not tampered, the secure processor establishes a mapping relation between a virtual machine physical address and a host machine physical address according to the virtual machine physical address range and the host machine physical address range and updates the nested page table;
in the event that the nested page table has been tampered with, the secure processor refuses to update the nested page table.
2. The method of claim 1, wherein the secure processor detecting whether the nested page table has been tampered with comprises:
the security processor determines a current characteristic value of a current nested page table according to a preset algorithm;
And the security processor compares the consistency of the current characteristic value with a prestored characteristic value stored in the security processor so as to detect whether the nested page table is tampered.
3. The method of claim 2, wherein the pre-stored feature value is obtained by the secure processor executing the preset algorithm on the updated nested page table after each update of the nested page table, and stored in a private memory of the secure processor.
4. A method according to any one of claims 1 to 3, further comprising:
Detecting whether the nested page table is tampered or not once every preset time by the security processor;
And stopping running the virtual machine under the condition that the nested page table is tampered.
5. A nested page table management apparatus for a virtual machine, comprising:
The allocation unit is used for allocating a virtual machine physical address range and a host machine physical address range for a new page of the nested page table according to the nested page fault interrupt request generated by the virtual machine through the virtual machine manager;
The sending unit is used for sending the virtual machine physical address range and the host machine physical address range to the security processor through the virtual machine manager;
The establishing unit is used for establishing a mapping relation between a virtual machine physical address and a host machine physical address and updating the nested page table through the secure processor according to the virtual machine physical address range and the host machine physical address range so as to be used by the virtual machine;
Further comprises:
The first detection unit is used for detecting whether the nested page table is tampered or not by the security processor before the address mapping relation between the virtual machine physical address and the host machine physical address is established and the nested page table is updated according to the virtual machine physical address range and the host machine physical address range by the security processor after the virtual machine physical address range and the host machine physical address range are sent to the security processor by the virtual machine manager;
The establishing unit includes:
The establishing module is used for establishing a mapping relation between a virtual machine physical address and a host machine physical address and updating the nested page table through the secure processor according to the virtual machine physical address range and the host machine physical address range under the condition that the nested page table is not tampered;
And the rejecting module is used for rejecting updating the nested page table through the secure processor under the condition that the nested page table is tampered.
6. The device according to claim 5, wherein the first detection unit is specifically configured to:
The determining module is used for determining the current characteristic value of the current nested page table according to a preset algorithm through the security processor;
And the comparison module is used for comparing the consistency of the current characteristic value with a prestored characteristic value which is prestored by the security processor through the security processor so as to detect whether the nested page table is tampered or not.
7. The apparatus of claim 6, wherein the pre-stored feature value is obtained by the secure processor executing the predetermined algorithm on the updated nested page table after each update of the nested page table, and stored in a private memory of the secure processor.
8. The apparatus according to any one of claims 5 to 7, further comprising:
the second detection unit is used for detecting whether the nested page table is tampered or not once every preset time length by the safety processor;
And the stopping unit is used for stopping running the virtual machine under the condition that the nested page table is tampered.
9. A processor chip, comprising: a processor core and a secure processor;
the processor core is configured to run a virtual machine manager and a virtual machine to execute the following procedures:
the virtual machine sends a nested page fault interrupt request to the virtual machine manager;
The virtual machine manager allocates a virtual machine physical address range and a host machine physical address range for a new page of a nested page table according to the nested page fault interrupt request, and sends the virtual machine physical address range and the host machine physical address range to a secure processor;
The secure processor is configured to establish a mapping relationship between a virtual machine physical address and a host machine physical address according to the virtual machine physical address range and the host machine physical address range, and update the nested page table for use by the virtual machine;
The secure processor is further configured to:
After receiving the virtual machine physical address range and the host machine physical address range, before establishing an address mapping relation between a virtual machine physical address and a host machine physical address according to the virtual machine physical address range and the host machine physical address range and updating the nested page table, detecting whether the nested page table is tampered;
under the condition that the nested page table is not tampered, establishing a mapping relation between a virtual machine physical address and a host machine physical address according to the virtual machine physical address range and the host machine physical address range and updating the nested page table;
in the event that the nested page table has been tampered with, refusing to update the nested page table.
10. The processor chip of claim 9, wherein the secure processor is specifically configured to:
Determining a current characteristic value of a current nested page table according to a preset algorithm;
And comparing the consistency of the current characteristic value with a prestored characteristic value stored in the security processor to detect whether the nested page table is tampered.
11. The processor chip of claim 10, wherein the pre-stored feature value is obtained by the secure processor executing the predetermined algorithm on the updated nested page table after each update of the nested page table, and stored in a private memory of the secure processor.
12. The processor chip of any one of claims 9 to 11, wherein the secure processor is further configured to detect whether the nested page tables have been tampered with once every predetermined period of time;
the processor core is further configured to stop running the virtual machine if the nested page table has been tampered with.
13. A server, comprising: the device comprises a shell, a processor, a memory, a circuit board and a power circuit, wherein the circuit board is arranged in a space surrounded by the shell, and the processor and the memory are arranged on the circuit board; the power supply circuit is used for supplying power to each circuit or device of the server; the memory is used for storing executable program codes; the processor executes a program corresponding to the executable program code by reading the executable program code stored in the memory for performing the method of any of the preceding claims 1-4.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010866718.4A CN112099904B (en) | 2020-08-25 | 2020-08-25 | Nested page table management method and device of virtual machine, processor chip and server |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010866718.4A CN112099904B (en) | 2020-08-25 | 2020-08-25 | Nested page table management method and device of virtual machine, processor chip and server |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112099904A CN112099904A (en) | 2020-12-18 |
CN112099904B true CN112099904B (en) | 2024-05-17 |
Family
ID=73754370
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010866718.4A Active CN112099904B (en) | 2020-08-25 | 2020-08-25 | Nested page table management method and device of virtual machine, processor chip and server |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112099904B (en) |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110955904B (en) * | 2019-11-22 | 2022-02-01 | 海光信息技术股份有限公司 | Data encryption method, data decryption method, processor and computer equipment |
CN114840299A (en) * | 2021-02-02 | 2022-08-02 | 北京大学 | Improved nested page table memory virtualization method and system under Shenwei architecture |
CN113342711B (en) * | 2021-06-28 | 2024-02-09 | 海光信息技术股份有限公司 | Page table updating method and device and related equipment |
CN114201752B (en) * | 2021-11-29 | 2022-10-18 | 海光信息技术股份有限公司 | Page table management method and device for security isolation virtual machine and related equipment |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101158924A (en) * | 2007-11-27 | 2008-04-09 | 北京大学 | Dynamic EMS memory mappings method of virtual machine manager |
CN109739613A (en) * | 2018-11-22 | 2019-05-10 | 海光信息技术有限公司 | Maintaining method, access control method and the relevant apparatus of nested page table |
CN110955904A (en) * | 2019-11-22 | 2020-04-03 | 海光信息技术有限公司 | Data encryption method, data decryption method, processor and computer equipment |
CN111190752A (en) * | 2019-12-30 | 2020-05-22 | 海光信息技术有限公司 | Method and device for sharing kernel memory of virtual machine |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
GB2460393B (en) * | 2008-02-29 | 2012-03-28 | Advanced Risc Mach Ltd | A data processing apparatus and method for controlling access to secure memory by virtual machines executing on processing circuitry |
US10169244B2 (en) * | 2016-07-29 | 2019-01-01 | Advanced Micro Devices, Inc. | Controlling access to pages in a memory in a computing device |
US10866909B2 (en) * | 2017-06-26 | 2020-12-15 | Intel Corporation | Technologies for protecting virtual machine memory |
-
2020
- 2020-08-25 CN CN202010866718.4A patent/CN112099904B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101158924A (en) * | 2007-11-27 | 2008-04-09 | 北京大学 | Dynamic EMS memory mappings method of virtual machine manager |
CN109739613A (en) * | 2018-11-22 | 2019-05-10 | 海光信息技术有限公司 | Maintaining method, access control method and the relevant apparatus of nested page table |
CN110955904A (en) * | 2019-11-22 | 2020-04-03 | 海光信息技术有限公司 | Data encryption method, data decryption method, processor and computer equipment |
CN111190752A (en) * | 2019-12-30 | 2020-05-22 | 海光信息技术有限公司 | Method and device for sharing kernel memory of virtual machine |
Non-Patent Citations (2)
Title |
---|
DMM:虚拟机的动态内存映射模型;陈昊罡;汪小林;王振林;张彬彬;罗英伟;李晓明;;中国科学:信息科学(12);全文 * |
嵌入式虚拟机管理器内存虚拟化方法研究;郝继锋;;航空计算技术(02);全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN112099904A (en) | 2020-12-18 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112099904B (en) | Nested page table management method and device of virtual machine, processor chip and server | |
CN109828827B (en) | Detection method, detection device and related equipment | |
CN109522726B (en) | Authentication method for applet, server and computer readable storage medium | |
US9698988B2 (en) | Management control method, apparatus, and system for virtual machine | |
US10963543B2 (en) | Secure communication between operating system and processes | |
CN107463838B (en) | Method for safety monitoring, device, system and storage medium based on SGX | |
CN104461683B (en) | A kind of method of calibration that virtual machine illegally configures, apparatus and system | |
CN111131307B (en) | Method and system for controlling access authority | |
WO2016109955A1 (en) | Software verifying method and device | |
CN109190335B (en) | Software copyright protection method and system | |
CN111935123B (en) | Method, equipment and storage medium for detecting DNS spoofing attack | |
CN103888465B (en) | A kind of webpage kidnaps detection method and device | |
CN110881186B (en) | Illegal device identification method and device, electronic device and readable storage medium | |
CN109347876B (en) | Security defense method and related device | |
CN107562514B (en) | Physical memory access control and isolation method | |
CN112257064B (en) | Nested page table measurement method, device and related equipment | |
WO2024125107A1 (en) | Mobile terminal security aspect protection method and apparatus, and storage medium and electronic device | |
CN109213572A (en) | A kind of confidence level based on virtual machine determines method and server | |
US20190356648A1 (en) | Resource extension method and device for a zone of a cloud service platform, apparatus and computer-readable storage medium | |
CN112804222A (en) | Data transmission method, device, equipment and storage medium based on cloud deployment | |
US20150281245A1 (en) | Method and apparatus for controlling access to a server | |
CN110061988B (en) | Authentication method of embedded equipment, service server and storage medium | |
CN109117625B (en) | Method and device for determining safety state of AI software system | |
CN115576626A (en) | Method, device and storage medium for safe mounting and dismounting of USB (Universal Serial bus) device | |
WO2016177051A1 (en) | Security authentication method and device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |