WO2025026051A1 - Implementation method and apparatus for virtual machine, and computer-readable storage medium - Google Patents
Implementation method and apparatus for virtual machine, and computer-readable storage medium Download PDFInfo
- Publication number
- WO2025026051A1 WO2025026051A1 PCT/CN2024/105493 CN2024105493W WO2025026051A1 WO 2025026051 A1 WO2025026051 A1 WO 2025026051A1 CN 2024105493 W CN2024105493 W CN 2024105493W WO 2025026051 A1 WO2025026051 A1 WO 2025026051A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- virtual machine
- processor
- memory
- computing device
- data
- 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.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; 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 OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/50—Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
- G06F21/52—Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems during program execution, e.g. stack integrity ; Preventing unwanted data erasure; Buffer overflow
- G06F21/53—Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems during program execution, e.g. stack integrity ; Preventing unwanted data erasure; Buffer overflow by executing in a restricted environment, e.g. sandbox or secure virtual machine
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/60—Protecting data
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/60—Protecting data
- G06F21/602—Providing cryptographic facilities or services
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/70—Protecting specific internal or peripheral components, in which the protection of a component leads to protection of the entire computer
- G06F21/82—Protecting input, output or interconnection devices
- G06F21/85—Protecting input, output or interconnection devices interconnection devices, e.g. bus-connected or in-line devices
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; 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
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; 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/45562—Creating, deleting, cloning virtual machine instances
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; 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/45575—Starting, stopping, suspending or resuming virtual machine instances
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; 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
Definitions
- the present application relates to the field of virtualization technology, and in particular to a virtual machine implementation method, device and computer-readable storage medium.
- a virtual machine is a complete computer system that is simulated by software and has complete hardware system functions and runs in a completely isolated environment. Any work that can be done in a computing device (such as a server) can be done in a virtual machine.
- a computing device such as a server
- part of the hard disk and memory capacity of the physical machine needs to be used as the hard disk and memory capacity of the virtual machine.
- Each virtual machine has an independent hard disk and operating system, and the user of the virtual machine can operate the virtual machine just like using a computing device.
- virtual machines in computing devices are managed by a hypervisor in the host operating system kernel, such as the kernel-based virtual machine (KVM).
- KVM kernel-based virtual machine
- the present application provides a virtual machine implementation method, device and computer-readable storage medium, which can greatly reduce the risk of virtual machines in computing devices being attacked and improve the security of user data in the virtual machines.
- a virtual machine implementation method is provided, which is applied to a computing device, wherein hardware resources of the computing device are divided into a rich execution environment (REE) side and a trusted execution environment (TEE) side, and the computing device includes a first virtual machine manager.
- the method specifically includes the following steps: a processor of the computing device runs the above-mentioned first virtual machine manager at an exception level (EL3) to start a first virtual machine, and the first virtual machine is deployed on the TEE side.
- EL3 exception level
- the processor after the processor starts the first virtual machine, it can run the first virtual machine to process user data. Since the processor runs the first virtual machine manager under EL3 to start the first virtual machine, and the first virtual machine is deployed on the TEE side, the virtual machine can be isolated from the host operating system kernel (located on the REE side) through the first virtual machine manager. In other words, the virtual machine is protected by the first virtual machine manager under EL3 and can avoid being accessed by the host operating system kernel on the REE side.
- the attacker cannot control the virtual machine through the virtual machine manager in the host operating system kernel, such as KVM, thereby protecting the security of the virtual machine in the computing device, and then protecting the security of the user data in the virtual machine.
- the virtual machine manager such as KVM
- the method further includes the following steps:
- the processor obtains the encrypted user data on the REE side;
- the processor runs the first virtual machine manager under EL3 to obtain the decryption key stored on the TEE side, and uses the decryption key to decrypt the encrypted user data to obtain the user data;
- the processor runs the first virtual machine to process user data.
- the processor can only obtain the decryption key by running the first virtual machine manager under EL3.
- the software on the REE side (such as the host operating system kernel and the virtual machine manager in the host operating system kernel) cannot obtain the decryption key stored on the TEE side. Therefore, even if the attacker breaks through the software on the REE side and steals the encrypted data, it is impossible to decrypt the plaintext of the user data. This can meet the demand that user data is not stolen by the software on the REE side, further improving the security of user data.
- the method before starting the first virtual machine, the method further includes the following steps: the processor obtains a creation instruction carrying configuration information of the first virtual machine to be created on the REE side, and then the processor runs the first virtual machine manager under EL3 to create the first virtual machine on the TEE side according to the configuration information carried by the creation instruction.
- a virtual machine can be created on the TEE side, which facilitates the subsequent use of the virtual machine to securely process user data.
- the method further includes the following steps: the processor simulates and obtains the first data on the REE side, then writes the first data into the first virtual machine manager, runs the first virtual machine manager under EL3 to inject the first data into the first virtual machine, and finally runs the first virtual machine according to the first data.
- the first data includes one or any combination of the following: a virtual interrupt of the first virtual machine, a virtual clock used by the first virtual machine, and memory-mapped input/output (MMIO) information used by the first virtual machine.
- MMIO memory-mapped input/output
- the processor simulates the virtual interrupt of the first virtual machine, the virtual clock used by the first virtual machine, and the MMIO information used by the first virtual machine on the REE side, instead of using the first virtual machine manager for simulation, which can make the trusted computing base (TCB) of the first virtual machine manager relatively thin.
- TDB trusted computing base
- the processor starts the first virtual machine when the first virtual machine manager running under EL3 determines that the first virtual machine is a secure virtual machine.
- the processor can run the first virtual machine manager under EL3 to provide the configuration information of the first virtual machine (such as the type of virtual processor cores, the number of virtual processor cores, memory addresses, etc.), the name of the application (APP) installed on the first virtual machine, and the hash value of the image of the first virtual machine, etc., to the user on the REE side for security measurement, that is, the user determines whether the first virtual machine is a secure virtual machine that meets its own expectations, or a non-secure virtual machine with security threats.
- the configuration information of the first virtual machine such as the type of virtual processor cores, the number of virtual processor cores, memory addresses, etc.
- APP application
- the processor can run the first virtual machine manager under EL3 to provide the configuration information of the first virtual machine (such as the type of virtual processor cores, the number of virtual processor cores, memory addresses, etc.), the name of the application (APP) installed on the first virtual machine, and the hash value of the image of the first virtual machine, etc.)
- the processor determines that the first virtual machine is a secure virtual machine and starts the first virtual machine. Otherwise, the processor determines that the first virtual machine is a non-secure virtual machine and does not start the first virtual machine.
- the processor starts the virtual machine only when it determines that the virtual machine is safe, which can avoid using an unsafe virtual machine to process user data, thereby improving not only the security of the virtual machine but also the security of user data in the virtual machine.
- the processor starts the first virtual machine when the first virtual machine manager running under EL3 determines that the computing device is a secure device.
- the processor can run the first virtual machine manager under EL3 to provide the certificate of the computing device to the user on the REE side for legitimacy check, that is, the user determines whether the computing device is a secure device that meets his expectations or a non-secure device that poses a security threat.
- the processor runs the first virtual machine manager under EL3 and obtains feedback from the user that the computing device is a secure device that meets his expectations, the processor determines that the computing device is a secure device and starts the first virtual machine; otherwise, the processor determines that the computing device is a non-secure device and does not start the first virtual machine.
- the processor starts the virtual machine only when it determines that the computing device is safe, which can avoid using an unsafe computing device to run the virtual machine to process user data, thereby improving not only the security of the virtual machine, but also the security of user data in the virtual machine.
- the method further includes the following steps: the processor obtains a first management command for the life cycle of the first virtual machine on the REE side, and then runs the first virtual machine manager under EL3, and performs one or any combination of the following operations on the first virtual machine according to the first management command: power on, power off, change specifications, migrate, and release.
- the life cycle of the virtual machine on the TEE side can be managed.
- the method further includes the following steps: the processor obtains a second management command for the first virtual machine on the REE side, and then runs the first virtual machine manager under EL3, and performs one or any combination of the following operations on the first virtual machine according to the second management command: installing an application, starting an application, shutting down an application, upgrading an application, uninstalling an application, and migrating an application.
- the method further includes the following steps: when an exception occurs in the first virtual machine, the processor runs the first virtual machine manager under EL3 to establish the context of the first virtual machine, and handles the exception that occurs in the first virtual machine. After handling the exception that occurs in the first virtual machine, the context of the first virtual machine is restored to the first virtual machine to resume the operation of the first virtual machine.
- the processor runs the first virtual machine manager to process the exception occurring in the first virtual machine, including:
- the processor runs the first virtual machine manager to receive a page fault exception handling instruction, an MMIO operation exception handling instruction, or a data termination synchronization exception handling instruction sent by the first virtual machine, wherein the page fault exception handling instruction, the MMIO operation exception handling instruction, or the data termination synchronization exception handling instruction is a secure monitor call (SMC) type instruction, and the MMIO operation exception is an exception caused when the first virtual machine performs an MMIO operation;
- SMC secure monitor call
- the processor runs the first virtual machine manager to handle the page fault exception according to the page fault exception handling instruction
- the processor runs the first virtual machine manager to handle the MMIO operation exception according to the MMIO operation exception handling instruction;
- the processor runs the first virtual machine manager to process the data termination synchronization exception according to the data termination synchronization exception processing instruction.
- the method further includes the following steps: the processor runs the first virtual machine manager under EL3 to perform one or any combination of the following operations: creating, changing or destroying a first-level page table of the first virtual machine, wherein the first-level page table of the first virtual machine refers to a page table that maps the virtual address (virtual addresses, VA) of the first virtual machine to a physical address (physical address, PA) allocated to the first virtual machine in the computing device.
- the processor runs the first virtual machine manager under EL3 to perform one or any combination of the following operations: creating, changing or destroying a first-level page table of the first virtual machine, wherein the first-level page table of the first virtual machine refers to a page table that maps the virtual address (virtual addresses, VA) of the first virtual machine to a physical address (physical address, PA) allocated to the first virtual machine in the computing device.
- VA virtual address
- PA physical address
- the memory of the virtual machine on the TEE side can be managed.
- the method can manage the memory of the virtual machine on the TEE side in the following manner: the processor runs the first virtual machine manager under EL3 to perform one or any combination of the following operations: create, change or destroy the secondary page table of the first virtual machine, wherein the secondary page table of the first virtual machine refers to mapping the VA of the first virtual machine to an intermediate physical address (IPA), and mapping the IPA to a page table of the PA allocated to the first virtual machine in the computing device.
- the processor runs the first virtual machine manager under EL3 to perform one or any combination of the following operations: create, change or destroy the secondary page table of the first virtual machine, wherein the secondary page table of the first virtual machine refers to mapping the VA of the first virtual machine to an intermediate physical address (IPA), and mapping the IPA to a page table of the PA allocated to the first virtual machine in the computing device.
- IPA intermediate physical address
- the REE side includes a second virtual machine manager
- the first virtual machine is deployed with a virtualized input/output (VirtIO) front-end driver
- the second virtual machine manager is deployed with a VirtIO back-end driver
- the first virtual machine manager is deployed with a memory synchronization module
- the TEE side includes a first memory for data transmission between the VirtIO front-end driver and the VirtIO back-end driver
- the REE side includes a second memory
- the memory synchronization module includes a mapping relationship between the first memory and the second memory; the method further includes the following steps:
- the processor runs a memory synchronization module to synchronize first data in the first memory to the second memory according to a mapping relationship between the first memory and the second memory, wherein the first data is data that the VirtIO front-end driver needs to send to the VirtIO back-end driver;
- the processor runs a memory synchronization module to synchronize second data in the second memory to the first memory according to a mapping relationship between the first memory and the second memory, wherein the second data is data from the VirtIO backend driver that the VirtIO frontend driver needs to receive.
- the virtual machine on the TEE side can perform I/O communication through the VirtIO front-end driver and the VirtIO back-end driver.
- a virtual machine implementation apparatus which can be applied to a computing device, wherein hardware resources of the computing device are divided into a REE side and a TEE side, and the computing device includes a first virtual machine manager, and the apparatus includes: a processing module;
- the processing module is used to run a first virtual machine manager under EL3 to start a first virtual machine, and the first virtual machine is deployed on the TEE side.
- the apparatus further includes an acquisition module
- the above-mentioned acquisition module is used to obtain encrypted user data on the REE side; the above-mentioned processing module is also used to run the first virtual machine manager under EL3, obtain the decryption key stored on the TEE side, and use the decryption key to decrypt the encrypted user data to obtain the user data; the above-mentioned processing module is also used to run the first virtual machine to process the above-mentioned user data.
- the acquisition module is also used to obtain a creation instruction on the REE side, where the creation instruction carries configuration information of the first virtual machine to be created; the processing module is also used to run the first virtual machine manager under EL3, and create the first virtual machine on the TEE side according to the configuration information carried by the creation instruction.
- the acquisition module is further used to simulate and obtain the first data on the REE side, where the first data includes one or any combination of the following: a virtual interrupt of the first virtual machine, a virtual clock used by the first virtual machine, and MMIO information used by the first virtual machine; the processing module is further used to write the first data into the first virtual machine manager; the processing module is further used to run the first virtual machine manager under EL3 and inject the first data into the first virtual machine; the processing module is further used to run the first virtual machine according to the first data.
- the processing module is also used to run the first virtual machine manager under EL3, determine whether the first virtual machine is a secure virtual machine, and start the first virtual machine if it is determined that the first virtual machine is a secure virtual machine; and do not start the first virtual machine if it is determined that the first virtual machine is a non-secure virtual machine.
- the processing module is also used to run the first virtual machine manager under EL3 to determine whether the computing device is a secure device. If the computing device is determined to be a secure device, the first virtual machine is started; if the computing device is determined to be a non-secure device, the first virtual machine is not started.
- the acquisition module is also used to acquire a first management command for the life cycle of the first virtual machine on the REE side;
- the processing module is also used to run the first virtual machine manager under EL3, and perform one or any combination of the following operations on the first virtual machine according to the first management command: power on, power off, change specifications, migrate, and release.
- the first acquisition module is further used to acquire, on the REE side, a second management command for the first virtual machine;
- the processing module is also used to run the first virtual machine manager under EL3, and perform one or any combination of the following operations on the first virtual machine according to the second management command: install, start, shut down, upgrade, uninstall and migrate applications.
- the processing module is also used to: when an exception occurs in the first virtual machine, run the first virtual machine manager under EL3 to establish the context of the first virtual machine, handle the exception that occurs in the first virtual machine, and after handling the exception that occurs in the first virtual machine, restore the context of the first virtual machine to the first virtual machine to resume the operation of the first virtual machine.
- the processing module when the exception occurring in the first virtual machine is a page fault exception, an MMIO operation exception, or a data termination synchronization exception, the processing module is used to run the first virtual machine manager under EL3, receive a page fault exception handling instruction, an MMIO operation exception handling instruction, or a data termination synchronization exception handling instruction sent by the first virtual machine, and handle the page fault exception occurring in the first virtual machine according to the page fault exception handling instruction, or, handle the MMIO operation exception occurring in the first virtual machine according to the MMIO operation exception handling instruction, or, handle the data termination synchronization exception occurring in the first virtual machine according to the data termination synchronization exception handling instruction.
- the page fault exception handling instruction, the MMIO operation instruction, or the data termination synchronization exception handling instruction is an SMC type instruction
- the MMIO operation exception is an exception caused when the first virtual machine performs an MMIO operation.
- the processing module is also used to run the first virtual machine manager under EL3, and perform one or any combination of the following operations: create, change or destroy the first-level page table of the first virtual machine, where the first-level page table of the first virtual machine is a page table that maps the VA of the first virtual machine to the PA allocated to the first virtual machine in the computing device.
- the REE side includes a second virtual machine manager, a VirtIO front-end driver is deployed in the first virtual machine manager, a VirtIO back-end driver is deployed in the second virtual machine manager, a memory synchronization module is deployed in the first virtual machine manager, the TEE side includes a first memory for data transmission between the VirtIO front-end driver and the VirtIO back-end driver, the REE side includes a second memory, and the memory synchronization module includes a mapping relationship between the first memory and the second memory; the processing module is used to run the memory synchronization module to synchronize first data in the first memory to the second memory according to the mapping relationship between the first memory and the second memory, and the first data is data that the VirtIO front-end driver needs to send to the VirtIO back-end driver, or the processing module is used to run the memory synchronization module to synchronize second data in the second memory to the first memory according to the mapping relationship between the first memory and the second memory, and the second data is data
- a computing device comprising a processor and a memory; the processor is used to execute instructions stored in the memory, so that the computing device implements the method provided in the first aspect or any possible implementation of the first aspect.
- a computer-readable storage medium stores instructions for implementing the method provided in the first aspect or any possible implementation of the first aspect.
- a computer program product comprising a computer program.
- the computer program When the computer program is read and executed by a computing device, the computing device executes the method provided in the first aspect or any possible implementation of the first aspect.
- FIG1 is a schematic diagram of a virtual machine usage scenario involved in the present application.
- FIG2 is a schematic diagram of the hardware architecture of an ARM processor provided in the present application.
- FIG3 is a schematic diagram of the structure of a computing device provided by the present application.
- FIG4A is a schematic diagram of the structure of a virtual machine implementation method provided by the present application.
- FIG4B is a flow chart of a data processing method provided by the present application.
- FIG5 is a schematic diagram of the structure of a first virtual machine manager provided by the present application.
- FIG6 is a schematic diagram of the creation and operation process of a confidential virtual machine from the perspective of a second virtual machine manager provided by the present application;
- FIG7 is a schematic diagram of the structure of another computing device provided by the present application.
- FIG8 is a schematic diagram of the structure of a virtual machine implementation device exemplarily shown in the present application.
- FIG9 is a schematic diagram of the structure of another computing device provided by the present application.
- a virtual machine is a computer that has complete hardware system functions and runs on a completely isolated computer. A complete computer system in a remote environment. Any work that can be done in a computing device (such as a server) can be done in a virtual machine.
- a computing device such as a server
- Any work that can be done in a computing device can be done in a virtual machine.
- part of the hard disk and memory capacity of the physical machine is used as the hard disk and memory capacity of the virtual machine.
- Each virtual machine has an independent hard disk and operating system, and the user of the virtual machine can operate the virtual machine just like using a computing device.
- Confidential virtual machine refers to the virtual machine included in the TEE side, which can also be called a trusted virtual machine, etc.
- I/O devices refer to hardware that can transmit data to and from computing devices.
- the most common I/O devices include keyboards, mice, block devices (such as disks), and network devices (such as network cards, modems, etc.).
- MMIO Memory-mapped input/output
- PCI peripheral component interconnect
- Virtualized input/output can be understood as a set of programs for virtualizing general I/O devices.
- VirtIO includes a front-end driver program and a back-end driver program.
- the front-end driver program and the back-end driver program can work together to simulate a series of virtualized I/O devices for use by virtual machines, such as VirtIO-BLK and VirtIO-NET.
- VirtIO-BLK is a virtualized storage device.
- VirtIO-BLK is a virtualization program for creating disks (disks are a type of I/O device).
- VirtIO-BLK virtual disks can be created
- VirtIO-NET is a virtualized network device.
- VirtIO-NET is a virtualization program for creating network devices.
- virtualized network devices such as virtualized network interface controllers, or VNICs
- SMC Secure monitor call
- FIG. 1 is a schematic diagram of a virtual machine usage scenario involved in the present application.
- a computing device 100 such as a server
- the hardware layer is a conventional configuration of the computing device 100, wherein PCI devices may be, for example, network cards, graphics processing units (GPUs), embedded neural network processing units (NPUs), offload cards, and other devices that can be inserted into the PCI/peripheral component interconnect express (PCIE) slots of the server.
- the software layer includes a host operating system kernel (also referred to as a host kernel) installed and running on the computing device 100.
- a virtual machine manager (hypervisor) (such as KVM) is provided in the host operating system kernel.
- the role of the virtual machine manager is to realize computing virtualization, network virtualization, and storage virtualization of virtual machines, and is responsible for managing virtual machines.
- Computing virtualization refers to providing part of the processor and memory of the computing device 100 to the virtual machine
- network virtualization refers to providing part of the functions of the network card (such as bandwidth) to the virtual machine
- storage virtualization refers to providing part of the disk to the virtual machine.
- the virtual machine manager can also implement logical isolation between different virtual machines and manage virtual machines, such as creating virtual machines, simulating virtual hardware for virtual machines according to the hardware layer (hardware simulation function), deleting virtual machines, forwarding and/or processing network packets between all virtual machines (such as virtual machine 1 and virtual machine 2) running on the computing device 100 or forwarding network packets between the virtual machines on the computing device 100 and the external network (virtual switching function), processing I/O generated by virtual machines, etc.
- virtual machines such as virtual machine 1 and virtual machine 2
- virtual switching function virtual switching function
- the operating environments (such as virtual machine applications, operating systems, and virtual hardware) in different virtual machines are completely isolated.
- network messages For virtual machine 1 and virtual machine 2 to communicate, network messages must be forwarded through the virtual machine manager.
- Tenants can remotely log in to the virtual machine and operate the virtual machine to install, configure, and uninstall applications in the virtual machine operating system environment.
- the virtual machine is managed by a virtual machine manager in the host operating system kernel, such as KVM.
- the host operating system kernel is compromised by an attacker, the attacker will be able to manipulate the virtual machine manager to manage the virtual machine, posing a security threat to user data in the virtual machine.
- the present application provides a computing device and a virtual machine implementation method.
- TrustZone technology was first introduced in the ARMv6 version as a security extension. It divides the hardware resources of computing devices into two worlds, the REE side (also called the normal world) and the TEE side (also called the secure world). TrustZone, as a hardware security feature, works on the TEE side.
- the REE side does not mean that the operating system (OS) or software running in it is malicious, but that the security of the environment it is in is lower than that of the TEE side. Because when the processor works on the REE side, the resources on the TEE side (such as registers, memory, cache, peripherals, etc.) are prohibited from access. Once the processor tries to access these resources, the system will crash directly.
- TrustZone can set sensitive memory to secure memory by configuring the trustzone address space controller (TZASC) register and the trustzone memory adapter (TZMA) register, so that the REE side cannot access this memory.
- TZASC trustzone address space controller
- TZMA trustzone memory adapter
- Figure 2 describes the hardware architecture of ARM.
- the left side is the architecture of the REE side
- the right side is the architecture of the TEE side.
- the REE side includes four working permissions: exception level 0 (EL0), EL1, EL2, and EL3, and the TEE side includes three working permissions: secure exception level 0 (SEL0), SEL1, and EL3.
- EL0 can also be called the user state layer
- EL1 can also be called the kernel state layer
- EL2 can also be called the virtual machine manager layer
- EL3 can also be called the secure monitor layer.
- the higher the level of the level the higher the level of the level, and the smaller the level of the level, the lower the level of the level.
- the exception level can be understood as the privilege level.
- ARM trusted firmware is the first component that runs when the processor starts. It is the underlying firmware officially provided by ARM. This firmware unifies the ARM underlying interface standards, such as the power status control interface (PSCI), trusted board boot requirements (TBBR), and SMC operations for switching between secure world state and normal world state.
- PSCI power status control interface
- TBBR trusted board boot requirements
- the processor has the highest privilege level and can access not only all resources on the TEE side, but also all resources on the REE side.
- the above is an introduction to the TrustZone technology.
- the computing device provided by this application will be introduced.
- the computing device provided by this application is mainly a computing device running the ARM processor shown in Figure 2 above.
- FIG 3 is a schematic diagram of a computing device 300 provided in the present application.
- the hardware resources of the computing device 300 are divided into a REE side and a TEE side.
- the TEE side includes one or more confidential virtual machines.
- the TEE side includes a confidential virtual machine as an example.
- the REE side may include one or more ordinary virtual machines.
- the REE side includes two ordinary virtual machines as an example.
- the computing device 300 also includes a virtual machine manager for managing the confidential virtual machine on the TEE side.
- the virtual machine manager for managing the confidential virtual machine on the TEE side is referred to as the first virtual machine manager
- the virtual machine manager deployed in the host kernel for managing the ordinary virtual machine on the REE side is referred to as the second virtual machine manager.
- the virtual machine manager on the TEE side may also be referred to as a trustzone management monitor (TMM) or a trustzone virtual machine manager, etc. This application does not specifically limit the name of the virtual machine manager on the TEE side.
- TMM trustzone management monitor
- This application does not specifically limit the name of the virtual machine manager on the TEE side.
- the first virtual machine manager is used to deploy the confidential virtual machine on the TEE side of the computing device 300, and to start the confidential virtual machine. It can be understood that after starting the confidential virtual machine, the processor can run the confidential virtual machine to process user data.
- the first virtual machine manager can also manage the life cycle of the confidential virtual machine, such as powering on, powering off, changing specifications, migrating, and releasing.
- the first virtual machine manager can also manage the apps installed on the confidential virtual machine, such as installing, starting, shutting down, upgrading, uninstalling, and migrating the apps.
- the first virtual machine manager can also perform other management operations on the confidential virtual machine, which will be described in detail below.
- the confidential virtual machine is similar to an ordinary virtual machine, including an operating system kernel and an APP.
- the operating system kernel in the confidential virtual machine can be a rich operating system (rich OS) kernel such as Linux, or it can be other types of operating system kernels. That is to say, the operating system in the confidential virtual machine can be a rich operating system such as Linux, or it can be other types of operating systems. This application does not limit this. It can be understood that when the operating system in the confidential virtual machine is a Linux operating system, the confidential virtual machine can be migrated from an ordinary Linux virtual machine.
- the operating system in the confidential virtual machine is a rich operating system such as a Linux operating system
- the rich operating system has relatively powerful functions
- the tenant installs an APP (such as an artificial intelligence (AI) application with high requirements for the operating environment) in the confidential virtual machine, it can be installed directly without modifying the APP, and zero-modification installation of the APP can be achieved.
- AI artificial intelligence
- the processor of the computing device 300 runs the first virtual machine manager under EL3. It can be understood that since the processor runs the first virtual machine manager under EL3, the first virtual machine manager has the corresponding permissions of EL3, and can access resources on the TEE side as well as resources on the REE side. In a possible embodiment, the first virtual machine manager is deployed in the ARM trusted firmware.
- the REE side may further include a shadow of the confidential virtual machine.
- the shadow of the confidential virtual machine may be used by the processor to save the context of the confidential virtual machine when the processor stops running the confidential virtual machine and runs other programs instead.
- the processor restores the context of the confidential virtual machine saved in the shadow of the confidential virtual machine to the confidential virtual machine, thereby resuming the operation of the confidential virtual machine.
- computing device 300 is only an example provided in the embodiment of the present application, and the computing device 300 may have more or fewer components than those shown in FIG. 3 , or may have different configurations of the components.
- the following describes the process of implementing a virtual machine by the computing device 300 shown in FIG. 3 in conjunction with the flowchart of a virtual machine implementation method provided by the present application shown in FIG. 4A .
- S401 The processor runs the first virtual machine manager under EL3 to create a first confidential virtual machine on the TEE side.
- the processor of the computing device 300 can obtain the configuration information of the first confidential virtual machine to be created on the REE side, and then run the first virtual machine manager under EL3, and create the first confidential virtual machine on the TEE side according to the configuration information of the first confidential virtual machine.
- the configuration information includes the specifications of the first confidential virtual machine to be created, such as the size of the memory, the type of the memory, the size of the memory, the type of the memory, the type of the processor core, the number of processor cores, the computing speed of the processor core, the number of cores of the processor core, the network bandwidth, the operating system kernel and the file system, etc.
- the processor can provide the first confidential virtual machine with virtual hardware resources matching the configuration information based on the configuration information, for example, based on the memory information included in the configuration information, divide the memory matching the memory information and used by the first confidential virtual machine from the memory resources on the TEE side, simulate the virtual processor core matching the processor core information and used by the first confidential virtual machine based on the processor core information included in the configuration information, and load the operating system kernel and the file system included in the configuration information into the memory corresponding to the first confidential virtual machine, etc., so as to achieve the creation of the first confidential virtual machine.
- the method for the processor to obtain the configuration information of the first confidential virtual machine on the REE side may refer to any one of the following methods 1 or 2:
- the configuration information may be input by the user on the interface of the computing device 300.
- the user may input the required processor core type, number of processor cores, computing power requirements of the processor cores, type of memory, number of memory, size of memory, type of memory, network bandwidth requirements, etc. according to his/her needs.
- the first confidential virtual machine may be understood as being customized.
- the computing device 300 stores the configuration information in the memory on the REE side.
- the subsequent processor runs the first virtual machine manager under EL3 to obtain the configuration information from the memory on the REE side.
- the configuration information can be selected by the user from a variety of possible configuration information provided by the interface of the computing device 300. That is to say, the user can only select from a variety of configuration information, and cannot decide the type of processor core, the number of processor cores, the computing power requirements of the processor cores, the type of memory, the number of memories, the size of memory, the type of memory, the requirements of network bandwidth, etc. according to their own needs.
- the first confidential virtual machine can be understood as provided according to specifications, and the user can only select the specifications that suit him from the limited specifications.
- the computing device 300 After obtaining the configuration information selected by the user, stores the configuration information in the memory on the REE side, and the subsequent processor runs the first virtual machine manager under EL3 to obtain the configuration information from the memory on the REE side.
- the above-mentioned method 1 and method 2 are merely examples of the method in which the processor obtains the configuration information of the first confidential virtual machine on the REE side.
- the processor can obtain part of the configuration information of the first confidential virtual machine through the above-mentioned method 1, and obtain another part of the configuration information of the first confidential virtual machine through the above-mentioned method 2. This application does not specifically limit this.
- S402 The processor runs the first virtual machine manager under EL3 to start the first confidential virtual machine.
- the processor can run the first confidential virtual machine to process user data.
- the following describes a process in which a processor runs a first confidential virtual machine to process user data in conjunction with a flowchart of a data processing method exemplarily illustrated in the present application as shown in FIG. 4B .
- the method comprises the following steps:
- S410 The processor obtains user data on the REE side.
- User data may be a face image to be recognized, a voice signal to be recognized, text data to be recognized, etc. It may also be a model to be trained and training data, or data to be encrypted and stored. This application does not specifically limit user data.
- S420 The processor runs the first confidential virtual machine on the TEE side to process the user data.
- the user data may be input to the computing device 300 by the user through an interface provided by the computing device 300, and the computing device 300 After obtaining the user data input by the user, the user data is stored in the memory on the REE side, and the subsequent processor runs the first confidential virtual machine to read and process the user data from the memory on the REE side.
- the processor runs the first confidential virtual machine on the TEE side to recognize the face image/voice signal/text data to obtain the corresponding recognition result, and then provides the recognition result to the user on the REE side.
- the processor runs the first confidential virtual machine on the TEE side to train the model using the training data to obtain a trained model, and then provides the trained model to the user on the REE side.
- the first confidential virtual machine on the TEE side communicates with the external network of the computing device 300 through the REE side. It can be understood that this can improve the security of the first confidential virtual machine.
- the processor runs the first confidential virtual machine on the TEE side to encrypt the data and then stores it in the corresponding location.
- the user data obtained by the processor on the REE side is encrypted data.
- the processor Before the processor executes S420, the processor will run the first virtual machine manager under EL3 to obtain the decryption key stored on the TEE side for decrypting the encrypted data, and then use the decryption key to decrypt the encrypted data to obtain the plain text of the user data. After that, the processor runs the first confidential virtual machine to process the user data.
- the user data exists in an encrypted state on the REE side, and the decryption key is stored on the TEE side.
- the host operating system kernel and software (such as KVM, ordinary virtual machines, etc.) on the REE side cannot obtain the decryption key stored on the TEE side.
- the computing device 300 may also manage the first confidential virtual machine, and the management content is as follows:
- the processor of the computing device 300 can obtain the first management command for the life cycle of the first confidential virtual machine on the REE side, and then run the first virtual machine manager under EL3 to perform one or any combination of the following operations on the first confidential virtual machine according to the first management command: power on, power off, change specifications, migrate, and release (destruction).
- the processor may first determine whether the first confidential virtual machine is in a non-operating state. When it is determined that the first confidential virtual machine is in a non-operating state, the processor releases the first confidential virtual machine. If it is determined that the first confidential virtual machine is in an operating state, the processor waits for the first confidential virtual machine to finish operating before releasing the first confidential virtual machine.
- the specific process of the processor releasing the first confidential virtual machine may include erasing the context information of the first confidential virtual machine, erasing the content related to the first confidential virtual machine in the memory of the computing device 300, and releasing the resources occupied by the first confidential virtual machine, such as memory.
- the processor of the computing device 300 can obtain the second management command for the first confidential virtual machine on the REE side, and then run the first virtual machine manager under EL3 to perform one or any combination of the following operations on the first confidential virtual machine according to the second management command: install, start, shut down, upgrade, uninstall and migrate APP.
- the processor of the computing device 300 can run the first virtual machine manager under EL3 to create, change or destroy the first-level page table or the second-level page table of the first confidential virtual machine to manage the memory of the first confidential virtual machine.
- the first-level page table of the first confidential virtual machine refers to a page table that maps the virtual address (VA) of the first confidential virtual machine to a physical address (PA)
- the second-level page table of the first confidential virtual machine refers to a page table that maps the VA of the first confidential virtual machine to an intermediate physical address (IPA), and maps the IPA to a PA allocated to the first confidential virtual machine in the computing device.
- the processor of the computing device 300 can run the first virtual machine manager under EL3 to establish the context of the first confidential virtual machine, then handle the exception of the first virtual machine, and after handling the exception, restore the established context of the first confidential virtual machine to the first confidential virtual machine to resume the operation of the first confidential virtual machine.
- the exception of the first confidential virtual machine can be a page fault exception, an MMIO operation exception, wait for interrupt (WFI), wait for event (WFE), execute a hypervisor call (HVC) instruction, execute an SMC instruction, read and write a system register, an instruction abort, a data abort (such as a data abort sync exception), an interrupt request (IRQ) and a fast interrupt request (FIQ), a power management instruction exit of the power management interface (PSCI) and a system error exit, etc.
- MMIO operation refers to the operation of the first confidential virtual machine accessing the I/O device through the MMIO technology
- the MMIO operation exception refers to the exception caused when the first confidential virtual machine performs the MMIO operation.
- the process in which the processor runs the first virtual machine manager at EL3 to handle the exception occurring in the first confidential virtual machine may specifically be: the processor runs the first virtual machine manager at EL3, receives a page fault exception handling instruction, an MMIO operation exception handling instruction, or a data termination synchronization exception handling instruction sent by the first confidential virtual machine, and then the processor runs the first virtual machine manager at EL3 to handle the page fault exception occurring in the first confidential virtual machine according to the page fault exception handling instruction, or the processor runs the first virtual machine manager at EL3 to handle the MMIO operation exception occurring in the first confidential virtual machine according to the MMIO operation exception handling instruction, or the processor runs the first virtual machine manager at EL3 to handle the data termination synchronization exception occurring in the first confidential virtual machine according to the data termination synchronization exception handling instruction.
- the processor can provide the configuration information of the first confidential virtual machine (such as the type of virtual processor cores, the number of virtual processor cores, memory addresses, etc.), the version information of the operating system installed on the first confidential virtual machine, and the APP name, etc. to the user on the REE side for security check by running the first virtual machine manager under EL3, that is, the user determines whether the first confidential virtual machine is a secure virtual machine that meets the user's expectations, or an unsecure virtual machine that poses a security threat.
- the configuration information of the first confidential virtual machine such as the type of virtual processor cores, the number of virtual processor cores, memory addresses, etc.
- the version information of the operating system installed on the first confidential virtual machine such as the type of virtual processor cores, the number of virtual processor cores, memory addresses, etc.
- the version information of the operating system installed on the first confidential virtual machine such as the type of virtual processor cores, the number of virtual processor cores, memory addresses, etc.
- the version information of the operating system installed on the first confidential virtual machine such as the
- the processor runs the first virtual machine manager under EL3 and obtains feedback from the user that the first confidential virtual machine is a secure virtual machine that meets the user's expectations, the processor determines that the first confidential virtual machine is a secure virtual machine and starts the first confidential virtual machine. Otherwise, the processor determines that the first confidential virtual machine is an unsecure virtual machine and does not start the first confidential virtual machine.
- the processor can also check the security of the first confidential virtual machine in other ways, which is not specifically limited in this application.
- the processor can provide the certificate of the computing device 300 to the user on the REE side for legitimacy check by running the first virtual machine manager under EL3, that is, the user determines whether the computing device 300 is a secure device that meets his expectations or a non-secure device with security threats.
- the processor runs the first virtual machine manager under EL3 and obtains feedback from the user that the computing device is a secure device that meets his expectations, the processor determines that the computing device is a secure device and starts the first virtual machine. Otherwise, the processor determines that the computing device is a non-secure device and does not start the first virtual machine.
- the processor can also check the security of the computing device 300 in other ways, which is not specifically limited in this application.
- the processor can re-determine the security of the changed first confidential virtual machine, and start and run the changed first confidential virtual machine if it is determined that the changed first confidential virtual machine is safe, otherwise refuse to start the changed first confidential virtual machine.
- the processor can remind the user on the REE side that the certificate of the computing device 300 has expired or provide the user with the security risk of the computing device 300, allowing the user to determine whether to continue using the computing device 300 to run the first confidential virtual machine.
- running the first confidential virtual machine after checking the security of the first confidential virtual machine and the security of the computing device 300, and continuing to monitor the security of the first confidential virtual machine and the computing device 300 during the operation of the first confidential virtual machine can improve the security of the first confidential virtual machine, thereby improving the security of user data stored or used in the first confidential virtual machine.
- the processor of the computing device 300 Before the processor of the computing device 300 runs the first confidential virtual machine on the TEE side, it can also obtain one or any combination of the following on the REE side or the TEE side: a virtual interrupt of the first confidential virtual machine, a virtual clock used by the first confidential virtual machine, and memory-mapped input/output (MMIO) information used by the first confidential virtual machine, etc., and then inject this information into the first confidential virtual machine, and then run the first virtual machine according to this information.
- the virtual clock can be used for the first confidential virtual machine to measure the time interval, and the purpose of the first confidential virtual machine measuring the time interval can be to perform task scheduling, and the MMIO information can be used by the first confidential virtual machine to access the I/O device like accessing the memory.
- the trusted computing base (TCB) on the TEE side can be made thinner.
- the first virtual machine manager includes a virtual interrupt register 10, a virtual clock register 20 and an MMIO register 30, wherein the virtual interrupt register 10 is used to store the virtual interrupt of the first confidential virtual machine simulated by the processor, the virtual clock register 20 is used to store the virtual clock for use by the first confidential virtual machine simulated by the processor, and the MMIO register 30 is used to store the MMIO information for use by the first confidential virtual machine simulated by the processor.
- the process of the processor injecting the virtual interrupt, virtual clock and MMIO information into the first confidential virtual machine can be: the processor runs the corresponding register in the first virtual machine manager under EL3 to trigger the The processor generates an interrupt signal and sends the interrupt signal to the first confidential virtual machine.
- the first confidential virtual machine After receiving the interrupt signal, the first confidential virtual machine reads the interrupt information to be processed from the corresponding register in the first virtual machine manager based on the interrupt signal. It can be understood that since the processor runs the first virtual machine manager under EL3, when the first virtual machine manager reads the interrupt information to be processed from the corresponding register in the first virtual machine manager based on the interrupt signal, the instruction executed is an SMC type instruction.
- the first virtual machine manager further includes a virtual machine management module 40, a memory management module 50, an exception handling module 60, and a remote attestation module 70.
- the virtual machine management module 40 is used to perform the operations of creating and starting the first confidential virtual machine on the TEE side as described in S401 and S402 above, the operations of managing the life cycle of the first confidential virtual machine as described in 1 above, and the operations of managing the APP on the first confidential virtual machine as described in 2 above;
- the memory management module 50 is used to perform the operations of managing the memory of the first confidential virtual machine as described in 3 above;
- the exception handling module 60 is used to perform the operations of handling the exceptions of the first confidential virtual machine as described in 4 above, and optionally, the exception handling module 60 can also be used to perform the operations of managing the context of the first confidential virtual machine as described in 4 above;
- the remote attestation module 70 is used to perform the operations of checking the security of the first confidential virtual machine as described in 5 above and checking the security of the computing device 300, which can
- the names of the various modules in the first virtual machine manager shown in Figure 5 are merely examples.
- the virtual machine management module 40 can also be called a first confidential virtual machine management module
- the remote attestation module 70 can also be called a security check module, etc., and should not be regarded as specific limitations on the names of the various modules in the first virtual machine manager.
- the operations performed by the processor of the computing device 300 on the REE side may be implemented by the processor running a second virtual machine manager on the REE side.
- the processor of the computing device 300 can also perform other operations, such as creating, modifying and destroying the secondary page table on the REE side, such as simulating virtualized I/O devices such as virtual disks, VNICs, etc. for use by the first confidential virtual machine.
- This application does not specifically limit the operations that the processor of the computing device 300 can perform.
- the process includes the following steps:
- the second virtual machine manager obtains a creation instruction, where the creation instruction carries configuration information of a first confidential virtual machine to be created, where the configuration information includes memory information allocated to the first confidential virtual machine, virtual processor core information used by the first confidential virtual machine, an operating system kernel, and a file system.
- the configuration information may also include other contents, which are not specifically limited in this application.
- the second virtual machine manager calls the memory partitioning interface provided by the first virtual machine manager, and passes the memory information carried by the creation instruction to the first virtual machine manager, so that the first virtual machine manager divides the memory for use by the first confidential virtual machine in the memory resources on the TEE side based on the memory information.
- the second virtual machine manager calls the virtual processor core creation interface provided by the first virtual machine manager, and passes the virtual processor core information carried by the creation instruction to the first virtual machine manager, so that the first virtual machine manager simulates a virtual machine processor core for use by the first confidential virtual machine based on the virtual processor core information.
- the second virtual machine manager calls the communication interface provided by the first virtual machine manager to pass the operating system kernel and the file system for use by the first confidential virtual machine to the first virtual machine manager, so that the first virtual machine manager stores the operating system kernel and the file system for use by the first confidential virtual machine in the above-mentioned memory for use by the first confidential virtual machine.
- the second virtual machine manager calls the virtual machine running interface provided by the first virtual machine manager, and passes the virtual interrupt, virtual clock and MMIO information of the first confidential virtual machine to the first virtual machine manager, so that the first virtual machine manager injects the virtual interrupt, virtual clock and MMIO information into the first confidential virtual machine, and starts running the first confidential virtual machine.
- the second virtual machine manager receives the exception handling instruction from the first confidential virtual machine forwarded by the first virtual machine manager.
- S607 The second virtual machine manager handles the exception occurring in the first confidential virtual machine according to the exception handling instruction.
- the processor of the computing device 300 when the processor of the computing device 300 needs to simulate a virtualized I/O device for use by the first confidential virtual machine, it can be achieved through VirtIO technology.
- the operating system kernel of the first confidential virtual machine on the TEE side includes a VirtIO front-end driver
- the second virtual machine manager such as KVM includes a VirtIO back-end driver.
- the first virtual machine manager may also include a memory synchronization module.
- the memory resources on the REE side include a first memory (VRING) (not shown in FIG. 7 ) used for data transmission between the VirtIO front-end driver and the VirtIO back-end driver
- the memory resources on the REE side include a second memory (not shown in FIG. 7 ) that has a mapping relationship with the first memory.
- the second memory can be regarded as a shadow memory of the first memory, and the second memory is usually the same size as the first memory.
- the processor of the computing device 300 can run the VirtIO backend driver to create a virtualized I/O device, and then after starting the first confidential virtual machine, run the VirtIO front-end driver in the first confidential virtual machine to load the virtualized I/O device, thereby realizing the simulation of the virtualized I/O device. In this way, the computing device 300 can realize the I/O communication of the first confidential virtual machine through the VirtIO technology.
- the memory synchronization module is used to synchronize the data (hereinafter referred to as the first data) that the VirtIO front-end driver needs to send to the VirtIO back-end driver in the first memory to the second memory during the I/O communication operation of the first confidential virtual machine implemented by the computing device 300 through the VirtIO technology, and to synchronize the data (hereinafter referred to as the second data) that the VirtIO back-end driver needs to send to the VirtIO front-end driver in the second memory to the first memory.
- the first data can also be understood as the data that the first confidential virtual machine needs to transmit to the external network of the computing device 300
- the second data can also be understood as the data that the first confidential virtual machine needs to receive from the external network of the computing device 300.
- the virtual machine can be isolated from the host operating system kernel (located on the REE side) through the first virtual machine manager.
- the virtual machine is protected by the first virtual machine manager under EL3 and can avoid being accessed by the host operating system kernel on the REE side.
- the attacker cannot control the virtual machine through the virtual machine manager in the host operating system kernel, such as KVM, thereby protecting the security of the virtual machine in the computing device, and then protecting the security of user data in the virtual machine.
- the virtual machine manager such as KVM
- each module within the virtual machine implementation device may also be divided into multiple types, and each module may be a software module, a hardware module, or partly a software module and partly a hardware module, and this application does not limit it.
- each of the multiple unit modules may be deployed on the same computing device.
- FIG8 is a schematic diagram of the structure of a virtual machine implementation device 800 exemplarily shown in the present application, which can be applied to the computing device 300 whose hardware resources are divided into the REE side and the TEE side as shown in FIG3 .
- the virtual machine implementation device 800 includes: a processing module 810.
- the functions of each module of the virtual machine implementation device 800 are exemplarily introduced below. It should be understood that the functions of each module described below are only the functions that the virtual machine implementation device 800 can have in some embodiments of the present application, and the present application does not limit the functions of each module.
- the processing module 810 is used to run a first virtual machine manager under EL3 to start a first virtual machine, where the first virtual machine is deployed on the TEE side.
- the first virtual machine can be understood as the first confidential virtual machine mentioned above.
- the apparatus 800 further includes an acquisition module 820;
- the acquisition module 820 is used to acquire encrypted user data on the REE side;
- the processing module 810 is further used to run the first virtual machine manager under EL3, obtain the decryption key stored on the TEE side, and use the decryption key to decrypt the encrypted user data to obtain the user data plaintext;
- the processing module 810 is further configured to run the first virtual machine to process the above-mentioned user data plaintext.
- the acquisition module 820 is also used to acquire a creation instruction on the REE side, where the creation instruction carries configuration information of the first virtual machine to be created; the processing module 810 is also used to run the first virtual machine manager under EL3, and create the first virtual machine on the TEE side according to the configuration information carried by the creation instruction.
- the acquisition module 820 is further used to simulate and obtain the first data on the REE side, where the first data includes one or any combination of the following: a virtual interrupt of the first virtual machine, a virtual clock used by the first virtual machine, and MMIO information used by the first virtual machine; the processing module 810 is further used to write the first data into the first virtual machine manager; the processing module 810 is further used to run the first virtual machine manager under EL3 and inject the first data into the first virtual machine; the processing module 810 is further used to run the first virtual machine according to the first data.
- the first data includes one or any combination of the following: a virtual interrupt of the first virtual machine, a virtual clock used by the first virtual machine, and MMIO information used by the first virtual machine
- the processing module 810 is further used to write the first data into the first virtual machine manager
- the processing module 810 is further used to run the first virtual machine manager under EL3 and inject the first data into the first virtual machine
- the processing module 810 is further used to run the first virtual machine according to the
- the processing module 810 is also used to run the first virtual machine manager under EL3 to determine whether the first virtual machine is a secure virtual machine. If the first virtual machine is determined to be a secure virtual machine, the first virtual machine is started; if the first virtual machine is determined to be a non-secure virtual machine, the first virtual machine is not started.
- the processing module 810 is further configured to run the first virtual machine manager under EL3 to determine the computing device The computing device is determined to be a security device. If the computing device is determined to be a security device, the first virtual machine is started; if the computing device is determined to be a non-security device, the first virtual machine is not started.
- the acquisition module 820 is also used to acquire a first management command for the life cycle of the first virtual machine on the REE side; the processing module 810 is also used to run the first virtual machine manager under EL3, and perform one or any combination of the following operations on the first virtual machine according to the first management command: power on, power off, change specifications, migrate, and release.
- the first acquisition module 820 is further used to acquire a second management command for the first virtual machine on the REE side; the processing module 810 is further used to run the first virtual machine manager under EL3, and perform one or any combination of the following operations on the first virtual machine according to the second management command: install, start, shut down, upgrade, uninstall and migrate applications.
- the processing module 810 is also used to: when an exception occurs in the first virtual machine, run the first virtual machine manager under EL3 to establish the context of the first virtual machine, handle the exception that occurs in the first virtual machine, and after handling the exception that occurs in the first virtual machine, restore the context of the first virtual machine to the first virtual machine to resume the operation of the first virtual machine.
- the processing module 810 when the exception of the first virtual machine is a page fault exception, an MMIO operation exception, or a data termination synchronization exception, the processing module 810 is used to run the first virtual machine manager under EL3, receive a page fault exception processing instruction, an MMIO operation exception processing instruction, or a data termination synchronization exception processing instruction sent by the first virtual machine, and process the page fault exception of the first virtual machine according to the page fault exception processing instruction, or process the MMIO operation exception of the first virtual machine according to the MMIO operation exception processing instruction, or process the data termination synchronization exception of the first virtual machine according to the data termination synchronization exception processing instruction.
- the page fault exception processing instruction, the MMIO operation instruction, or the data termination synchronization exception processing instruction is an SMC type instruction
- the MMIO operation exception is an exception caused when the first virtual machine performs an MMIO operation.
- the processing module 810 is also used to run the first virtual machine manager under EL3, and perform one or any combination of the following operations: create, change or destroy the first-level page table of the first virtual machine, where the first-level page table of the first virtual machine is a page table that maps the VA of the first virtual machine to the PA allocated to the first virtual machine in the computing device.
- the REE side includes a second virtual machine manager, a VirtIO front-end driver is deployed in the first virtual machine manager, a VirtIO back-end driver is deployed in the second virtual machine manager, a memory synchronization module is deployed in the first virtual machine manager, the TEE side includes a first memory for data transmission between the VirtIO front-end driver and the VirtIO back-end driver, the REE side includes a second memory, and the memory synchronization module includes a mapping relationship between the first memory and the second memory; the processing module 810 is used to run the memory synchronization module to synchronize first data in the first memory to the second memory according to the mapping relationship between the first memory and the second memory, and the first data is data that the VirtIO front-end driver needs to send to the VirtIO back-end driver, or the processing module 810 is used to run the memory synchronization module to synchronize second data in the second memory to the first memory according to the mapping relationship between the first memory and the second memory, and the
- the specific implementation of various operations performed by the virtual machine implementation device 800 can refer to the description in the relevant content of the above-mentioned virtual machine implementation method embodiment, and for the sake of brevity of the specification, it will not be repeated here.
- FIG. 9 is a schematic diagram of the structure of another computing device 300 provided by the present application, wherein the computing device 300 includes: a processor 310, a memory unit 320, a communication interface 330, a memory 340, an input device 350, and an output device 360, wherein the processor 310, the memory unit 320, the communication interface 330, the memory 340, the input device 350, and the output device 360 can be interconnected via a bus 370.
- the processor 310 can read the program code (including instructions) stored in the memory unit 320 and execute the program code stored in the memory unit 320, so that the computing device 300 executes the steps in the virtual machine implementation method provided in the above method embodiment.
- the processor 310 may have a variety of specific implementation forms.
- the processor 310 may be at least one central processing unit (CPU), as shown in FIG9 , including CPU0 and CPU1.
- the processor 310 may also be a graphics processing unit (GPU), etc.
- the processor 310 may also be a single-core processor or a multi-core processor.
- the processor 310 may be a combination of a CPU and a hardware chip.
- the above-mentioned hardware chip may be implemented by an application-specific integrated circuit (ASIC) or a programmable logic device (PLD).
- the above-mentioned PLD may be a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL) or any combination thereof.
- the processor 310 may also be implemented by a logic device with built-in processing logic, such as an FPGA or a digital signal processor (DSP).
- DSP digital signal processor
- the memory unit 320 is used to store the kernel, program code, and program data generated when the processor 310 executes the program code stored in the memory unit 320.
- the program code includes: the code of the acquisition module 820 and the code of the processing module 810, etc.
- the program data includes: user data, configuration information of the first confidential virtual machine, and processing results obtained by the first confidential virtual machine processing the user data, etc.
- the communication interface 330 may be a wired interface (e.g., an Ethernet interface, a fiber optic interface, other types of interfaces (e.g., an infinite bandwidth technology (infiniBand, IB) interface)) or a wireless interface (e.g., a cellular network interface or a wireless local area network interface) for communicating with other computing devices.
- a wired interface e.g., an Ethernet interface, a fiber optic interface, other types of interfaces (e.g., an infinite bandwidth technology (infiniBand, IB) interface)
- a wireless interface e.g., a cellular network interface or a wireless local area network interface
- TCP/IP transmission control protocol/internet protocol
- the communication interface 330 may adopt a protocol family above the transmission control protocol/internet protocol (TCP/IP), such as the remote function call (RFC) protocol, the simple object access protocol (SOAP) protocol, the simple network management protocol (SNMP) protocol, the common object request broker architecture (CORBA) protocol, and distributed protocols
- the memory 340 may be a non-volatile memory, such as a read-only memory (ROM), a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), or a flash memory.
- ROM read-only memory
- PROM programmable ROM
- EPROM erasable PROM
- EEPROM electrically erasable PROM
- flash memory any type of volatile memory
- RAM random access memory
- the input device 350 may include a mouse and a keyboard, etc.
- the user may input data or instructions to the computing device 300 through the input device 350, such as the above-mentioned data to be processed, configuration information of the confidential virtual machine, the first management instruction, the second management instruction, etc.
- the output device 360 may include a display, and the computing device 300 may provide data to the user through the display, such as providing the user with the result of the confidential virtual machine processing the data to be processed, etc.
- the display may include a cathode ray tube display (CRT), a plasma display panel (PDP), a liquid crystal display (LCD), etc.
- the liquid crystal display includes a liquid crystal panel and a backlight module, wherein the liquid crystal display panel includes a polarizing film, a glass substrate, a black matrix, a color filter, a protective film, a common electrode, a calibration layer, a liquid crystal layer (liquid crystal, a spacer, a sealant), a capacitor, a display electrode, a prism layer, and a light diffusion layer.
- the backlight module includes: an illumination light source, a reflector, a light guide plate, a diffuser, a brightness enhancement film (prism sheet) and a frame, etc.
- the bus 370 may be a PCIE or an extended industry standard architecture (EISA) bus, etc.
- the bus 370 may be divided into an address bus, a data bus, a control bus, etc.
- FIG9 only uses one thick line, but does not mean that there is only one bus or one type of bus.
- the computing device 300 of the embodiment of the present application may correspond to the computing device including the virtual machine implementation device 800 in the embodiment of the present application, and may correspond to the execution of the corresponding subjects in the method shown in Figures 4A, 4B, and 6 in the embodiment of the present application, and the operations and/or functions of each module in the computing device 300 are respectively for implementing the corresponding processes of the method shown in Figures 4A, 4B, and 6, which will not be repeated here for the sake of brevity.
- computing device 300 is only an example provided in an embodiment of the present application, and computing device 300 may have more or fewer components than those shown in FIG. 9 , may combine two or more components, or may have different configurations of components.
- the present application also provides a computer-readable storage medium, in which instructions are stored. When the instructions are executed, some or all of the steps of the virtual machine implementation method recorded in the above embodiment can be implemented.
- the present application also provides a computer program product.
- the computer program product When the computer program product is read and executed by a computer, it can implement some or all of the steps of the virtual machine implementation method recorded in the above method embodiment.
- the computer program product includes one or more computer instructions.
- the computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device.
- the computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center.
- the computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integration.
- the available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium, or a semiconductor medium, etc.
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Computer Security & Cryptography (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computer Hardware Design (AREA)
- General Health & Medical Sciences (AREA)
- Health & Medical Sciences (AREA)
- Bioethics (AREA)
- Stored Programmes (AREA)
- Memory System Of A Hierarchy Structure (AREA)
Abstract
Description
本申请要求于2023年07月31日提交中国国家知识产权局、申请号为202310963299.X的中国专利申请的优先权,发明名称为“虚拟机实现方法、装置及计算机可读存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application filed with the State Intellectual Property Office of China on July 31, 2023, with application number 202310963299.X, and the priority of the Chinese patent application with the invention name “Virtual Machine Implementation Method, Device and Computer-readable Storage Medium”, all contents of which are incorporated by reference in this application.
本申请涉及虚拟化技术领域,尤其涉及一种虚拟机实现方法、装置及计算机可读存储介质。The present application relates to the field of virtualization technology, and in particular to a virtual machine implementation method, device and computer-readable storage medium.
虚拟机(virtual machine,VM)指通过软件模拟的具有完整硬件系统功能的、运行在一个完全隔离环境中的完整计算机系统。在计算设备(如服务器)中能够完成的工作在虚拟机中都能够实现。在计算设备中创建虚拟机时,需要将实体机的部分硬盘和内存容量作为虚拟机的硬盘和内存容量,每个虚拟机都有独立的硬盘和操作系统,虚拟机的用户可以像使用计算设备一样对虚拟机进行操作。A virtual machine (VM) is a complete computer system that is simulated by software and has complete hardware system functions and runs in a completely isolated environment. Any work that can be done in a computing device (such as a server) can be done in a virtual machine. When creating a virtual machine in a computing device, part of the hard disk and memory capacity of the physical machine needs to be used as the hard disk and memory capacity of the virtual machine. Each virtual machine has an independent hard disk and operating system, and the user of the virtual machine can operate the virtual machine just like using a computing device.
目前,计算设备中的虚拟机由主机操作系统内核中的虚拟机管理器(hypervisor)如系统虚拟化模块(kernel-based virtual machine,KVM)管理,一旦主机操作系统内核被攻击者攻破,那么攻击者将能操控运行在主机操作系统内核中的虚拟机,对虚拟机中的用户数据造成安全威胁。Currently, virtual machines in computing devices are managed by a hypervisor in the host operating system kernel, such as the kernel-based virtual machine (KVM). Once the host operating system kernel is compromised by an attacker, the attacker will be able to control the virtual machines running in the host operating system kernel, posing a security threat to user data in the virtual machines.
发明内容Summary of the invention
本申请提供一种虚拟机实现方法、装置及计算机可读存储介质,能够大大降低计算设备中的虚拟机被攻击的风险,提升虚拟机中的用户数据的安全性。The present application provides a virtual machine implementation method, device and computer-readable storage medium, which can greatly reduce the risk of virtual machines in computing devices being attacked and improve the security of user data in the virtual machines.
第一方面,提供一种虚拟机实现方法,应用于计算设备,该计算设备的硬件资源被划分为富执行环境(rich execution environment,REE)侧和可信执行环境(trusted execution environment,TEE)侧,该计算设备包括第一虚拟机管理器,该方法具体包括如下步骤:计算设备的处理器在异常等级(exception level 3,EL3)下运行上述第一虚拟机管理器启动第一虚拟机,第一虚拟机部署于TEE侧。In a first aspect, a virtual machine implementation method is provided, which is applied to a computing device, wherein hardware resources of the computing device are divided into a rich execution environment (REE) side and a trusted execution environment (TEE) side, and the computing device includes a first virtual machine manager. The method specifically includes the following steps: a processor of the computing device runs the above-mentioned first virtual machine manager at an exception level (EL3) to start a first virtual machine, and the first virtual machine is deployed on the TEE side.
可以理解,上述方案中,处理器启动第一虚拟机之后,便可以运行第一虚拟机处理用户数据。由于处理器是在EL3下运行第一虚拟机管理器启动第一虚拟机,第一虚拟机部署于TEE侧,因此该虚拟机可以通过第一虚拟机管理器与主机操作系统内核(位于REE侧)隔离,也就是说,该虚拟机受EL3下的第一虚拟机管理器保护,能够避免被REE侧的主机操作系统内核访问,故攻击者即便攻破了主机操作系统内核,攻击者也不能通过主机操作系统内核中的虚拟机管理器如KVM操控该虚拟机,从而起到保护计算设备中虚拟机的安全的作用,进而起到保护虚拟机中的用户数据的安全性的作用。It can be understood that in the above scheme, after the processor starts the first virtual machine, it can run the first virtual machine to process user data. Since the processor runs the first virtual machine manager under EL3 to start the first virtual machine, and the first virtual machine is deployed on the TEE side, the virtual machine can be isolated from the host operating system kernel (located on the REE side) through the first virtual machine manager. In other words, the virtual machine is protected by the first virtual machine manager under EL3 and can avoid being accessed by the host operating system kernel on the REE side. Therefore, even if the attacker breaks into the host operating system kernel, the attacker cannot control the virtual machine through the virtual machine manager in the host operating system kernel, such as KVM, thereby protecting the security of the virtual machine in the computing device, and then protecting the security of the user data in the virtual machine.
在一种可能的实现方式中,上述处理器在启动第一虚拟机之后,上述方法还包括如下步骤:In a possible implementation, after the processor starts the first virtual machine, the method further includes the following steps:
处理器在REE侧获取加密的用户数据;The processor obtains the encrypted user data on the REE side;
处理器在EL3下运行第一虚拟机管理器获取TEE侧存储的解密密钥,并使用解密密钥对加密的用户数据进行解密,得到用户数据;The processor runs the first virtual machine manager under EL3 to obtain the decryption key stored on the TEE side, and uses the decryption key to decrypt the encrypted user data to obtain the user data;
处理器运行第一虚拟机处理用户数据。The processor runs the first virtual machine to process user data.
实施该实现方式,由于用户数据在REE侧为加密状态,而解密密钥存储于TEE侧,处理器只能通过在EL3下运行第一虚拟机管理器获取解密密钥,REE侧的软件(如主机操作系统内核、主机操作系统内核中的虚拟机管理器)均无法获取TEE侧存储的解密密钥,因此即便攻击者攻破了REE侧的软件,窃取到加密数据,也无法解密得到用户数据的明文,如此可以满足用户数据不被REE侧的软件窃取的需求,进一步提升用户数据安全。In this implementation, since the user data is encrypted on the REE side and the decryption key is stored on the TEE side, the processor can only obtain the decryption key by running the first virtual machine manager under EL3. The software on the REE side (such as the host operating system kernel and the virtual machine manager in the host operating system kernel) cannot obtain the decryption key stored on the TEE side. Therefore, even if the attacker breaks through the software on the REE side and steals the encrypted data, it is impossible to decrypt the plaintext of the user data. This can meet the demand that user data is not stolen by the software on the REE side, further improving the security of user data.
在一种可能的实现方式中,在启动第一虚拟机之前,上述方法还包括如下步骤:上述处理器在REE侧获取携带待创建的第一虚拟机的配置信息的创建指令,然后,处理器在EL3下运行第一虚拟机管理器,根据上述创建指令携带的配置信息在TEE侧创建第一虚拟机。In one possible implementation, before starting the first virtual machine, the method further includes the following steps: the processor obtains a creation instruction carrying configuration information of the first virtual machine to be created on the REE side, and then the processor runs the first virtual machine manager under EL3 to create the first virtual machine on the TEE side according to the configuration information carried by the creation instruction.
实施该实现方式,可以实现在TEE侧创建虚拟机,便于后续实现使用该虚拟机对用户数据进行安全处理。 By implementing this implementation method, a virtual machine can be created on the TEE side, which facilitates the subsequent use of the virtual machine to securely process user data.
在一种可能的实现方式中,上述方法还包括如下步骤:上述处理器在REE侧模拟得到第一数据,之后将第一数据写入第一虚拟机管理器,并在EL3下运行第一虚拟机管理器将第一数据注入第一虚拟机,最后根据第一数据运行第一虚拟机。其中,第一数据包括如下一种或任意组合:第一虚拟机的虚拟中断、供第一虚拟机使用的虚拟时钟以及供第一虚拟机使用的内存映射输入输出(memory-mapped input/output,MMIO)信息。In a possible implementation, the method further includes the following steps: the processor simulates and obtains the first data on the REE side, then writes the first data into the first virtual machine manager, runs the first virtual machine manager under EL3 to inject the first data into the first virtual machine, and finally runs the first virtual machine according to the first data. The first data includes one or any combination of the following: a virtual interrupt of the first virtual machine, a virtual clock used by the first virtual machine, and memory-mapped input/output (MMIO) information used by the first virtual machine.
实施该实现方式,可以实现在REE侧模拟得到第一虚拟机运行需要的虚拟中断、虚拟时钟以及MMIO信息,便于后续实现使用该虚拟机对用户数据进行安全处理。By implementing this implementation, it is possible to simulate on the REE side the virtual interrupt, virtual clock, and MMIO information required for the operation of the first virtual machine, thereby facilitating the subsequent secure processing of user data using the virtual machine.
此外,在该实现方式中,处理器在REE侧模拟得到第一虚拟机的虚拟中断、供第一虚拟机使用的虚拟时钟以及供第一虚拟机使用的MMIO信息,而不是使用第一虚拟机管理器进行模拟,可以使得第一虚拟机管理器的可信计算基(trusted computing base,TCB)比较轻薄。In addition, in this implementation, the processor simulates the virtual interrupt of the first virtual machine, the virtual clock used by the first virtual machine, and the MMIO information used by the first virtual machine on the REE side, instead of using the first virtual machine manager for simulation, which can make the trusted computing base (TCB) of the first virtual machine manager relatively thin.
在一种可能的实现方式中,上述处理器是在EL3下运行第一虚拟机管理器确定第一虚拟机为安全虚拟机的情况下,启动第一虚拟机。In a possible implementation, the processor starts the first virtual machine when the first virtual machine manager running under EL3 determines that the first virtual machine is a secure virtual machine.
具体地,处理器可以在EL3下运行第一虚拟机管理器将第一虚拟机的配置信息(如虚拟处理器核类型、虚拟处理器核数量、内存地址等)、第一虚拟机上安装的应用(application,APP)名称和第一虚拟机的镜像的哈希值等,在REE侧提供给用户进行安全性度量,即由用户确定第一虚拟机是满足自身预期的安全虚拟机,还是存在安全性威胁的非安全虚拟机。在处理器在EL3下运行第一虚拟机管理器获取到用户确定第一虚拟机是满足自身预期的安全虚拟机的反馈的情况下,处理器确定第一虚拟机是安全虚拟机,启动第一虚拟机,否则,处理器确定第一虚拟机是非安全虚拟机,不启动第一虚拟机。Specifically, the processor can run the first virtual machine manager under EL3 to provide the configuration information of the first virtual machine (such as the type of virtual processor cores, the number of virtual processor cores, memory addresses, etc.), the name of the application (APP) installed on the first virtual machine, and the hash value of the image of the first virtual machine, etc., to the user on the REE side for security measurement, that is, the user determines whether the first virtual machine is a secure virtual machine that meets its own expectations, or a non-secure virtual machine with security threats. In the case where the processor runs the first virtual machine manager under EL3 and obtains feedback from the user that the first virtual machine is a secure virtual machine that meets its own expectations, the processor determines that the first virtual machine is a secure virtual machine and starts the first virtual machine. Otherwise, the processor determines that the first virtual machine is a non-secure virtual machine and does not start the first virtual machine.
实施该实现方式,处理器在确定虚拟机安全的情况下,才启动虚拟机,可以避免使用不安全的虚拟机处理用户数据,不仅可以提升虚拟机的安全性,还可以提升虚拟机中用户数据的安全性。By implementing this implementation method, the processor starts the virtual machine only when it determines that the virtual machine is safe, which can avoid using an unsafe virtual machine to process user data, thereby improving not only the security of the virtual machine but also the security of user data in the virtual machine.
在一种可能的实现方式中,上述处理器是在EL3下运行第一虚拟机管理器确定上述计算设备为安全设备的情况下,启动第一虚拟机。In a possible implementation, the processor starts the first virtual machine when the first virtual machine manager running under EL3 determines that the computing device is a secure device.
具体地,处理器可以在EL3下运行第一虚拟机管理器将计算设备的证书,在REE侧提供给用户进行合法性检查,即由用户确定计算设备是满足自身预期的安全设备,还是存在安全性威胁的非安全设备。在处理器在EL3下运行第一虚拟机管理器获取到用户确定计算设备是满足自身预期的安全设备的反馈的情况下,处理器确定计算设备是安全设备,启动第一虚拟机,否则,处理器确定计算设备是非安全设备,不启动第一虚拟机。Specifically, the processor can run the first virtual machine manager under EL3 to provide the certificate of the computing device to the user on the REE side for legitimacy check, that is, the user determines whether the computing device is a secure device that meets his expectations or a non-secure device that poses a security threat. In the case where the processor runs the first virtual machine manager under EL3 and obtains feedback from the user that the computing device is a secure device that meets his expectations, the processor determines that the computing device is a secure device and starts the first virtual machine; otherwise, the processor determines that the computing device is a non-secure device and does not start the first virtual machine.
实施该实现方式,处理器在确定计算设备安全的情况下,才启动虚拟机,可以避免使用不安全的计算设备运行虚拟机处理用户数据,不仅可以提升虚拟机的安全性,还可以提升虚拟机中用户数据的安全性。By implementing this implementation method, the processor starts the virtual machine only when it determines that the computing device is safe, which can avoid using an unsafe computing device to run the virtual machine to process user data, thereby improving not only the security of the virtual machine, but also the security of user data in the virtual machine.
在一种可能的实现方式中,上述方法还包括如下步骤:上述处理器在REE侧获取针对上述第一虚拟机的生命周期的第一管理命令,然后在EL3下运行上述第一虚拟机管理器,根据第一管理命令对第一虚拟机执行以下操作的一种或任意组合:开机、关机、更改规格、迁移和释放。In a possible implementation, the method further includes the following steps: the processor obtains a first management command for the life cycle of the first virtual machine on the REE side, and then runs the first virtual machine manager under EL3, and performs one or any combination of the following operations on the first virtual machine according to the first management command: power on, power off, change specifications, migrate, and release.
实施该实现方式,可以实现对TEE侧的虚拟机的生命周期进行管理。By implementing this implementation method, the life cycle of the virtual machine on the TEE side can be managed.
在一种可能的实现方式中,上述方法还包括如下步骤:上述处理器在REE侧获取针对上述第一虚拟机的第二管理命令,然后在EL3下运行上述第一虚拟机管理器,根据第二管理命令对第一虚拟机执行以下操作的一种或任意组合:安装应用程序、启动应用程序、关闭应用程序、升级应用程序、卸载应用程序和迁移应用程序。In a possible implementation, the method further includes the following steps: the processor obtains a second management command for the first virtual machine on the REE side, and then runs the first virtual machine manager under EL3, and performs one or any combination of the following operations on the first virtual machine according to the second management command: installing an application, starting an application, shutting down an application, upgrading an application, uninstalling an application, and migrating an application.
实施该实现方式,可以实现对TEE侧的虚拟机上的应用程序进行管理。By implementing this implementation method, it is possible to manage applications on the virtual machine on the TEE side.
在一种可能的实现方式中,上述方法还包括如下步骤:上述处理器在上述第一虚拟机出现异常时,在EL3下运行第一虚拟机管理器建立第一虚拟机的上下文,并处理第一虚拟机出现的异常,在处理完第一虚拟机出现的异常时,将上述第一虚拟机的上下文恢复至第一虚拟机,以恢复运行第一虚拟机。In a possible implementation, the method further includes the following steps: when an exception occurs in the first virtual machine, the processor runs the first virtual machine manager under EL3 to establish the context of the first virtual machine, and handles the exception that occurs in the first virtual machine. After handling the exception that occurs in the first virtual machine, the context of the first virtual machine is restored to the first virtual machine to resume the operation of the first virtual machine.
实施该实现方式,可以实现对TEE侧的虚拟机出现的异常进行处理。By implementing this implementation method, it is possible to handle exceptions that occur in the virtual machine on the TEE side.
在一种可能的实现方式中,在上述第一虚拟机出现的异常为缺页异常、MMIO操作异常或者数据终止同步异常时,上述处理器运行第一虚拟机管理器处理第一虚拟机出现的异常,包括:In a possible implementation, when the exception occurring in the first virtual machine is a page fault exception, an MMIO operation exception, or a data termination synchronization exception, the processor runs the first virtual machine manager to process the exception occurring in the first virtual machine, including:
处理器运行第一虚拟机管理器接收第一虚拟机发送的缺页异常处理指令、MMIO操作异常处理指令或者数据终止同步异常处理指令,其中,缺页异常处理指令、MMIO操作异常处理指令或者数据终止同步异常处理指令为安全监控调用(secure monitor call,SMC)类型的指令,MMIO操作异常为第一虚拟机进行MMIO操作时引起的异常;The processor runs the first virtual machine manager to receive a page fault exception handling instruction, an MMIO operation exception handling instruction, or a data termination synchronization exception handling instruction sent by the first virtual machine, wherein the page fault exception handling instruction, the MMIO operation exception handling instruction, or the data termination synchronization exception handling instruction is a secure monitor call (SMC) type instruction, and the MMIO operation exception is an exception caused when the first virtual machine performs an MMIO operation;
处理器运行第一虚拟机管理器根据缺页异常处理指令,处理缺页异常; The processor runs the first virtual machine manager to handle the page fault exception according to the page fault exception handling instruction;
或者,处理器运行第一虚拟机管理器根据MMIO操作异常处理指令,处理MMIO操作异常;Alternatively, the processor runs the first virtual machine manager to handle the MMIO operation exception according to the MMIO operation exception handling instruction;
或者,处理器运行第一虚拟机管理器根据数据终止同步异常处理指令,处理数据终止同步异常。Alternatively, the processor runs the first virtual machine manager to process the data termination synchronization exception according to the data termination synchronization exception processing instruction.
在一种可能的实现方式中,上述方法还包括如下步骤:上述处理器在EL3下运行上述第一虚拟机管理器执行以下操作中的一种或任意组合:创建、更改或者销毁第一虚拟机的一级页表,其中,第一虚拟机的一级页表是指将第一虚拟机的虚拟地址(virtual adress,VA)映射为计算设备中为第一虚拟机分配的物理地址(physical address,PA)的页表。In a possible implementation, the method further includes the following steps: the processor runs the first virtual machine manager under EL3 to perform one or any combination of the following operations: creating, changing or destroying a first-level page table of the first virtual machine, wherein the first-level page table of the first virtual machine refers to a page table that maps the virtual address (virtual adress, VA) of the first virtual machine to a physical address (physical address, PA) allocated to the first virtual machine in the computing device.
实施该实现方式,可以实现对TEE侧的虚拟机的内存进行管理。By implementing this implementation method, the memory of the virtual machine on the TEE side can be managed.
为了提高方案的灵活性,在一种可能的实现方式中,上述方法可以通过如下方式实现对TEE侧的虚拟机的内存进行管理:上述处理器在EL3下运行上述第一虚拟机管理器执行以下操作中的一种或任意组合:创建、更改或者销毁第一虚拟机的二级页表,其中,第一虚拟机的二级页表是指将第一虚拟机的VA映射为中间物理地址(intermediate physical address,IPA),以及将IPA映射为计算设备中为第一虚拟机分配的PA的页表。In order to improve the flexibility of the solution, in a possible implementation, the method can manage the memory of the virtual machine on the TEE side in the following manner: the processor runs the first virtual machine manager under EL3 to perform one or any combination of the following operations: create, change or destroy the secondary page table of the first virtual machine, wherein the secondary page table of the first virtual machine refers to mapping the VA of the first virtual machine to an intermediate physical address (IPA), and mapping the IPA to a page table of the PA allocated to the first virtual machine in the computing device.
在一种可能的实现方式中,上述REE侧包括第二虚拟机管理器,上述第一虚拟机部署有虚拟化输入输出(virtualised input/output,VirtIO)前端驱动程序,第二虚拟机管理器部署有VirtIO后端驱动程序,第一虚拟机管理器部署有内存同步模块,TEE侧包括用于VirtIO前端驱动程序与VirtIO后端驱动程序进行数据传输的第一内存,REE侧包括第二内存,内存同步模块包括第一内存和第二内存的映射关系;上述方法还包括如下步骤:In a possible implementation, the REE side includes a second virtual machine manager, the first virtual machine is deployed with a virtualized input/output (VirtIO) front-end driver, the second virtual machine manager is deployed with a VirtIO back-end driver, the first virtual machine manager is deployed with a memory synchronization module, the TEE side includes a first memory for data transmission between the VirtIO front-end driver and the VirtIO back-end driver, the REE side includes a second memory, and the memory synchronization module includes a mapping relationship between the first memory and the second memory; the method further includes the following steps:
上述处理器运行内存同步模块根据第一内存和第二内存的映射关系,将第一内存中的第一数据同步至第二内存,第一数据为VirtIO前端驱动程序需发送给VirtIO后端驱动程序的数据;The processor runs a memory synchronization module to synchronize first data in the first memory to the second memory according to a mapping relationship between the first memory and the second memory, wherein the first data is data that the VirtIO front-end driver needs to send to the VirtIO back-end driver;
或者,or,
上述处理器运行内存同步模块根据第一内存和第二内存的映射关系,将第二内存中的第二数据同步至第一内存,第二数据为VirtIO前端驱动程序需接收的来自VirtIO后端驱动程序的数据。The processor runs a memory synchronization module to synchronize second data in the second memory to the first memory according to a mapping relationship between the first memory and the second memory, wherein the second data is data from the VirtIO backend driver that the VirtIO frontend driver needs to receive.
实施该实现方式,可以实现TEE侧的虚拟机通过VirtIO前端驱动程序和VirtIO后端驱动程序进行I/O通信。By implementing this implementation method, the virtual machine on the TEE side can perform I/O communication through the VirtIO front-end driver and the VirtIO back-end driver.
第二方面,提供一种虚拟机实现装置,该装置可以应用于计算设备,该计算设备的硬件资源被划分为REE侧和TEE侧,该计算设备包括第一虚拟机管理器,该装置包括:处理模块;In a second aspect, a virtual machine implementation apparatus is provided, which can be applied to a computing device, wherein hardware resources of the computing device are divided into a REE side and a TEE side, and the computing device includes a first virtual machine manager, and the apparatus includes: a processing module;
上述处理模块用于在EL3下运行第一虚拟机管理器启动第一虚拟机,该第一虚拟机部署于上述TEE侧。The processing module is used to run a first virtual machine manager under EL3 to start a first virtual machine, and the first virtual machine is deployed on the TEE side.
在一种可能的实现方式中,上述装置还包括获取模块;In a possible implementation, the apparatus further includes an acquisition module;
上述获取模块用于在REE侧获取加密的用户数据;上述处理模块还用于在EL3下运行第一虚拟机管理器,获取TEE侧存储的解密密钥,并使用解密密钥对加密的用户数据进行解密,得到用户数据;上述处理模块还用于运行第一虚拟机处理上述用户数据。The above-mentioned acquisition module is used to obtain encrypted user data on the REE side; the above-mentioned processing module is also used to run the first virtual machine manager under EL3, obtain the decryption key stored on the TEE side, and use the decryption key to decrypt the encrypted user data to obtain the user data; the above-mentioned processing module is also used to run the first virtual machine to process the above-mentioned user data.
在一种可能的实现方式中,上述获取模块还用于在REE侧获取创建指令,创建指令携带待创建的第一虚拟机的配置信息;上述处理模块还用于在EL3下运行第一虚拟机管理器,根据创建指令携带的配置信息在TEE侧创建第一虚拟机。In a possible implementation, the acquisition module is also used to obtain a creation instruction on the REE side, where the creation instruction carries configuration information of the first virtual machine to be created; the processing module is also used to run the first virtual machine manager under EL3, and create the first virtual machine on the TEE side according to the configuration information carried by the creation instruction.
在一种可能的实现方式中,上述获取模块还用于在REE侧模拟得到第一数据,第一数据包括如下一种或任意组合:第一虚拟机的虚拟中断、供第一虚拟机使用的虚拟时钟以及供第一虚拟机使用的MMIO信息;上述处理模块还用于将第一数据写入第一虚拟机管理器;上述处理模块还用于在EL3下运行第一虚拟机管理器,将第一数据注入第一虚拟机;上述处理模块还用于根据第一数据运行第一虚拟机。In a possible implementation, the acquisition module is further used to simulate and obtain the first data on the REE side, where the first data includes one or any combination of the following: a virtual interrupt of the first virtual machine, a virtual clock used by the first virtual machine, and MMIO information used by the first virtual machine; the processing module is further used to write the first data into the first virtual machine manager; the processing module is further used to run the first virtual machine manager under EL3 and inject the first data into the first virtual machine; the processing module is further used to run the first virtual machine according to the first data.
在一种可能的实现方式中,上述处理模块还用于在EL3下运行第一虚拟机管理器,确定第一虚拟机是否为安全虚拟机,在确定第一虚拟机是安全虚拟机的情况下,启动第一虚拟机,在确定第一虚拟机是非安全虚拟机的情况下,不启动第一虚拟机。In a possible implementation, the processing module is also used to run the first virtual machine manager under EL3, determine whether the first virtual machine is a secure virtual machine, and start the first virtual machine if it is determined that the first virtual machine is a secure virtual machine; and do not start the first virtual machine if it is determined that the first virtual machine is a non-secure virtual machine.
在一种可能的实现方式中,上述处理模块还用于在EL3下运行第一虚拟机管理器,确定上述计算设备是否为安全设备,在确定计算设备是安全设备的情况下,启动第一虚拟机,在确定计算设备是非安全设备的情况下,不启动第一虚拟机。In one possible implementation, the processing module is also used to run the first virtual machine manager under EL3 to determine whether the computing device is a secure device. If the computing device is determined to be a secure device, the first virtual machine is started; if the computing device is determined to be a non-secure device, the first virtual machine is not started.
在一种可能的实现方式中,上述获取模块还用于在REE侧获取针对第一虚拟机的生命周期的第一管理命令;上述处理模块还用于在EL3下运行第一虚拟机管理器,根据第一管理命令对第一虚拟机执行以下操作的一种或任意组合:开机、关机、更改规格、迁移和释放。In a possible implementation, the acquisition module is also used to acquire a first management command for the life cycle of the first virtual machine on the REE side; the processing module is also used to run the first virtual machine manager under EL3, and perform one or any combination of the following operations on the first virtual machine according to the first management command: power on, power off, change specifications, migrate, and release.
在一种可能的实现方式中,上述第一获取模块还用于在REE侧获取针对第一虚拟机的第二管理命令; 上述处理模块还用于在EL3下运行第一虚拟机管理器,根据第二管理命令对第一虚拟机执行以下操作的一种或任意组合:安装、启动、关闭、升级、卸载和迁移应用程序。In a possible implementation, the first acquisition module is further used to acquire, on the REE side, a second management command for the first virtual machine; The processing module is also used to run the first virtual machine manager under EL3, and perform one or any combination of the following operations on the first virtual machine according to the second management command: install, start, shut down, upgrade, uninstall and migrate applications.
在一种可能的实现方式中,上述处理模块还用于:在第一虚拟机出现异常时,在EL3下运行第一虚拟机管理器建立第一虚拟机的上下文,处理第一虚拟机出现的异常,在处理完第一虚拟机出现的异常时,将第一虚拟机的上下文恢复至第一虚拟机,以恢复运行第一虚拟机。In a possible implementation, the processing module is also used to: when an exception occurs in the first virtual machine, run the first virtual machine manager under EL3 to establish the context of the first virtual machine, handle the exception that occurs in the first virtual machine, and after handling the exception that occurs in the first virtual machine, restore the context of the first virtual machine to the first virtual machine to resume the operation of the first virtual machine.
在一种可能的实现方式中,在第一虚拟机出现的异常为缺页异常、MMIO操作异常或者数据终止同步异常时,上述处理模块用于在EL3下运行第一虚拟机管理器,接收第一虚拟机发送的缺页异常处理指令、MMIO操作异常处理指令或者数据终止同步异常处理指令,并根据缺页异常处理指令处理第一虚拟机出现的缺页异常,或者,根据MMIO操作异常处理指令,处理第一虚拟机出现的MMIO操作异常,或者,根据数据终止同步异常处理指令,处理第一虚拟机出现的数据终止同步异常。其中,缺页异常处理指令、MMIO操作指令或者数据终止同步异常处理指令为SMC类型的指令,MMIO操作异常为第一虚拟机进行MMIO操作时引起的异常。In a possible implementation, when the exception occurring in the first virtual machine is a page fault exception, an MMIO operation exception, or a data termination synchronization exception, the processing module is used to run the first virtual machine manager under EL3, receive a page fault exception handling instruction, an MMIO operation exception handling instruction, or a data termination synchronization exception handling instruction sent by the first virtual machine, and handle the page fault exception occurring in the first virtual machine according to the page fault exception handling instruction, or, handle the MMIO operation exception occurring in the first virtual machine according to the MMIO operation exception handling instruction, or, handle the data termination synchronization exception occurring in the first virtual machine according to the data termination synchronization exception handling instruction. Wherein, the page fault exception handling instruction, the MMIO operation instruction, or the data termination synchronization exception handling instruction is an SMC type instruction, and the MMIO operation exception is an exception caused when the first virtual machine performs an MMIO operation.
在一种可能的实现方式中,上述处理模块还用于在EL3下运行第一虚拟机管理器,执行以下操作中的一种或任意组合:创建、更改或者销毁第一虚拟机的一级页表,第一虚拟机的一级页表为将第一虚拟机的VA映射为计算设备中为第一虚拟机分配的PA的页表。In one possible implementation, the processing module is also used to run the first virtual machine manager under EL3, and perform one or any combination of the following operations: create, change or destroy the first-level page table of the first virtual machine, where the first-level page table of the first virtual machine is a page table that maps the VA of the first virtual machine to the PA allocated to the first virtual machine in the computing device.
在一种可能的实现方式中,上述REE侧包括第二虚拟机管理器,上述第一虚拟机管理器中部署有VirtIO前端驱动程序,第二虚拟机管理器部署有VirtIO后端驱动程序,第一虚拟机管理器部署有内存同步模块,TEE侧包括用于VirtIO前端驱动程序与VirtIO后端驱动程序进行数据传输的第一内存,REE侧包括第二内存,内存同步模块包括第一内存和第二内存的映射关系;上述处理模块用于运行内存同步模块根据第一内存和第二内存的映射关系,将第一内存中的第一数据同步至第二内存,第一数据为VirtIO前端驱动程序需发送给VirtIO后端驱动程序的数据,或者,处理模块用于运行内存同步模块根据第一内存和第二内存的映射关系,将第二内存中的第二数据同步至第一内存,第二数据为VirtIO前端驱动程序需接收的来自VirtIO后端驱动程序的数据。In a possible implementation, the REE side includes a second virtual machine manager, a VirtIO front-end driver is deployed in the first virtual machine manager, a VirtIO back-end driver is deployed in the second virtual machine manager, a memory synchronization module is deployed in the first virtual machine manager, the TEE side includes a first memory for data transmission between the VirtIO front-end driver and the VirtIO back-end driver, the REE side includes a second memory, and the memory synchronization module includes a mapping relationship between the first memory and the second memory; the processing module is used to run the memory synchronization module to synchronize first data in the first memory to the second memory according to the mapping relationship between the first memory and the second memory, and the first data is data that the VirtIO front-end driver needs to send to the VirtIO back-end driver, or the processing module is used to run the memory synchronization module to synchronize second data in the second memory to the first memory according to the mapping relationship between the first memory and the second memory, and the second data is data from the VirtIO back-end driver that the VirtIO front-end driver needs to receive.
关于第二方面提供的虚拟机实现装置以及第二方面的任一种实现方式的相关有益效果和描述可以参见前述第一方面以及第一方面的任一种实现方式的相关有益效果和描述,在此不再赘述。For the relevant beneficial effects and descriptions of the virtual machine implementation device provided in the second aspect and any implementation method of the second aspect, reference can be made to the relevant beneficial effects and descriptions of the aforementioned first aspect and any implementation method of the first aspect, and no further details will be given here.
第三方面,提供一种计算设备,所述计算设备包括处理器和存储器;所述处理器用于执行所述存储器存储的指令,使得所述计算设备实现如上述第一方面或者第一方面的任意可能的实现方式提供的方法。According to a third aspect, a computing device is provided, comprising a processor and a memory; the processor is used to execute instructions stored in the memory, so that the computing device implements the method provided in the first aspect or any possible implementation of the first aspect.
第四方面,提供一种计算机可读存储介质,所述计算机可读存储介质存储有指令,所述指令用于实现如上述第一方面或者第一方面的任意可能的实现方式提供的方法。According to a fourth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores instructions for implementing the method provided in the first aspect or any possible implementation of the first aspect.
第五方面,提供一种计算机程序产品,包括计算机程序,当所述计算机程序被计算设备读取并执行时,使得所述计算设备执行如上述第一方面或者第一方面的任意可能的实现方式提供的方法。According to a fifth aspect, a computer program product is provided, comprising a computer program. When the computer program is read and executed by a computing device, the computing device executes the method provided in the first aspect or any possible implementation of the first aspect.
图1为本申请涉及的一种虚拟机使用场景的示意图;FIG1 is a schematic diagram of a virtual machine usage scenario involved in the present application;
图2为本申请提供的一种ARM处理器的硬件架构示意图;FIG2 is a schematic diagram of the hardware architecture of an ARM processor provided in the present application;
图3为本申请提供的一种计算设备的结构示意图;FIG3 is a schematic diagram of the structure of a computing device provided by the present application;
图4A为本申请提供的一种虚拟机实现方法的结构示意图;FIG4A is a schematic diagram of the structure of a virtual machine implementation method provided by the present application;
图4B为本申请提供的一种数据处理方法的流程示意图;FIG4B is a flow chart of a data processing method provided by the present application;
图5为本申请提供的一种第一虚拟机管理器的结构示意图;FIG5 is a schematic diagram of the structure of a first virtual machine manager provided by the present application;
图6为本申请提供的第二虚拟机管理器视角下的机密虚拟机的创建和运行过程示意图;FIG6 is a schematic diagram of the creation and operation process of a confidential virtual machine from the perspective of a second virtual machine manager provided by the present application;
图7为本申请提供的另一种计算设备的结构示意图;FIG7 is a schematic diagram of the structure of another computing device provided by the present application;
图8为本申请示例性示出的一种虚拟机实现装置的结构示意图;FIG8 is a schematic diagram of the structure of a virtual machine implementation device exemplarily shown in the present application;
图9为本申请提供的又一种计算设备的结构示意图。FIG9 is a schematic diagram of the structure of another computing device provided by the present application.
下面将结合附图,对本申请提供的技术方案进行描述。The technical solution provided by this application will be described below in conjunction with the accompanying drawings.
为了使本申请提供的技术方案更清晰,首先进行相关术语的解释。In order to make the technical solution provided by this application clearer, the relevant terms are first explained.
(1)虚拟机(virtual machine,VM)指通过软件模拟的具有完整硬件系统功能的、运行在一个完全隔 离环境中的完整计算机系统。在计算设备(如服务器)中能够完成的工作在虚拟机中都能够实现。在计算设备中创建虚拟机时,需要将实体机的部分硬盘和内存容量作为虚拟机的硬盘和内存容量,每个虚拟机都有独立的硬盘和操作系统,虚拟机的用户可以像使用计算设备一样对虚拟机进行操作。(1) A virtual machine (VM) is a computer that has complete hardware system functions and runs on a completely isolated computer. A complete computer system in a remote environment. Any work that can be done in a computing device (such as a server) can be done in a virtual machine. When creating a virtual machine in a computing device, part of the hard disk and memory capacity of the physical machine is used as the hard disk and memory capacity of the virtual machine. Each virtual machine has an independent hard disk and operating system, and the user of the virtual machine can operate the virtual machine just like using a computing device.
(2)普通虚拟机,指REE侧包括的虚拟机。(2) Ordinary virtual machines refer to the virtual machines included in the REE side.
(3)机密虚拟机,指TEE侧包括的虚拟机,也可以称为可信虚拟机等。(3) Confidential virtual machine refers to the virtual machine included in the TEE side, which can also be called a trusted virtual machine, etc.
(4)输入输出(input/output,I/O)设备,指可以与计算设备进行数据传输的硬件,最常见的I/O设备如键盘、鼠标、块设备(如磁盘)、网络设备(如网卡、调制解调器等)。(4) Input/output (I/O) devices refer to hardware that can transmit data to and from computing devices. The most common I/O devices include keyboards, mice, block devices (such as disks), and network devices (such as network cards, modems, etc.).
(5)内存映射输入输出(memory-mapped input/output,MMIO):是外设部件互连标准(peripheral component interconnect,PCI)规范的一部分,I/O设备被放置在内存空间而不是I/O空间。从处理器的角度看,内存映射I/O后处理器访问I/O设备像访问内存一样。(5) Memory-mapped input/output (MMIO): It is part of the peripheral component interconnect (PCI) specification. I/O devices are placed in memory space instead of I/O space. From the processor's perspective, memory-mapped I/O allows the processor to access I/O devices like accessing memory.
(6)虚拟化输入输出(virtualised input/output,VirtIO),可以理解为是一套通用I/O设备虚拟化的程序,具体的,VirtIO包括前端驱动(front-end driver)程序和后端驱动(back-end driver)程序,前端驱动程序与后端驱动程序配合可以模拟出一系列的供虚拟机使用的虚拟化I/O设备,例如VirtIO-BLK、VirtIO-NET等,其中,VirtIO-BLK是一种虚拟化存储设备,实际上,VirtIO-BLK是创建磁盘(磁盘是一种I/O设备)的虚拟化程序,通过VirtIO-BLK可以创建虚拟磁盘;VirtIO-NET是一种虚拟化网络设备,同理,VirtIO-NET是创建网络设备的虚拟化程序,通过VirtIO-NET可以创建虚拟化网络设备(例如虚拟网卡(virtualised network interface controller,即VNIC)。(6) Virtualized input/output (VirtIO) can be understood as a set of programs for virtualizing general I/O devices. Specifically, VirtIO includes a front-end driver program and a back-end driver program. The front-end driver program and the back-end driver program can work together to simulate a series of virtualized I/O devices for use by virtual machines, such as VirtIO-BLK and VirtIO-NET. Among them, VirtIO-BLK is a virtualized storage device. In fact, VirtIO-BLK is a virtualization program for creating disks (disks are a type of I/O device). Through VirtIO-BLK, virtual disks can be created; VirtIO-NET is a virtualized network device. Similarly, VirtIO-NET is a virtualization program for creating network devices. Through VirtIO-NET, virtualized network devices (such as virtualized network interface controllers, or VNICs) can be created.
(7)安全监控调用(secure monitor call,SMC),是实现非安全世界(normal world)与安全世界(secure world)之间通信的机制,为高级精简指令集设备(advanced RISC machines,ARM)平台上的TEE提供了一个安全、高效的通信方式。(7) Secure monitor call (SMC) is a mechanism for achieving communication between the normal world and the secure world, providing a secure and efficient communication method for TEE on the advanced RISC machines (ARM) platform.
接下来介绍本申请涉及的应用场景。Next, the application scenarios involved in this application are introduced.
本申请涉及租户使用虚拟机处理业务场景,请参见图1,图1为本申请涉及的一种虚拟机使用场景的示意图,如图1所示,计算设备100(如服务器)包括硬件层和软件层,硬件层为计算设备100的常规配置,其中PCI设备可例如为网卡、图形处理器(graphics processing unit,GPU)、嵌入式神经网络处理器(neural network processing unit,NPU)、卸载卡等可插置到服务器的PCI/高速串行计算机扩展总线标准(peripheral component interconnect express,PCIE)插槽上的设备,软件层包括安装并运行在计算设备100上的主机操作系统内核(也可简称为主机内核),主机操作系统内核中设置有虚拟机管理器(hypervisor)(例如KVM),虚拟机管理器的作用是实现虚拟机的计算虚拟化、网络虚拟化以及存储虚拟化,并负责管理虚拟机。The present application involves a scenario in which a tenant uses a virtual machine to process a business. Please refer to Figure 1. Figure 1 is a schematic diagram of a virtual machine usage scenario involved in the present application. As shown in Figure 1, a computing device 100 (such as a server) includes a hardware layer and a software layer. The hardware layer is a conventional configuration of the computing device 100, wherein PCI devices may be, for example, network cards, graphics processing units (GPUs), embedded neural network processing units (NPUs), offload cards, and other devices that can be inserted into the PCI/peripheral component interconnect express (PCIE) slots of the server. The software layer includes a host operating system kernel (also referred to as a host kernel) installed and running on the computing device 100. A virtual machine manager (hypervisor) (such as KVM) is provided in the host operating system kernel. The role of the virtual machine manager is to realize computing virtualization, network virtualization, and storage virtualization of virtual machines, and is responsible for managing virtual machines.
计算虚拟化是指将计算设备100的处理器和内存的部分提供给虚拟机,网络虚拟化是指将网卡的部分功能(如带宽)提供给虚拟机,存储虚拟化是指将部分磁盘提供给虚拟机。Computing virtualization refers to providing part of the processor and memory of the computing device 100 to the virtual machine, network virtualization refers to providing part of the functions of the network card (such as bandwidth) to the virtual machine, and storage virtualization refers to providing part of the disk to the virtual machine.
虚拟机管理器还可实现不同虚拟机之间的逻辑隔离并管理虚拟机,例如创建虚拟机、根据硬件层为虚拟机模拟虚拟硬件(硬件模拟功能)、删除虚拟机、转发和/或处理运行在该计算设备100上的所有虚拟机(例如虚拟机1和虚拟机2)之间的网络报文或转发该计算设备100上的虚拟机与外部网络之间的网络报文(虚拟交换功能),处理虚拟机产生的I/O等。The virtual machine manager can also implement logical isolation between different virtual machines and manage virtual machines, such as creating virtual machines, simulating virtual hardware for virtual machines according to the hardware layer (hardware simulation function), deleting virtual machines, forwarding and/or processing network packets between all virtual machines (such as virtual machine 1 and virtual machine 2) running on the computing device 100 or forwarding network packets between the virtual machines on the computing device 100 and the external network (virtual switching function), processing I/O generated by virtual machines, etc.
不同虚拟机中的运行环境(如虚拟机应用、操作系统和虚拟硬件)是完全隔离的,虚拟机1和虚拟机2之间要进行通信需经过虚拟机管理器转发网络报文。The operating environments (such as virtual machine applications, operating systems, and virtual hardware) in different virtual machines are completely isolated. For virtual machine 1 and virtual machine 2 to communicate, network messages must be forwarded through the virtual machine manager.
租户可远程登录虚拟机,在虚拟机操作系统环境下操作虚拟机安装、设置以及卸载应用。Tenants can remotely log in to the virtual machine and operate the virtual machine to install, configure, and uninstall applications in the virtual machine operating system environment.
从图1可以看出,虚拟机由主机操作系统内核中的虚拟机管理器如KVM管理,一旦主机操作系统内核被攻击者攻破,那么攻击者将能操控虚拟机管理器管理虚拟机,对虚拟机中的用户数据造成安全威胁。As can be seen from Figure 1, the virtual machine is managed by a virtual machine manager in the host operating system kernel, such as KVM. Once the host operating system kernel is compromised by an attacker, the attacker will be able to manipulate the virtual machine manager to manage the virtual machine, posing a security threat to user data in the virtual machine.
因此,如何保护虚拟机中的用户数据安全,满足用户对虚拟机的安全需求,已成为本领域亟需解决的问题。Therefore, how to protect the security of user data in virtual machines and meet users' security requirements for virtual machines has become an urgent problem to be solved in this field.
为了解决上述问题,本申请提供一种计算设备及虚拟机实现方法。In order to solve the above problems, the present application provides a computing device and a virtual machine implementation method.
为了便于理解本申请提供的计算设备及虚拟机实现方法,下面先对本申请涉及的安全区(TrustZone)技术进行介绍。In order to facilitate understanding of the computing device and virtual machine implementation method provided by this application, the security zone (TrustZone) technology involved in this application is first introduced below.
随着ARM处理器性能的不断提升,运行有ARM处理器的计算设备给人们的生活带来了极大的便利。与此同时,计算设备上也携带了越来越多的用户数据,用户也越来越重视计算设备的安全性。ARM处理器上,当前主流的系统级解决方案是TrustZone技术。 As the performance of ARM processors continues to improve, computing devices running ARM processors have brought great convenience to people's lives. At the same time, computing devices also carry more and more user data, and users are paying more and more attention to the security of computing devices. On ARM processors, the current mainstream system-level solution is TrustZone technology.
TrustZone技术作为安全拓展最早是在ARMv6的版本中被引入的,它把计算设备的硬件资源划分为两个世界,REE侧(也可以称为普通世界(normal world))和TEE侧(也可以称为安全世界(secure world))。TrustZone作为硬件安全特性,工作在TEE侧。TrustZone technology was first introduced in the ARMv6 version as a security extension. It divides the hardware resources of computing devices into two worlds, the REE side (also called the normal world) and the TEE side (also called the secure world). TrustZone, as a hardware security feature, works on the TEE side.
REE侧并不是指运行在其中的操作系统(operating system,OS)或者软件是恶意的,而是它所处环境的安全性比TEE侧低。因为当处理器工作在REE侧的时候,TEE侧的资源(如寄存器、内存、高速缓冲存储器(cache)、外设等)是被禁止访问的,一旦处理器试图访问这些资源,系统将会直接崩溃。例如,TrustZone可以通过配置安全区地址控制(trustzone address space contoller,TZASC)寄存器和安全区内存调整(trustzone memory adapter,TZMA)寄存器,把敏感的内存设置为安全内存(secure memory),REE侧就无法对这片内存进行访问。当处理器工作在TEE侧时,它既可以访问TEE侧的资源,又可以访问REE侧的资源。正是由于TEE侧拥有比REE侧的操作系统更高的权限,TrustZone可以作为可信根为REE侧的操作系统提供更高级别的安全保护方案。The REE side does not mean that the operating system (OS) or software running in it is malicious, but that the security of the environment it is in is lower than that of the TEE side. Because when the processor works on the REE side, the resources on the TEE side (such as registers, memory, cache, peripherals, etc.) are prohibited from access. Once the processor tries to access these resources, the system will crash directly. For example, TrustZone can set sensitive memory to secure memory by configuring the trustzone address space controller (TZASC) register and the trustzone memory adapter (TZMA) register, so that the REE side cannot access this memory. When the processor works on the TEE side, it can access resources on both the TEE side and the REE side. It is precisely because the TEE side has higher permissions than the operating system on the REE side that TrustZone can provide a higher level of security protection for the operating system on the REE side as a trusted root.
以ARMv8.0为例,图2描述了ARM的硬件架构,左侧是REE侧的架构,右侧是TEE侧的架构,REE侧包括四种工作权限:异常等级0(exception level 0,EL0)、EL1、EL2和EL3,TEE侧包括三种工作权限:安全异常等级0(secure exception level 0,SEL0)、SEL1和EL3。其中,EL0也可以称为用户态层,EL1也可以称为内核态层,EL2也可以称为虚拟机管理器层,EL3也可以称为安全监控(secure monitor)层。数值越大的级别的等级权限越高,数值越小的级别的等级权限越低。异常等级可以理解为特权等级。Taking ARMv8.0 as an example, Figure 2 describes the hardware architecture of ARM. The left side is the architecture of the REE side, and the right side is the architecture of the TEE side. The REE side includes four working permissions: exception level 0 (EL0), EL1, EL2, and EL3, and the TEE side includes three working permissions: secure exception level 0 (SEL0), SEL1, and EL3. Among them, EL0 can also be called the user state layer, EL1 can also be called the kernel state layer, EL2 can also be called the virtual machine manager layer, and EL3 can also be called the secure monitor layer. The higher the level of the level, the higher the level of the level, and the smaller the level of the level, the lower the level of the level. The exception level can be understood as the privilege level.
用户应用程序运行在REE侧的EL0下,操作系统或者一些特权函数运行在REE侧的EL1下,如虚拟机的操作系统运行在EL1下。虚拟机管理器如KVM运行在EL2下。ARM可信固件运行在EL3下,ARM可信固件(ARM trusted firmware,ATF)是处理器启动时运行的第一个组件,是由ARM官方提供的底层固件,该固件统一了ARM底层接口标准,如电源状态控制接口(power status control interface,PSCI)、安全启动需求(trusted board boot requirements,TBBR)、安全世界状态与普通世界状态切换的SMC操作等。User applications run in EL0 on the REE side, and operating systems or some privileged functions run in EL1 on the REE side, such as the operating system of a virtual machine running in EL1. Virtual machine managers such as KVM run in EL2. ARM trusted firmware runs in EL3. ARM trusted firmware (ATF) is the first component that runs when the processor starts. It is the underlying firmware officially provided by ARM. This firmware unifies the ARM underlying interface standards, such as the power status control interface (PSCI), trusted board boot requirements (TBBR), and SMC operations for switching between secure world state and normal world state.
在EL3下,处理器权限等级最高,不仅能够访问TEE侧所有的资源,还能够访问REE侧所有的资源。Under EL3, the processor has the highest privilege level and can access not only all resources on the TEE side, but also all resources on the REE side.
上文是对TrustZone技术的介绍,接下来介绍本申请提供的计算设备,本申请提供的计算设备主要为运行有上述图2所示的ARM处理器的计算设备。The above is an introduction to the TrustZone technology. Next, the computing device provided by this application will be introduced. The computing device provided by this application is mainly a computing device running the ARM processor shown in Figure 2 above.
请参见图3,图3为本申请提供的一种计算设备300的示意图,如图3所示,该计算设备300的硬件资源被划分为REE侧和TEE侧,TEE侧包括一个或多个机密虚拟机,在图3中,以TEE侧包括一个机密虚拟机为例,REE侧可以包括一个或多个普通虚拟机,在图3中,以REE侧包括两个普通虚拟机为例。Please refer to Figure 3, which is a schematic diagram of a computing device 300 provided in the present application. As shown in Figure 3, the hardware resources of the computing device 300 are divided into a REE side and a TEE side. The TEE side includes one or more confidential virtual machines. In Figure 3, the TEE side includes a confidential virtual machine as an example. The REE side may include one or more ordinary virtual machines. In Figure 3, the REE side includes two ordinary virtual machines as an example.
如图3所示,计算设备300中还包括对TEE侧的机密虚拟机进行管理的虚拟机管理器,为了将该虚拟机管理器与上述图1所示的计算设备100的主机内核中部署的虚拟机管理器进行区分,在接下来的实施例中,将用于对TEE侧的机密虚拟机进行管理的虚拟机管理器称为第一虚拟机管理器,将主机内核中部署的用于对REE侧的普通虚拟机进行管理的虚拟机管理器称为第二虚拟机管理器。具体实现中,TEE侧的虚拟机管理器也可以称为安全区管理器(trustzone management monitor,TMM)或者安全区虚拟机管理器等,本申请不对TEE侧的虚拟机管理器的名称进行具体限定。As shown in FIG3 , the computing device 300 also includes a virtual machine manager for managing the confidential virtual machine on the TEE side. In order to distinguish the virtual machine manager from the virtual machine manager deployed in the host kernel of the computing device 100 shown in FIG1 , in the following embodiments, the virtual machine manager for managing the confidential virtual machine on the TEE side is referred to as the first virtual machine manager, and the virtual machine manager deployed in the host kernel for managing the ordinary virtual machine on the REE side is referred to as the second virtual machine manager. In a specific implementation, the virtual machine manager on the TEE side may also be referred to as a trustzone management monitor (TMM) or a trustzone virtual machine manager, etc. This application does not specifically limit the name of the virtual machine manager on the TEE side.
第一虚拟机管理器用于在计算设备300的TEE侧部署机密虚拟机,以及用于启动机密虚拟机。可以理解,在启动机密虚拟机后,处理器便可以运行机密虚拟机处理用户数据。The first virtual machine manager is used to deploy the confidential virtual machine on the TEE side of the computing device 300, and to start the confidential virtual machine. It can be understood that after starting the confidential virtual machine, the processor can run the confidential virtual machine to process user data.
第一虚拟机管理器还可以对机密虚拟机的生命周期进行管理,如开机、关机、更改规格、迁移和释放。第一虚拟机管理器还可以对机密虚拟机上安装的APP进行管理,如安装、启动、关闭、升级、卸载和迁移APP。第一虚拟机管理器还可以对机密虚拟机进行其他管理操作,将在下文进行详细描述。The first virtual machine manager can also manage the life cycle of the confidential virtual machine, such as powering on, powering off, changing specifications, migrating, and releasing. The first virtual machine manager can also manage the apps installed on the confidential virtual machine, such as installing, starting, shutting down, upgrading, uninstalling, and migrating the apps. The first virtual machine manager can also perform other management operations on the confidential virtual machine, which will be described in detail below.
从图3可以看出,机密虚拟机与普通虚拟机类似,包括操作系统内核以及APP。其中,机密虚拟机中的操作系统内核可以是林纳克斯(linux)等富操作系统(rich OS)内核,也可以是其他类型的操作系统内核,也就是说,机密虚拟机中的操作系统可以是linux等富操作系统,也可以是其他类型的操作系统,本申请对此不作限定。可以理解,在机密虚拟机中的操作系统是linux操作系统时,机密虚拟机可以为普通linux虚拟机迁移而来。还可以理解,在机密虚拟机中的操作系统是linux操作系统等富操作系统时,由于富操作系统功能比较强大,因此,租户在机密虚拟机中安装APP(如对运行环境要求较高的人工智能(artificial intelligence,AI)应用)时,可以直接安装,无需对APP进行修改,可以实现APP的零修改安装。As can be seen from Figure 3, the confidential virtual machine is similar to an ordinary virtual machine, including an operating system kernel and an APP. Among them, the operating system kernel in the confidential virtual machine can be a rich operating system (rich OS) kernel such as Linux, or it can be other types of operating system kernels. That is to say, the operating system in the confidential virtual machine can be a rich operating system such as Linux, or it can be other types of operating systems. This application does not limit this. It can be understood that when the operating system in the confidential virtual machine is a Linux operating system, the confidential virtual machine can be migrated from an ordinary Linux virtual machine. It can also be understood that when the operating system in the confidential virtual machine is a rich operating system such as a Linux operating system, since the rich operating system has relatively powerful functions, when the tenant installs an APP (such as an artificial intelligence (AI) application with high requirements for the operating environment) in the confidential virtual machine, it can be installed directly without modifying the APP, and zero-modification installation of the APP can be achieved.
在本申请具体的实施例中,如图3所示,计算设备300的处理器在EL3下运行第一虚拟机管理器。可 以理解,由于处理器是在EL3下运行第一虚拟机管理器,因此第一虚拟机管理器具有EL3对应的权限,其既可以访问TEE侧的资源,也可以访问REE侧的资源。在一种可能的实施例中,第一虚拟机管理器部署于ARM可信固件中。In a specific embodiment of the present application, as shown in FIG3 , the processor of the computing device 300 runs the first virtual machine manager under EL3. It can be understood that since the processor runs the first virtual machine manager under EL3, the first virtual machine manager has the corresponding permissions of EL3, and can access resources on the TEE side as well as resources on the REE side. In a possible embodiment, the first virtual machine manager is deployed in the ARM trusted firmware.
在一种可能的实施例中,如图3所示,REE侧还可以包括机密虚拟机的影子(shadow),机密虚拟机的影子可以用于处理器在停止运行机密虚拟机转而运行其他的程序时,处理器使用机密虚拟机的影子保存机密虚拟机的上下文,当处理器执行完其他的程序恢复运行机密虚拟机时,处理器将机密虚拟机的影子中保存的机密虚拟机的上下文恢复至机密虚拟机,从而恢复机密虚拟机的运行。In a possible embodiment, as shown in FIG3 , the REE side may further include a shadow of the confidential virtual machine. The shadow of the confidential virtual machine may be used by the processor to save the context of the confidential virtual machine when the processor stops running the confidential virtual machine and runs other programs instead. When the processor completes executing other programs and resumes running the confidential virtual machine, the processor restores the context of the confidential virtual machine saved in the shadow of the confidential virtual machine to the confidential virtual machine, thereby resuming the operation of the confidential virtual machine.
应当理解,计算设备300仅为本申请实施例提供的一个示例,并且,计算设备300可具有比图3示出的部件更多或更少的部件,或者可具有部件的不同配置实现。It should be understood that the computing device 300 is only an example provided in the embodiment of the present application, and the computing device 300 may have more or fewer components than those shown in FIG. 3 , or may have different configurations of the components.
下面结合图4A所示的本申请提供的一种虚拟机实现方法的流程图,对图3所示的计算设备300实现虚拟机的过程进行描述。The following describes the process of implementing a virtual machine by the computing device 300 shown in FIG. 3 in conjunction with the flowchart of a virtual machine implementation method provided by the present application shown in FIG. 4A .
S401:处理器在EL3下运行第一虚拟机管理器在TEE侧创建第一机密虚拟机。S401: The processor runs the first virtual machine manager under EL3 to create a first confidential virtual machine on the TEE side.
具体地,计算设备300的处理器可以在REE侧获取待创建的第一机密虚拟机的配置信息,然后在EL3下运行第一虚拟机管理器,根据第一机密虚拟机的配置信息在TEE侧创建第一机密虚拟机。其中,配置信息包括待创建的第一机密虚拟机的规格,例如,存储器的大小、存储器的类型、内存的大小、内存的类型、处理器核的类型、处理器核的数量、处理器核的计算速度、处理器核的内核数量、网络带宽、操作系统内核和文件系统(file system)等等。处理器在创建第一机密虚拟机时,可以基于配置信息向第一机密虚拟机提供与配置信息匹配的虚拟硬件资源,例如,基于配置信息中包括的内存信息在TEE侧的内存资源中划分出与内存信息匹配的、供第一机密虚拟机使用的内存,基于配置信息中包括的处理器核信息模拟出与处理器核信息匹配的、供第一机密虚拟机使用的虚拟处理器核,以及将配置信息中包括的操作系统内核和文件系统加载至第一机密虚拟机对应的内存中等等,从而实现第一机密虚拟机的创建。Specifically, the processor of the computing device 300 can obtain the configuration information of the first confidential virtual machine to be created on the REE side, and then run the first virtual machine manager under EL3, and create the first confidential virtual machine on the TEE side according to the configuration information of the first confidential virtual machine. The configuration information includes the specifications of the first confidential virtual machine to be created, such as the size of the memory, the type of the memory, the size of the memory, the type of the memory, the type of the processor core, the number of processor cores, the computing speed of the processor core, the number of cores of the processor core, the network bandwidth, the operating system kernel and the file system, etc. When creating the first confidential virtual machine, the processor can provide the first confidential virtual machine with virtual hardware resources matching the configuration information based on the configuration information, for example, based on the memory information included in the configuration information, divide the memory matching the memory information and used by the first confidential virtual machine from the memory resources on the TEE side, simulate the virtual processor core matching the processor core information and used by the first confidential virtual machine based on the processor core information included in the configuration information, and load the operating system kernel and the file system included in the configuration information into the memory corresponding to the first confidential virtual machine, etc., so as to achieve the creation of the first confidential virtual machine.
处理器在REE侧获取第一机密虚拟机的配置信息的方式可以参考如下方式1或者方式2中任意一种:The method for the processor to obtain the configuration information of the first confidential virtual machine on the REE side may refer to any one of the following methods 1 or 2:
方式1,配置信息可以是用户在计算设备300的界面上输入的,用户可以根据自己的需求输入所需要的处理器核的类型、处理器核的数量、处理器核的计算能力要求、存储器的类型、存储器的数量、内存的大小、内存的类型、网络带宽的要求等等,此时,第一机密虚拟机可以理解为是私人订制的。计算设备300在获取到用户输入的配置信息之后,将该配置信息存储至REE侧的内存,后续处理器在EL3下运行第一虚拟机管理器从REE侧的内存中获取该配置信息。Mode 1: The configuration information may be input by the user on the interface of the computing device 300. The user may input the required processor core type, number of processor cores, computing power requirements of the processor cores, type of memory, number of memory, size of memory, type of memory, network bandwidth requirements, etc. according to his/her needs. At this time, the first confidential virtual machine may be understood as being customized. After obtaining the configuration information input by the user, the computing device 300 stores the configuration information in the memory on the REE side. The subsequent processor runs the first virtual machine manager under EL3 to obtain the configuration information from the memory on the REE side.
方式2,配置信息可以为用户从计算设备300的界面提供的多种可能的配置信息中选择的,也就是说,用户只能从多种配置信息中进行选择,而不能根据自己的需要自行决定处理器核的类型、处理器核的数量、处理器核的计算能力要求、存储器的类型、存储器的数量、内存的大小、内存的类型、网络带宽的要求等等。此时,第一机密虚拟机可以理解为按规格进行提供的,用户只能从有限的规格中选择适合自己的规格。计算设备300在获取到用户选择的配置信息之后,将该配置信息存储至REE侧的内存,后续处理器在EL3下运行第一虚拟机管理器从REE侧的内存中获取该配置信息。Mode 2: The configuration information can be selected by the user from a variety of possible configuration information provided by the interface of the computing device 300. That is to say, the user can only select from a variety of configuration information, and cannot decide the type of processor core, the number of processor cores, the computing power requirements of the processor cores, the type of memory, the number of memories, the size of memory, the type of memory, the requirements of network bandwidth, etc. according to their own needs. At this time, the first confidential virtual machine can be understood as provided according to specifications, and the user can only select the specifications that suit him from the limited specifications. After obtaining the configuration information selected by the user, the computing device 300 stores the configuration information in the memory on the REE side, and the subsequent processor runs the first virtual machine manager under EL3 to obtain the configuration information from the memory on the REE side.
需要说明的,上述方式1、方式2仅仅作为处理器在REE侧获取第一机密虚拟机的配置信息的方式的示例,例如,处理器可以通过上述方式1获取第一机密虚拟机的部分配置信息,通过上述方式2获取第一机密虚拟机的另一部分配置信息,本申请不对此进行具体限定。It should be noted that the above-mentioned method 1 and method 2 are merely examples of the method in which the processor obtains the configuration information of the first confidential virtual machine on the REE side. For example, the processor can obtain part of the configuration information of the first confidential virtual machine through the above-mentioned method 1, and obtain another part of the configuration information of the first confidential virtual machine through the above-mentioned method 2. This application does not specifically limit this.
S402:处理器在EL3下运行第一虚拟机管理器启动第一机密虚拟机。S402: The processor runs the first virtual machine manager under EL3 to start the first confidential virtual machine.
可以理解,处理器在启动机密虚拟机后,处理器便可以运行第一机密虚拟机处理用户数据。It can be understood that after the processor starts the confidential virtual machine, the processor can run the first confidential virtual machine to process user data.
下面结合图4B所示的本申请示例性示出的一种数据处理方法的流程图,对处理器运行第一机密虚拟机处理用户数据的过程进行描述。The following describes a process in which a processor runs a first confidential virtual machine to process user data in conjunction with a flowchart of a data processing method exemplarily illustrated in the present application as shown in FIG. 4B .
如图4B所示,该方法包括如下步骤:As shown in FIG4B , the method comprises the following steps:
S410:处理器在REE侧获取用户数据。S410: The processor obtains user data on the REE side.
用户数据可以为待进行人脸识别的人脸图像、待进行语音识别的语音信号、待进行文字识别的文本数据等,也可以为待进行训练的模型以及训练数据,还可以为待进行加密存储的数据,本申请不对用户数据进行具体限定。User data may be a face image to be recognized, a voice signal to be recognized, text data to be recognized, etc. It may also be a model to be trained and training data, or data to be encrypted and stored. This application does not specifically limit user data.
S420:处理器在TEE侧运行第一机密虚拟机对用户数据进行处理。S420: The processor runs the first confidential virtual machine on the TEE side to process the user data.
具体实现中,用户数据可以为用户通过计算设备300提供的接口输入至计算设备300,计算设备300 在获取到用户输入的用户数据后,将用户数据存储至REE侧的内存,后续处理器运行第一机密虚拟机从REE侧的内存中读取并处理该用户数据。In a specific implementation, the user data may be input to the computing device 300 by the user through an interface provided by the computing device 300, and the computing device 300 After obtaining the user data input by the user, the user data is stored in the memory on the REE side, and the subsequent processor runs the first confidential virtual machine to read and process the user data from the memory on the REE side.
在该实施例中,在用户数据为待进行人脸识别的人脸图像/待进行语音识别的语音信号/待进行文本识别的文本数据时,处理器在TEE侧运行第一机密虚拟机对人脸图像/语音信号/文本数据进行识别得到对应的识别结果之后,可以在REE侧将识别结果提供给用户。在用户数据为待进行训练的模型以及训练数据时,处理器在TEE侧运行第一机密虚拟机使用训练数据对模型进行训练得到训练好的模型之后,可以在REE侧将训练好的模型提供给用户。也就是说,TEE侧的第一机密虚拟机通过REE侧与计算设备300的外部网络通信,可以理解,这样可以提高第一机密虚拟机的安全性。In this embodiment, when the user data is a face image to be recognized/a voice signal to be recognized/a text data to be recognized, the processor runs the first confidential virtual machine on the TEE side to recognize the face image/voice signal/text data to obtain the corresponding recognition result, and then provides the recognition result to the user on the REE side. When the user data is a model to be trained and training data, the processor runs the first confidential virtual machine on the TEE side to train the model using the training data to obtain a trained model, and then provides the trained model to the user on the REE side. In other words, the first confidential virtual machine on the TEE side communicates with the external network of the computing device 300 through the REE side. It can be understood that this can improve the security of the first confidential virtual machine.
在用户数据为待进行加密存储的数据时,处理器在TEE侧运行第一机密虚拟机对数据进行加密之后存储到对应的位置即可。When the user data is data to be encrypted and stored, the processor runs the first confidential virtual machine on the TEE side to encrypt the data and then stores it in the corresponding location.
在一种可能的实施例中,在S410中,处理器在REE侧获取的用户数据为加密数据,在处理器执行S420之前,处理器会在EL3下运行第一虚拟机管理器获取TEE侧存储的用于对加密数据进行解密的解密密钥,然后使用解密密钥对加密数据进行解密,得到用户数据的明文。之后处理器才运行第一机密虚拟机处理用户数据。也就是说,用户数据在REE侧以加密状态存在,且解密密钥存储在TEE侧,REE侧的主机操作系统内核以及软件(如KVM、普通虚拟机等)均无法获取TEE侧存储的解密密钥,因此即便攻击者攻破了REE侧的主机操作系统内核以及软件,窃取到加密数据,也无法解密得到用户数据的明文。如此可以满足用户数据不被REE侧的主机操作系统内核以及软件窃取的需求,进一步提升用户数据安全。In a possible embodiment, in S410, the user data obtained by the processor on the REE side is encrypted data. Before the processor executes S420, the processor will run the first virtual machine manager under EL3 to obtain the decryption key stored on the TEE side for decrypting the encrypted data, and then use the decryption key to decrypt the encrypted data to obtain the plain text of the user data. After that, the processor runs the first confidential virtual machine to process the user data. In other words, the user data exists in an encrypted state on the REE side, and the decryption key is stored on the TEE side. The host operating system kernel and software (such as KVM, ordinary virtual machines, etc.) on the REE side cannot obtain the decryption key stored on the TEE side. Therefore, even if the attacker breaks through the host operating system kernel and software on the REE side and steals the encrypted data, it cannot decrypt the plain text of the user data. In this way, the demand that user data is not stolen by the host operating system kernel and software on the REE side can be met, and the security of user data can be further improved.
在本申请具体的实施例中,计算设备300在创建第一机密虚拟机之后,还可以对第一机密虚拟机进行管理,管理内容如下:In a specific embodiment of the present application, after creating the first confidential virtual machine, the computing device 300 may also manage the first confidential virtual machine, and the management content is as follows:
①对第一机密虚拟机的生命周期进行管理。① Manage the life cycle of the first confidential virtual machine.
计算设备300的处理器可以在REE侧获取针对第一机密虚拟机的生命周期的第一管理命令,之后在EL3下运行第一虚拟机管理器根据第一管理命令对第一机密虚拟机执行以下操作的一种或任意组合:开机、关机、更改规格、迁移和释放(销毁)。The processor of the computing device 300 can obtain the first management command for the life cycle of the first confidential virtual machine on the REE side, and then run the first virtual machine manager under EL3 to perform one or any combination of the following operations on the first confidential virtual machine according to the first management command: power on, power off, change specifications, migrate, and release (destruction).
具体地,处理器在释放第一机密虚拟机之前,可以先确定第一机密虚拟机是否处于非运行状态,在确定第一机密虚拟机处于非运行状态时,释放第一机密虚拟机,若确定第一机密虚拟机处于运行状态,则等待第一机密虚拟机运行完毕,再释放第一机密虚拟机。处理器释放第一机密虚拟机的具体过程可以包括擦除第一机密虚拟机的上下文信息,擦除计算设备300的内存中与第一机密虚拟机相关的内容以及释放第一机密虚拟机占用的资源如内存等操作。Specifically, before releasing the first confidential virtual machine, the processor may first determine whether the first confidential virtual machine is in a non-operating state. When it is determined that the first confidential virtual machine is in a non-operating state, the processor releases the first confidential virtual machine. If it is determined that the first confidential virtual machine is in an operating state, the processor waits for the first confidential virtual machine to finish operating before releasing the first confidential virtual machine. The specific process of the processor releasing the first confidential virtual machine may include erasing the context information of the first confidential virtual machine, erasing the content related to the first confidential virtual machine in the memory of the computing device 300, and releasing the resources occupied by the first confidential virtual machine, such as memory.
②对第一机密虚拟机上的APP进行管理。② Manage the APP on the first confidential virtual machine.
计算设备300的处理器可以在REE侧获取针对第一机密虚拟机的第二管理命令,之后在EL3下运行第一虚拟机管理器根据第二管理命令对第一机密虚拟机执行以下操作的一种或任意组合:安装、启动、关闭、升级、卸载和迁移APP。The processor of the computing device 300 can obtain the second management command for the first confidential virtual machine on the REE side, and then run the first virtual machine manager under EL3 to perform one or any combination of the following operations on the first confidential virtual machine according to the second management command: install, start, shut down, upgrade, uninstall and migrate APP.
③对第一机密虚拟机的内存进行管理。③ Manage the memory of the first confidential virtual machine.
计算设备300的处理器可以在EL3下运行第一虚拟机管理器,创建、更改或者销毁第一机密虚拟机的一级页表或者二级页表,以实现对第一机密虚拟机的内存的管理。其中,第一机密虚拟机的一级页表是指将第一机密虚拟机的虚拟地址(virtual adress,VA)映射为物理地址(physical address,PA)的页表,第一机密虚拟机的二级页表是指将第一机密虚拟机的VA映射为中间物理地址(intermediate physical address,IPA),以及将IPA映射为计算设备中为第一机密虚拟机分配的PA的页表。The processor of the computing device 300 can run the first virtual machine manager under EL3 to create, change or destroy the first-level page table or the second-level page table of the first confidential virtual machine to manage the memory of the first confidential virtual machine. The first-level page table of the first confidential virtual machine refers to a page table that maps the virtual address (VA) of the first confidential virtual machine to a physical address (PA), and the second-level page table of the first confidential virtual machine refers to a page table that maps the VA of the first confidential virtual machine to an intermediate physical address (IPA), and maps the IPA to a PA allocated to the first confidential virtual machine in the computing device.
④对第一机密虚拟机出现的异常进行处理以及对第一机密虚拟机的上下文进行管理。④ Handle the exceptions that occur in the first confidential virtual machine and manage the context of the first confidential virtual machine.
计算设备300的处理器在第一机密虚拟机出现异常时,可以在EL3下运行第一虚拟机管理器建立第一机密虚拟机的上下文,之后处理第一虚拟机出现的异常,处理完异常之后,再将建立的第一机密虚拟机的上下文恢复至第一机密虚拟机,以恢复运行第一机密虚拟机。其中,第一机密虚拟机出现的异常可以为缺页异常、MMIO操作异常、等待中断(wait for interrupt,WFI)、等待事件(wait for event,WFE)、执行虚拟机管理器调用(hypervisor call,HVC)指令、执行SMC指令、读写系统寄存器、指令中止(instruction abort)、数据中止(data abort)(如数据终止同步异常(data abort sync exception))、中断请求(interrupt request,IRQ)和快速中断请求(fast interrupt request,FIQ)、电源管理接口(power state coordination interface,PSCI)的电源管理指令退出和系统错误退出等。MMIO操作是指第一机密虚拟机通过MMIO技术访问I/O设备的操作,MMIO操作异常指第一机密虚拟机进行MMIO操作时引起的异常。 When an exception occurs in the first confidential virtual machine, the processor of the computing device 300 can run the first virtual machine manager under EL3 to establish the context of the first confidential virtual machine, then handle the exception of the first virtual machine, and after handling the exception, restore the established context of the first confidential virtual machine to the first confidential virtual machine to resume the operation of the first confidential virtual machine. Among them, the exception of the first confidential virtual machine can be a page fault exception, an MMIO operation exception, wait for interrupt (WFI), wait for event (WFE), execute a hypervisor call (HVC) instruction, execute an SMC instruction, read and write a system register, an instruction abort, a data abort (such as a data abort sync exception), an interrupt request (IRQ) and a fast interrupt request (FIQ), a power management instruction exit of the power management interface (PSCI) and a system error exit, etc. MMIO operation refers to the operation of the first confidential virtual machine accessing the I/O device through the MMIO technology, and the MMIO operation exception refers to the exception caused when the first confidential virtual machine performs the MMIO operation.
在一种可能的实施例中,在第一机密虚拟机出现的异常为缺页异常、MMIO操作异常或者数据终止同步异常时,处理器在EL3下运行第一虚拟机管理器处理第一机密虚拟机出现的异常的过程具体可以为:处理器在EL3下运行第一虚拟机管理器,接收第一机密虚拟机发送的缺页异常处理指令、MMIO操作异常处理指令或者数据终止同步异常处理指令,然后,处理器在EL3下运行第一虚拟机管理器根据缺页异常处理指令处理第一机密虚拟机出现的缺页异常,或者,处理器在EL3下运行第一虚拟机管理器根据MMIO操作异常处理指令处理第一机密虚拟机出现的MMIO操作异常,或者,处理器在EL3下运行第一虚拟机管理器根据数据终止同步异常处理指令处理第一机密虚拟机出现的数据终止同步异常。这里,缺页异常处理指令、MMIO操作异常处理指令或者数据终止同步异常处理指令为SMC类型的指令。In a possible embodiment, when the exception occurring in the first confidential virtual machine is a page fault exception, an MMIO operation exception, or a data termination synchronization exception, the process in which the processor runs the first virtual machine manager at EL3 to handle the exception occurring in the first confidential virtual machine may specifically be: the processor runs the first virtual machine manager at EL3, receives a page fault exception handling instruction, an MMIO operation exception handling instruction, or a data termination synchronization exception handling instruction sent by the first confidential virtual machine, and then the processor runs the first virtual machine manager at EL3 to handle the page fault exception occurring in the first confidential virtual machine according to the page fault exception handling instruction, or the processor runs the first virtual machine manager at EL3 to handle the MMIO operation exception occurring in the first confidential virtual machine according to the MMIO operation exception handling instruction, or the processor runs the first virtual machine manager at EL3 to handle the data termination synchronization exception occurring in the first confidential virtual machine according to the data termination synchronization exception handling instruction. Here, the page fault exception handling instruction, the MMIO operation exception handling instruction, or the data termination synchronization exception handling instruction is an SMC type instruction.
⑤在运行第一机密虚拟机之前,对第一机密虚拟机的安全性进行检查,以及对计算设备300的安全性进行检查。⑤ Before running the first confidential virtual machine, check the security of the first confidential virtual machine and check the security of the computing device 300.
在一种可能的实施例中,处理器可以在EL3下通过运行第一虚拟机管理器,将第一机密虚拟机的配置信息(如虚拟处理器核类型、虚拟处理器核数量、内存地址等)、第一机密虚拟机上安装的操作系统的版本信息和APP名称等,在REE侧提供给用户进行安全性检查,即由用户确定第一机密虚拟机是满足自身预期的安全虚拟机,还是存在安全威胁的非安全虚拟机。在处理器在EL3下运行第一虚拟机管理器获取到用户确定第一机密虚拟机是满足自身预期的安全虚拟机的反馈的情况下,处理器确定第一机密虚拟机是安全虚拟机,启动第一机密虚拟机,否则,处理器确定第一机密虚拟机是非安全虚拟机,不启动第一机密虚拟机。可选地,处理器也可以通过其他方式对第一机密虚拟机的安全性进行检查,本申请对此不作具体限定。In a possible embodiment, the processor can provide the configuration information of the first confidential virtual machine (such as the type of virtual processor cores, the number of virtual processor cores, memory addresses, etc.), the version information of the operating system installed on the first confidential virtual machine, and the APP name, etc. to the user on the REE side for security check by running the first virtual machine manager under EL3, that is, the user determines whether the first confidential virtual machine is a secure virtual machine that meets the user's expectations, or an unsecure virtual machine that poses a security threat. When the processor runs the first virtual machine manager under EL3 and obtains feedback from the user that the first confidential virtual machine is a secure virtual machine that meets the user's expectations, the processor determines that the first confidential virtual machine is a secure virtual machine and starts the first confidential virtual machine. Otherwise, the processor determines that the first confidential virtual machine is an unsecure virtual machine and does not start the first confidential virtual machine. Optionally, the processor can also check the security of the first confidential virtual machine in other ways, which is not specifically limited in this application.
在一种可能的实施例中,处理器可以在EL3下通过运行第一虚拟机管理器,将计算设备300的证书在REE侧提供给用户进行合法性检查,即由用户确定计算设备300是满足自身预期的安全设备,还是存在安全威胁的非安全设备。在处理器在EL3下运行第一虚拟机管理器获取到用户确定计算设备是满足自身预期的安全设备的反馈的情况下,处理器确定计算设备是安全设备,启动第一虚拟机,否则,处理器确定计算设备是非安全设备,不启动第一虚拟机。可选地,处理器也可以通过其他方式对计算设备300的安全性进行检查,本申请对此不作具体限定。In a possible embodiment, the processor can provide the certificate of the computing device 300 to the user on the REE side for legitimacy check by running the first virtual machine manager under EL3, that is, the user determines whether the computing device 300 is a secure device that meets his expectations or a non-secure device with security threats. In the case where the processor runs the first virtual machine manager under EL3 and obtains feedback from the user that the computing device is a secure device that meets his expectations, the processor determines that the computing device is a secure device and starts the first virtual machine. Otherwise, the processor determines that the computing device is a non-secure device and does not start the first virtual machine. Optionally, the processor can also check the security of the computing device 300 in other ways, which is not specifically limited in this application.
可选地,若处理器在运行第一机密虚拟机的过程中,检测到第一机密虚拟机的配置信息、第一机密虚拟机上安装的操作系统内核版本、APP名称等被更改,处理器可以重新确定更改后的第一机密虚拟机的安全性,在确定更改后的第一机密虚拟机安全的情况下,启动并运行更改后的第一机密虚拟机,否则拒绝启动更改后的第一机密虚拟机。Optionally, if the processor detects that configuration information of the first confidential virtual machine, the operating system kernel version installed on the first confidential virtual machine, the APP name, etc. have been changed during the running of the first confidential virtual machine, the processor can re-determine the security of the changed first confidential virtual machine, and start and run the changed first confidential virtual machine if it is determined that the changed first confidential virtual machine is safe, otherwise refuse to start the changed first confidential virtual machine.
可选的,若处理器在运行第一机密虚拟机的过程中,处理器检测到计算设备300的证书过期或者检测到计算设备300存在安全隐患,处理器可以在REE侧提醒用户计算设备300的证书已过期或者提供用户计算设备300存在安全隐患,让用户确定是否继续使用该计算设备300运行第一机密虚拟机。Optionally, if the processor detects that the certificate of the computing device 300 has expired or detects that there is a security risk in the computing device 300 during the process of running the first confidential virtual machine, the processor can remind the user on the REE side that the certificate of the computing device 300 has expired or provide the user with the security risk of the computing device 300, allowing the user to determine whether to continue using the computing device 300 to run the first confidential virtual machine.
可以理解,对第一机密虚拟机的安全性以及对计算设备300的安全性进行检查之后再运行第一机密虚拟机,以及在第一机密虚拟机运行的过程中,继续监测第一机密虚拟机和计算设备300的安全性,可以提升第一机密虚拟机的安全性,从而提升第一机密虚拟机中存储或使用的用户数据的安全性。It can be understood that running the first confidential virtual machine after checking the security of the first confidential virtual machine and the security of the computing device 300, and continuing to monitor the security of the first confidential virtual machine and the computing device 300 during the operation of the first confidential virtual machine, can improve the security of the first confidential virtual machine, thereby improving the security of user data stored or used in the first confidential virtual machine.
⑥对第一机密虚拟机的各项虚拟化功能进行管理。⑥ Manage various virtualization functions of the first confidential virtual machine.
计算设备300的处理器在TEE侧运行第一机密虚拟机之前,还可以在REE侧或者TEE侧得到如下一种或任意组合:第一机密虚拟机的虚拟中断、供第一机密虚拟机使用的虚拟时钟以及供第一机密虚拟机使用的内存映射输入/输出(memory-mapped input/output,MMIO)信息等,然后将这些信息注入到第一机密虚拟机,之后,根据这些信息运行第一虚拟机。其中,虚拟时钟可以用于第一机密虚拟机测量时间间隔,第一机密虚拟机测量出时间间隔的目的可以是进行任务调度,MMIO信息可以用于第一机密虚拟机像访问内存一样访问I/O设备。Before the processor of the computing device 300 runs the first confidential virtual machine on the TEE side, it can also obtain one or any combination of the following on the REE side or the TEE side: a virtual interrupt of the first confidential virtual machine, a virtual clock used by the first confidential virtual machine, and memory-mapped input/output (MMIO) information used by the first confidential virtual machine, etc., and then inject this information into the first confidential virtual machine, and then run the first virtual machine according to this information. Among them, the virtual clock can be used for the first confidential virtual machine to measure the time interval, and the purpose of the first confidential virtual machine measuring the time interval can be to perform task scheduling, and the MMIO information can be used by the first confidential virtual machine to access the I/O device like accessing the memory.
可以理解,若处理器在REE侧得到第一机密虚拟机的虚拟中断、供第一机密虚拟机使用的虚拟时钟和MMIO信息等,而不是在TEE侧得到这些信息,可以使得TEE侧的可信计算基(trusted computing base,TCB)比较轻薄。It is understandable that if the processor obtains the virtual interrupt of the first confidential virtual machine, the virtual clock and MMIO information used by the first confidential virtual machine on the REE side, rather than obtaining this information on the TEE side, the trusted computing base (TCB) on the TEE side can be made thinner.
在一种可能的实施例中,如图5所示,第一虚拟机管理器中包括虚拟中断寄存器10、虚拟时钟寄存器20和MMIO寄存器30,其中,虚拟中断寄存器10用于存储处理器模拟得到的第一机密虚拟机的虚拟中断,虚拟时钟寄存器20用于存储处理器模拟得到的供第一机密虚拟机使用的虚拟时钟,MMIO寄存器30用于存储处理器模拟得到的供第一机密虚拟机使用的MMIO信息。处理器将虚拟中断、虚拟时钟以及MMIO信息等注入第一机密虚拟机的过程可以为:处理器在EL3下运行第一虚拟机管理器中的对应寄存器触发中 断生成中断信号,并发送中断信号给第一机密虚拟机,第一机密虚拟机在接收到中断信号后,基于中断信号从第一虚拟机管理器中的对应寄存器读取需要处理的中断信息。可以理解,由于处理器是在EL3下运行第一虚拟机管理器,因此第一虚拟机管理器基于中断信号从第一虚拟机管理器中的对应寄存器读取需要处理的中断信息时,所执行的指令为SMC类型的指令。In a possible embodiment, as shown in FIG5 , the first virtual machine manager includes a virtual interrupt register 10, a virtual clock register 20 and an MMIO register 30, wherein the virtual interrupt register 10 is used to store the virtual interrupt of the first confidential virtual machine simulated by the processor, the virtual clock register 20 is used to store the virtual clock for use by the first confidential virtual machine simulated by the processor, and the MMIO register 30 is used to store the MMIO information for use by the first confidential virtual machine simulated by the processor. The process of the processor injecting the virtual interrupt, virtual clock and MMIO information into the first confidential virtual machine can be: the processor runs the corresponding register in the first virtual machine manager under EL3 to trigger the The processor generates an interrupt signal and sends the interrupt signal to the first confidential virtual machine. After receiving the interrupt signal, the first confidential virtual machine reads the interrupt information to be processed from the corresponding register in the first virtual machine manager based on the interrupt signal. It can be understood that since the processor runs the first virtual machine manager under EL3, when the first virtual machine manager reads the interrupt information to be processed from the corresponding register in the first virtual machine manager based on the interrupt signal, the instruction executed is an SMC type instruction.
在一种可能的实施例中,如图5所示,第一虚拟机管理器还包括虚拟机管理模块40、内存管理模块50、异常处理模块60和远程证明模块70。虚拟机管理模块40用于执行上述S401和S402中所述在TEE侧创建并启动第一机密虚拟机的操作、上述①中所述的对第一机密虚拟机的生命周期进行管理的操作以及②中所述的对第一机密虚拟机上的APP进行管理的操作;内存管理模块50用于执行上述③中所述的对第一机密虚拟机的内存进行管理的操作;异常处理模块60用于执行上述④中所述的对第一机密虚拟机的异常进行处理的操作,可选地,异常处理模块60也可用于执行④中所述的对第一机密虚拟机的上下文进行管理的操作;远程证明模块70用于执行上述⑤中所述的对第一机密虚拟机的安全性进行检查以及对计算设备300的安全性进行检查的操作,具体可以参见上文相关描述,为了说明书的简洁,此处不再展开赘述。In a possible embodiment, as shown in FIG5 , the first virtual machine manager further includes a virtual machine management module 40, a memory management module 50, an exception handling module 60, and a remote attestation module 70. The virtual machine management module 40 is used to perform the operations of creating and starting the first confidential virtual machine on the TEE side as described in S401 and S402 above, the operations of managing the life cycle of the first confidential virtual machine as described in ① above, and the operations of managing the APP on the first confidential virtual machine as described in ② above; the memory management module 50 is used to perform the operations of managing the memory of the first confidential virtual machine as described in ③ above; the exception handling module 60 is used to perform the operations of handling the exceptions of the first confidential virtual machine as described in ④ above, and optionally, the exception handling module 60 can also be used to perform the operations of managing the context of the first confidential virtual machine as described in ④ above; the remote attestation module 70 is used to perform the operations of checking the security of the first confidential virtual machine as described in ⑤ above and checking the security of the computing device 300, which can be specifically referred to the relevant description above, and for the sake of brevity of the specification, it will not be elaborated here.
应理解,图5所示的第一虚拟机管理器中的各个模块的名称仅仅是作为示例,例如虚拟机管理模块40还可以称为第一机密虚拟机管理模块,远程证明模块70还可以称为安全检查模块等,不应视为对第一虚拟机管理器中各个模块的名称的具体限定。It should be understood that the names of the various modules in the first virtual machine manager shown in Figure 5 are merely examples. For example, the virtual machine management module 40 can also be called a first confidential virtual machine management module, the remote attestation module 70 can also be called a security check module, etc., and should not be regarded as specific limitations on the names of the various modules in the first virtual machine manager.
具体实现中,上述计算设备300的处理器在REE侧执行的操作可以由处理器运行REE侧的第二虚拟机管理器执行实现。In a specific implementation, the operations performed by the processor of the computing device 300 on the REE side may be implemented by the processor running a second virtual machine manager on the REE side.
需要说明的,计算设备300的处理器除了执行上述操作之外,还可以执行其他操作,如创建、修改以及销毁REE侧的二级页表,如模拟得到供第一机密虚拟机使用的虚拟化I/O设备如虚拟磁盘、VNIC等,本申请不对计算设备300的处理器能够执行的操作进行具体限定。It should be noted that in addition to performing the above operations, the processor of the computing device 300 can also perform other operations, such as creating, modifying and destroying the secondary page table on the REE side, such as simulating virtualized I/O devices such as virtual disks, VNICs, etc. for use by the first confidential virtual machine. This application does not specifically limit the operations that the processor of the computing device 300 can perform.
为了便于更清楚地了解第一机密虚拟机的创建和运行的过程,下面从第二虚拟机管理器如KVM视角描述第一机密虚拟机的创建和运行过程,参见图6。In order to more clearly understand the process of creating and running the first confidential virtual machine, the process of creating and running the first confidential virtual machine is described below from the perspective of the second virtual machine manager such as KVM, see FIG. 6 .
如图6所示,该过程包括如下步骤:As shown in Figure 6, the process includes the following steps:
S601:第二虚拟机管理器获取创建指令,创建指令携带待创建的第一机密虚拟机的配置信息,配置信息包括分配给第一机密虚拟机的内存信息、供第一机密虚拟机使用的虚拟处理器核信息、操作系统内核和文件系统。S601: The second virtual machine manager obtains a creation instruction, where the creation instruction carries configuration information of a first confidential virtual machine to be created, where the configuration information includes memory information allocated to the first confidential virtual machine, virtual processor core information used by the first confidential virtual machine, an operating system kernel, and a file system.
配置信息还可以包括其他内容,本申请对此不作具体限定。The configuration information may also include other contents, which are not specifically limited in this application.
S602:第二虚拟机管理器调用第一虚拟机管理器提供的内存划分接口,将创建指令携带的内存信息传递给第一虚拟机管理器,使得第一虚拟机管理器基于内存信息在TEE侧的内存资源中划分出供第一机密虚拟机使用的内存。S602: The second virtual machine manager calls the memory partitioning interface provided by the first virtual machine manager, and passes the memory information carried by the creation instruction to the first virtual machine manager, so that the first virtual machine manager divides the memory for use by the first confidential virtual machine in the memory resources on the TEE side based on the memory information.
S603:第二虚拟机管理器调用第一虚拟机管理器提供的虚拟处理器核创建接口,将创建指令携带的虚拟处理器核信息传递给第一虚拟机管理器,使得第一虚拟机管理器基于虚拟处理器核信息模拟出供第一机密虚拟机使用的虚拟机处理器核。S603: The second virtual machine manager calls the virtual processor core creation interface provided by the first virtual machine manager, and passes the virtual processor core information carried by the creation instruction to the first virtual machine manager, so that the first virtual machine manager simulates a virtual machine processor core for use by the first confidential virtual machine based on the virtual processor core information.
S604:第二虚拟机管理器调用第一虚拟机管理器提供的通信接口,将供第一机密虚拟机使用的操作系统内核和文件系统传递给第一虚拟机管理器,使得第一虚拟机管理器将供第一机密虚拟机使用的操作系统内核和文件系统存储至上述供第一机密虚拟机使用的内存。S604: The second virtual machine manager calls the communication interface provided by the first virtual machine manager to pass the operating system kernel and the file system for use by the first confidential virtual machine to the first virtual machine manager, so that the first virtual machine manager stores the operating system kernel and the file system for use by the first confidential virtual machine in the above-mentioned memory for use by the first confidential virtual machine.
S605:第二虚拟机管理器调用第一虚拟机管理器提供的虚拟机运行接口,将第一机密虚拟机的虚拟中断、虚拟时钟和MMIO信息传递给第一虚拟机管理器,使得第一虚拟机管理器将虚拟中断、虚拟时钟和MMIO信息注入第一机密虚拟机,并启动运行第一机密虚拟机。S605: The second virtual machine manager calls the virtual machine running interface provided by the first virtual machine manager, and passes the virtual interrupt, virtual clock and MMIO information of the first confidential virtual machine to the first virtual machine manager, so that the first virtual machine manager injects the virtual interrupt, virtual clock and MMIO information into the first confidential virtual machine, and starts running the first confidential virtual machine.
S606:第二虚拟机管理器接收第一虚拟机管理器转发的来自第一机密虚拟机的异常处理指令。S606: The second virtual machine manager receives the exception handling instruction from the first confidential virtual machine forwarded by the first virtual machine manager.
S607:第二虚拟机管理器根据异常处理指令处理第一机密虚拟机出现的异常。S607: The second virtual machine manager handles the exception occurring in the first confidential virtual machine according to the exception handling instruction.
S608:第二虚拟机管理器在处理完第一机密虚拟机的异常时,重新调用第一虚拟机管理器提供的虚拟机运行接口,使得第一虚拟机管理器恢复第一机密虚拟机的运行。S608: After processing the exception of the first confidential virtual machine, the second virtual machine manager calls the virtual machine running interface provided by the first virtual machine manager again, so that the first virtual machine manager resumes the running of the first confidential virtual machine.
在本申请具体的实施例中,当计算设备300的处理器需要模拟得到供第一机密虚拟机使用的虚拟化I/O设备时,可以通过VirtIO技术实现。In a specific embodiment of the present application, when the processor of the computing device 300 needs to simulate a virtualized I/O device for use by the first confidential virtual machine, it can be achieved through VirtIO technology.
在计算设备300通过VirtIO技术模拟得到供第一机密虚拟机使用的虚拟化I/O设备时,如图7所示TEE侧的第一机密虚拟机的操作系统内核中包括VirtIO前端驱动程序,第二虚拟机管理器如KVM中包括VirtIO后端驱动程序,第一虚拟机管理器中除了包括图5所示的各个模块之外,还可以包括内存同步模块,TEE 侧的内存资源中包括用于VirtIO前端驱动程序和VirtIO后端驱动程序进行数据传输的第一内存(VRING)(图7未示出),REE侧的内存资源中包括与第一内存存在映射关系的第二内存(图7未示出)。第二内存可以视为第一内存的影子内存,第二内存通常与第一内存的大小相同。When the computing device 300 obtains a virtualized I/O device for use by the first confidential virtual machine through VirtIO technology simulation, as shown in FIG7 , the operating system kernel of the first confidential virtual machine on the TEE side includes a VirtIO front-end driver, and the second virtual machine manager such as KVM includes a VirtIO back-end driver. In addition to the modules shown in FIG5 , the first virtual machine manager may also include a memory synchronization module. The TEE The memory resources on the REE side include a first memory (VRING) (not shown in FIG. 7 ) used for data transmission between the VirtIO front-end driver and the VirtIO back-end driver, and the memory resources on the REE side include a second memory (not shown in FIG. 7 ) that has a mapping relationship with the first memory. The second memory can be regarded as a shadow memory of the first memory, and the second memory is usually the same size as the first memory.
在图7所示的计算设备300中,具体地,计算设备300的处理器可以运行VirtIO后端驱动程序创建虚拟化I/O设备,然后在启动第一机密虚拟机后,运行第一机密虚拟机中的VirtIO前端驱动程序加载虚拟化I/O设备,从而实现虚拟化I/O设备的模拟。这样一来,计算设备300便可以通过VirtIO技术实现第一机密虚拟机的I/O通信。In the computing device 300 shown in FIG7 , specifically, the processor of the computing device 300 can run the VirtIO backend driver to create a virtualized I/O device, and then after starting the first confidential virtual machine, run the VirtIO front-end driver in the first confidential virtual machine to load the virtualized I/O device, thereby realizing the simulation of the virtualized I/O device. In this way, the computing device 300 can realize the I/O communication of the first confidential virtual machine through the VirtIO technology.
内存同步模块用于计算设备300通过VirtIO技术实现第一机密虚拟机的I/O通信操作过程中,将第一内存中的VirtIO前端驱动程序需发送给VirtIO后端驱动程序的数据(以下称为第一数据)同步至第二内存,以及用于将第二内存中的VirtIO后端驱动程序需发送给VirtIO前端驱动程序的数据(以下称为第二数据)同步至第一内存。其中,第一数据也可以理解为第一机密虚拟机需要传递给计算设备300的外部网络的数据,第二数据也可以理解为第一机密虚拟机需要接收的来自计算设备300的外部网络的数据。The memory synchronization module is used to synchronize the data (hereinafter referred to as the first data) that the VirtIO front-end driver needs to send to the VirtIO back-end driver in the first memory to the second memory during the I/O communication operation of the first confidential virtual machine implemented by the computing device 300 through the VirtIO technology, and to synchronize the data (hereinafter referred to as the second data) that the VirtIO back-end driver needs to send to the VirtIO front-end driver in the second memory to the first memory. The first data can also be understood as the data that the first confidential virtual machine needs to transmit to the external network of the computing device 300, and the second data can also be understood as the data that the first confidential virtual machine needs to receive from the external network of the computing device 300.
可以看出,在本申请提供的计算设备300以及虚拟机实现方法中,由于计算设备300的处理器是在EL3下运行第一虚拟机管理器启动第一机密虚拟机,第一机密虚拟机部署于TEE侧,因此该虚拟机可以通过第一虚拟机管理器与主机操作系统内核(位于REE侧)隔离,也就是说,该虚拟机受EL3下的第一虚拟机管理器保护,能够避免被REE侧的主机操作系统内核访问,故攻击者即便攻破了主机操作系统内核,攻击者也不能通过主机操作系统内核中的虚拟机管理器如KVM操控该虚拟机,从而起到保护计算设备中虚拟机的安全的作用,进而起到保护虚拟机中的用户数据的安全性的作用。It can be seen that in the computing device 300 and the virtual machine implementation method provided in the present application, since the processor of the computing device 300 runs the first virtual machine manager under EL3 to start the first confidential virtual machine, and the first confidential virtual machine is deployed on the TEE side, the virtual machine can be isolated from the host operating system kernel (located on the REE side) through the first virtual machine manager. In other words, the virtual machine is protected by the first virtual machine manager under EL3 and can avoid being accessed by the host operating system kernel on the REE side. Therefore, even if the attacker breaks into the host operating system kernel, the attacker cannot control the virtual machine through the virtual machine manager in the host operating system kernel, such as KVM, thereby protecting the security of the virtual machine in the computing device, and then protecting the security of user data in the virtual machine.
应理解,上述实施例中各步骤的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
上文详细阐述了本申请提供的虚拟机实现方法,基于相同的发明构思,下面继续介绍本申请提供的虚拟机实现装置和计算设备。The above describes in detail the virtual machine implementation method provided by the present application. Based on the same inventive concept, the following further describes the virtual machine implementation apparatus and computing device provided by the present application.
应理解,虚拟机实现装置内部的单元模块也可以有多种划分,各个模块可以是软件模块,也可以是硬件模块,也可以部分是软件模块部分是硬件模块,本申请不对其进行限制。当虚拟机实现装置包括多个单元模块时,该多个单元模块中的各个模块可以部署于同一个计算设备上。It should be understood that the unit modules within the virtual machine implementation device may also be divided into multiple types, and each module may be a software module, a hardware module, or partly a software module and partly a hardware module, and this application does not limit it. When the virtual machine implementation device includes multiple unit modules, each of the multiple unit modules may be deployed on the same computing device.
参见图8,图8为本申请示例性示出的一种虚拟机实现装置800的结构示意图,可以应用于图3所示的硬件资源被划分为REE侧和TEE侧的计算设备300,如图8所示,虚拟机实现装置800包括:处理模块810。下面对虚拟机实现装置800的各个模块的功能进行示例性地介绍。应理解,以下所举例描述的各个模块的功能仅是虚拟机实现装置800在本申请的一些实施例中可以具有的功能,本申请并不对各个模块具有的功能进行限定。Referring to FIG8 , FIG8 is a schematic diagram of the structure of a virtual machine implementation device 800 exemplarily shown in the present application, which can be applied to the computing device 300 whose hardware resources are divided into the REE side and the TEE side as shown in FIG3 . As shown in FIG8 , the virtual machine implementation device 800 includes: a processing module 810. The functions of each module of the virtual machine implementation device 800 are exemplarily introduced below. It should be understood that the functions of each module described below are only the functions that the virtual machine implementation device 800 can have in some embodiments of the present application, and the present application does not limit the functions of each module.
处理模块810用于在EL3下运行第一虚拟机管理器启动第一虚拟机,该第一虚拟机部署于上述TEE侧。The processing module 810 is used to run a first virtual machine manager under EL3 to start a first virtual machine, where the first virtual machine is deployed on the TEE side.
在该实施例中,第一虚拟机可以理解为上述第一机密虚拟机。In this embodiment, the first virtual machine can be understood as the first confidential virtual machine mentioned above.
在一些可能的实施例中,如图8所示,装置800还包括获取模块820;In some possible embodiments, as shown in FIG8 , the apparatus 800 further includes an acquisition module 820;
获取模块820用于在REE侧获取加密的用户数据;The acquisition module 820 is used to acquire encrypted user data on the REE side;
处理模块810还用于在EL3下运行第一虚拟机管理器,获取TEE侧存储的解密密钥,并使用解密密钥对加密的用户数据进行解密,得到用户数据明文;The processing module 810 is further used to run the first virtual machine manager under EL3, obtain the decryption key stored on the TEE side, and use the decryption key to decrypt the encrypted user data to obtain the user data plaintext;
处理模块810还用于运行第一虚拟机处理上述用户数据明文。The processing module 810 is further configured to run the first virtual machine to process the above-mentioned user data plaintext.
在一些可能的实施例中,上述获取模块820还用于在REE侧获取创建指令,创建指令携带待创建的第一虚拟机的配置信息;上述处理模块810还用于在EL3下运行第一虚拟机管理器,根据创建指令携带的配置信息在TEE侧创建第一虚拟机。In some possible embodiments, the acquisition module 820 is also used to acquire a creation instruction on the REE side, where the creation instruction carries configuration information of the first virtual machine to be created; the processing module 810 is also used to run the first virtual machine manager under EL3, and create the first virtual machine on the TEE side according to the configuration information carried by the creation instruction.
在一些可能的实施例中,上述获取模块820还用于在REE侧模拟得到第一数据,第一数据包括如下一种或任意组合:第一虚拟机的虚拟中断、供第一虚拟机使用的虚拟时钟以及供第一虚拟机使用的MMIO信息;上述处理模块810还用于将第一数据写入第一虚拟机管理器;上述处理模块810还用于在EL3下运行第一虚拟机管理器,将第一数据注入第一虚拟机;上述处理模块810还用于根据第一数据运行第一虚拟机。In some possible embodiments, the acquisition module 820 is further used to simulate and obtain the first data on the REE side, where the first data includes one or any combination of the following: a virtual interrupt of the first virtual machine, a virtual clock used by the first virtual machine, and MMIO information used by the first virtual machine; the processing module 810 is further used to write the first data into the first virtual machine manager; the processing module 810 is further used to run the first virtual machine manager under EL3 and inject the first data into the first virtual machine; the processing module 810 is further used to run the first virtual machine according to the first data.
在一些可能的实施例中,上述处理模块810还用于在EL3下运行第一虚拟机管理器,确定第一虚拟机是否为安全虚拟机,在确定第一虚拟机是安全虚拟机的情况下,启动第一虚拟机,在确定第一虚拟机是非安全虚拟机的情况下,不启动第一虚拟机。In some possible embodiments, the processing module 810 is also used to run the first virtual machine manager under EL3 to determine whether the first virtual machine is a secure virtual machine. If the first virtual machine is determined to be a secure virtual machine, the first virtual machine is started; if the first virtual machine is determined to be a non-secure virtual machine, the first virtual machine is not started.
在一些可能的实施例中,上述处理模块810还用于在EL3下运行第一虚拟机管理器,确定上述计算设 备是否为安全设备,在确定计算设备是安全设备的情况下,启动第一虚拟机,在确定计算设备是非安全设备的情况下,不启动第一虚拟机。In some possible embodiments, the processing module 810 is further configured to run the first virtual machine manager under EL3 to determine the computing device The computing device is determined to be a security device. If the computing device is determined to be a security device, the first virtual machine is started; if the computing device is determined to be a non-security device, the first virtual machine is not started.
在一些可能的实施例中,上述获取模块820还用于在REE侧获取针对第一虚拟机的生命周期的第一管理命令;上述处理模块810还用于在EL3下运行第一虚拟机管理器,根据第一管理命令对第一虚拟机执行以下操作的一种或任意组合:开机、关机、更改规格、迁移和释放。In some possible embodiments, the acquisition module 820 is also used to acquire a first management command for the life cycle of the first virtual machine on the REE side; the processing module 810 is also used to run the first virtual machine manager under EL3, and perform one or any combination of the following operations on the first virtual machine according to the first management command: power on, power off, change specifications, migrate, and release.
在一些可能的实施例中,上述第一获取模块820还用于在REE侧获取针对第一虚拟机的第二管理命令;上述处理模块810还用于在EL3下运行第一虚拟机管理器,根据第二管理命令对第一虚拟机执行以下操作的一种或任意组合:安装、启动、关闭、升级、卸载和迁移应用程序。In some possible embodiments, the first acquisition module 820 is further used to acquire a second management command for the first virtual machine on the REE side; the processing module 810 is further used to run the first virtual machine manager under EL3, and perform one or any combination of the following operations on the first virtual machine according to the second management command: install, start, shut down, upgrade, uninstall and migrate applications.
在一些可能的实施例中,上述处理模块810还用于:在第一虚拟机出现异常时,在EL3下运行第一虚拟机管理器建立第一虚拟机的上下文,处理第一虚拟机出现的异常,在处理完第一虚拟机出现的异常时,将第一虚拟机的上下文恢复至第一虚拟机,以恢复运行第一虚拟机。In some possible embodiments, the processing module 810 is also used to: when an exception occurs in the first virtual machine, run the first virtual machine manager under EL3 to establish the context of the first virtual machine, handle the exception that occurs in the first virtual machine, and after handling the exception that occurs in the first virtual machine, restore the context of the first virtual machine to the first virtual machine to resume the operation of the first virtual machine.
在一些可能的实施例中,在第一虚拟机出现的异常为缺页异常、MMIO操作异常或者数据终止同步异常时,上述处理模块810用于在EL3下运行第一虚拟机管理器,接收第一虚拟机发送的缺页异常处理指令、MMIO操作异常处理指令或者数据终止同步异常处理指令,并根据缺页异常处理指令处理第一虚拟机出现的缺页异常,或者,根据MMIO操作异常处理指令,处理第一虚拟机出现的MMIO操作异常,或者,根据数据终止同步异常处理指令,处理第一虚拟机出现的数据终止同步异常。其中,缺页异常处理指令、MMIO操作指令或者数据终止同步异常处理指令为SMC类型的指令,MMIO操作异常为第一虚拟机进行MMIO操作时引起的异常。In some possible embodiments, when the exception of the first virtual machine is a page fault exception, an MMIO operation exception, or a data termination synchronization exception, the processing module 810 is used to run the first virtual machine manager under EL3, receive a page fault exception processing instruction, an MMIO operation exception processing instruction, or a data termination synchronization exception processing instruction sent by the first virtual machine, and process the page fault exception of the first virtual machine according to the page fault exception processing instruction, or process the MMIO operation exception of the first virtual machine according to the MMIO operation exception processing instruction, or process the data termination synchronization exception of the first virtual machine according to the data termination synchronization exception processing instruction. Wherein, the page fault exception processing instruction, the MMIO operation instruction, or the data termination synchronization exception processing instruction is an SMC type instruction, and the MMIO operation exception is an exception caused when the first virtual machine performs an MMIO operation.
在一些可能的实施例中,上述处理模块810还用于在EL3下运行第一虚拟机管理器,执行以下操作中的一种或任意组合:创建、更改或者销毁第一虚拟机的一级页表,第一虚拟机的一级页表为将第一虚拟机的VA映射为计算设备中为第一虚拟机分配的PA的页表。In some possible embodiments, the processing module 810 is also used to run the first virtual machine manager under EL3, and perform one or any combination of the following operations: create, change or destroy the first-level page table of the first virtual machine, where the first-level page table of the first virtual machine is a page table that maps the VA of the first virtual machine to the PA allocated to the first virtual machine in the computing device.
在一些可能的实施例中,上述REE侧包括第二虚拟机管理器,上述第一虚拟机管理器中部署有VirtIO前端驱动程序,第二虚拟机管理器部署有VirtIO后端驱动程序,第一虚拟机管理器部署有内存同步模块,TEE侧包括用于VirtIO前端驱动程序与VirtIO后端驱动程序进行数据传输的第一内存,REE侧包括第二内存,内存同步模块包括第一内存和第二内存的映射关系;上述处理模块810用于运行内存同步模块根据第一内存和第二内存的映射关系,将第一内存中的第一数据同步至第二内存,第一数据为VirtIO前端驱动程序需发送给VirtIO后端驱动程序的数据,或者,处理模块810用于运行内存同步模块根据第一内存和第二内存的映射关系,将第二内存中的第二数据同步至第一内存,第二数据为VirtIO前端驱动程序需接收的来自VirtIO后端驱动程序的数据。In some possible embodiments, the REE side includes a second virtual machine manager, a VirtIO front-end driver is deployed in the first virtual machine manager, a VirtIO back-end driver is deployed in the second virtual machine manager, a memory synchronization module is deployed in the first virtual machine manager, the TEE side includes a first memory for data transmission between the VirtIO front-end driver and the VirtIO back-end driver, the REE side includes a second memory, and the memory synchronization module includes a mapping relationship between the first memory and the second memory; the processing module 810 is used to run the memory synchronization module to synchronize first data in the first memory to the second memory according to the mapping relationship between the first memory and the second memory, and the first data is data that the VirtIO front-end driver needs to send to the VirtIO back-end driver, or the processing module 810 is used to run the memory synchronization module to synchronize second data in the second memory to the first memory according to the mapping relationship between the first memory and the second memory, and the second data is data from the VirtIO back-end driver that the VirtIO front-end driver needs to receive.
具体地,上述虚拟机实现装置800执行各种操作的具体实现,可参照上述虚拟机实现方法实施例中相关内容中的描述,为了说明书的简洁,这里不再赘述。Specifically, the specific implementation of various operations performed by the virtual machine implementation device 800 can refer to the description in the relevant content of the above-mentioned virtual machine implementation method embodiment, and for the sake of brevity of the specification, it will not be repeated here.
参见图9,图9为本申请提供的另一种计算设备300的结构示意图,计算设备300包括:处理器310、内存单元320、通信接口330、存储器340、输入设备350和输出设备360,其中,处理器310、内存单元320、通信接口330、存储器340、输入设备350、输出设备360之间可以通过总线370相互连接。其中,Referring to FIG. 9 , FIG. 9 is a schematic diagram of the structure of another computing device 300 provided by the present application, wherein the computing device 300 includes: a processor 310, a memory unit 320, a communication interface 330, a memory 340, an input device 350, and an output device 360, wherein the processor 310, the memory unit 320, the communication interface 330, the memory 340, the input device 350, and the output device 360 can be interconnected via a bus 370.
处理器310可以读取内存单元320中存储的程序代码(包括指令),执行内存单元320中存储的程序代码,使得计算设备300执行上述方法实施例提供的虚拟机实现方法中的步骤。The processor 310 can read the program code (including instructions) stored in the memory unit 320 and execute the program code stored in the memory unit 320, so that the computing device 300 executes the steps in the virtual machine implementation method provided in the above method embodiment.
处理器310可以有多种具体实现形式,例如处理器310可以为至少一个中央处理器(central processing unit,CPU),如图9所示,包括CPU0和CPU1,处理器310还可以为图形处理器(graphics processing unit,GPU)等,处理器310还可以是单核处理器或多核处理器。处理器310可以由CPU和硬件芯片的组合。上述硬件芯片可以是专用集成电路(application-specific integrated circuit,ASIC)实现,或可编程逻辑器件(programmable logic device,PLD)实现。上述PLD可以是复杂程序逻辑器件(complex programmable logical device,CPLD)、现场可编程门阵列(field-programmable gate array,FPGA)、通用阵列逻辑(generic array logic,GAL)或其任意组合实现。处理器310也可以单独采用内置处理逻辑的逻辑器件来实现,例如FPGA或数字信号处理器(digital signal processing,DSP)等。The processor 310 may have a variety of specific implementation forms. For example, the processor 310 may be at least one central processing unit (CPU), as shown in FIG9 , including CPU0 and CPU1. The processor 310 may also be a graphics processing unit (GPU), etc. The processor 310 may also be a single-core processor or a multi-core processor. The processor 310 may be a combination of a CPU and a hardware chip. The above-mentioned hardware chip may be implemented by an application-specific integrated circuit (ASIC) or a programmable logic device (PLD). The above-mentioned PLD may be a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL) or any combination thereof. The processor 310 may also be implemented by a logic device with built-in processing logic, such as an FPGA or a digital signal processor (DSP).
内存单元320用于存储内核、程序代码以及处理器310在执行内存单元320中存储的程序代码时所产生的程序数据。其中,程序代码包括:获取模块820的代码和处理模块810的代码等,程序数据包括:用户数据、第一机密虚拟机的配置信息、第一机密虚拟机对用户数据进行处理得到的处理结果等等。The memory unit 320 is used to store the kernel, program code, and program data generated when the processor 310 executes the program code stored in the memory unit 320. The program code includes: the code of the acquisition module 820 and the code of the processing module 810, etc. The program data includes: user data, configuration information of the first confidential virtual machine, and processing results obtained by the first confidential virtual machine processing the user data, etc.
通信接口330可以为有线接口(例如以太网接口、光纤接口、其他类型接口(例如,无限带宽技术(infiniBand,IB)接口))或无线接口(例如蜂窝网络接口或使用无线局域网接口),用于与其他计算设备 或装置进行通信。当通信接口330为有线接口时,通信接口330可以采用传输控制协议/网际协议(transmission control protocol/internet protocol,TCP/IP)之上的协议族,例如,远程函数调用(remote function call,RFC)协议、简单对象访问协议(simple object access protocol,SOAP)协议、简单网络管理协议(simple network management protocol,SNMP)协议、公共对象请求代理体系结构(common object request broker architecture,CORBA)协议以及分布式协议等等。The communication interface 330 may be a wired interface (e.g., an Ethernet interface, a fiber optic interface, other types of interfaces (e.g., an infinite bandwidth technology (infiniBand, IB) interface)) or a wireless interface (e.g., a cellular network interface or a wireless local area network interface) for communicating with other computing devices. When the communication interface 330 is a wired interface, the communication interface 330 may adopt a protocol family above the transmission control protocol/internet protocol (TCP/IP), such as the remote function call (RFC) protocol, the simple object access protocol (SOAP) protocol, the simple network management protocol (SNMP) protocol, the common object request broker architecture (CORBA) protocol, and distributed protocols, etc.
存储器340可以是非易失性存储器,例如,只读存储器(read-only memory,ROM)、可编程只读存储器(programmable ROM,PROM)、可擦除可编程只读存储器(erasable PROM,EPROM)、电可擦除可编程只读存储器(electrically EPROM,EEPROM)或闪存。存储器340也可以是易失性存储器,易失性存储器可以是随机存取存储器(random access memory,RAM),其用作外部高速缓存。The memory 340 may be a non-volatile memory, such as a read-only memory (ROM), a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), or a flash memory. The memory 340 may also be a volatile memory, which may be a random access memory (RAM) used as an external cache.
输入设备350可以包括鼠标以及键盘等等。用户可以通过输入设备350向计算设备300输入数据或指令,如上述待处理数据、机密虚拟机的配置信息、第一管理指令、第二管理指令等等。The input device 350 may include a mouse and a keyboard, etc. The user may input data or instructions to the computing device 300 through the input device 350, such as the above-mentioned data to be processed, configuration information of the confidential virtual machine, the first management instruction, the second management instruction, etc.
输出设备360可以包括显示器,计算设备300可以通过显示器向用户提供数据,如上文所述向用户提供机密虚拟机对待处理数据进行处理后的结果等等。显示器可包括阴极射线管显示器(cathode ray tube,CRT),等离子显示器(plasma display panel,PDP),液晶显示器(liquid crystal display,LCD)等等。以显示器为LCD为例,液晶显示包括液晶面板以及背光模组,其中,液晶显示面板包括偏振膜、玻璃基板、黑色矩阵、彩色滤光片、保护膜、普通电极、校准层、液晶层(液晶、间隔、密封剂)、电容、显示电极、棱镜层、散光层。背光模组包括:照明光源、反射板、导光板、扩散片、增亮膜(棱镜片)及框架等等。The output device 360 may include a display, and the computing device 300 may provide data to the user through the display, such as providing the user with the result of the confidential virtual machine processing the data to be processed, etc. The display may include a cathode ray tube display (CRT), a plasma display panel (PDP), a liquid crystal display (LCD), etc. Taking the display as an LCD as an example, the liquid crystal display includes a liquid crystal panel and a backlight module, wherein the liquid crystal display panel includes a polarizing film, a glass substrate, a black matrix, a color filter, a protective film, a common electrode, a calibration layer, a liquid crystal layer (liquid crystal, a spacer, a sealant), a capacitor, a display electrode, a prism layer, and a light diffusion layer. The backlight module includes: an illumination light source, a reflector, a light guide plate, a diffuser, a brightness enhancement film (prism sheet) and a frame, etc.
总线370可以是PCIE或扩展工业标准结构(extended industry standard architecture,简称EISA)总线等。上述总线370可以分为地址总线、数据总线、控制总线等。为便于表示,图9中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。The bus 370 may be a PCIE or an extended industry standard architecture (EISA) bus, etc. The bus 370 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, FIG9 only uses one thick line, but does not mean that there is only one bus or one type of bus.
应理解,本申请实施例的计算设备300可对应于本申请实施例中的包括虚拟机实现装置800的计算设备,并可以对应于执行本申请实施例中图4A、图4B、图6所示方法中相应主体,并且计算设备300中的各个模块的操作和/或功能分别为了实现图4A、图4B、图6所示方法的相应流程,为了简洁,在此不再赘述。It should be understood that the computing device 300 of the embodiment of the present application may correspond to the computing device including the virtual machine implementation device 800 in the embodiment of the present application, and may correspond to the execution of the corresponding subjects in the method shown in Figures 4A, 4B, and 6 in the embodiment of the present application, and the operations and/or functions of each module in the computing device 300 are respectively for implementing the corresponding processes of the method shown in Figures 4A, 4B, and 6, which will not be repeated here for the sake of brevity.
应当理解,计算设备300仅为本申请实施例提供的一个示例,并且,计算设备300可具有比图9示出的部件更多或更少的部件,可以组合两个或更多个部件,或者可具有部件的不同配置实现。It should be understood that computing device 300 is only an example provided in an embodiment of the present application, and computing device 300 may have more or fewer components than those shown in FIG. 9 , may combine two or more components, or may have different configurations of components.
本申请还提供一种计算机可读存储介质,计算机可读存储介质中存储有指令,该指令被运行时可以实现上述实施例中记载的虚拟机实现方法的部分或者全部步骤。The present application also provides a computer-readable storage medium, in which instructions are stored. When the instructions are executed, some or all of the steps of the virtual machine implementation method recorded in the above embodiment can be implemented.
本申请还提供一种计算机程序产品,当计算机程序产品被计算机读取并执行时,可以实现上述方法实施例中记载的虚拟机实现方法的部分或者全部步骤。The present application also provides a computer program product. When the computer program product is read and executed by a computer, it can implement some or all of the steps of the virtual machine implementation method recorded in the above method embodiment.
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其它实施例的相关描述。In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
在上述实施例中,可以全部或部分地通过软件、硬件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本申请实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线)或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质(例如软盘、硬盘、磁带)、光介质,或者半导体介质等。In the above embodiments, it can be implemented in whole or in part by software, hardware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integration. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium, or a semiconductor medium, etc.
以上所述,仅为本申请的具体实施方式。熟悉本技术领域的技术人员根据本申请提供的具体实施方式,可想到变化或替换,都应涵盖在本申请的保护范围之内。 The above is only a specific implementation of the present application. Those skilled in the art may conceive of changes or substitutions based on the specific implementation provided by the present application, which should all be included in the protection scope of the present application.
Claims (14)
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202310963299.XA CN119440714A (en) | 2023-07-31 | 2023-07-31 | Virtual machine implementation method, device and computer readable storage medium |
| CN202310963299.X | 2023-07-31 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2025026051A1 true WO2025026051A1 (en) | 2025-02-06 |
Family
ID=94393743
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2024/105493 Pending WO2025026051A1 (en) | 2023-07-31 | 2024-07-15 | Implementation method and apparatus for virtual machine, and computer-readable storage medium |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN119440714A (en) |
| WO (1) | WO2025026051A1 (en) |
Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| KR20180102439A (en) * | 2017-03-07 | 2018-09-17 | 한국과학기술원 | Method and Apparatus for providing a private execution environment using ARM TrustZone |
| CN115016886A (en) * | 2021-12-31 | 2022-09-06 | 荣耀终端有限公司 | Service processing method and device |
| CN115344871A (en) * | 2022-08-17 | 2022-11-15 | 上海交通大学 | Confidential computing environment construction method and system based on ARM architecture |
| CN116502214A (en) * | 2023-04-21 | 2023-07-28 | 麒麟软件有限公司 | Virtual safety peripheral management and control method, system and medium based on trusted execution environment |
| CN116881987A (en) * | 2023-06-28 | 2023-10-13 | 华为技术有限公司 | Method and device for enabling PCIE equipment to pass through virtual machine and related equipment |
Family Cites Families (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US11550609B2 (en) * | 2020-01-16 | 2023-01-10 | Vmware, Inc. | Unified hypercall interface across processors in virtualized computing systems |
| CN112363797B (en) * | 2020-10-19 | 2022-04-05 | 海光信息技术股份有限公司 | Virtual machine safe operation method, electronic equipment and storage medium |
| CN116484438B (en) * | 2022-01-17 | 2024-07-02 | 荣耀终端有限公司 | Information processing method and device |
| CN115357334A (en) * | 2022-07-27 | 2022-11-18 | 阿里巴巴(中国)有限公司 | MMIO processing method and device |
-
2023
- 2023-07-31 CN CN202310963299.XA patent/CN119440714A/en active Pending
-
2024
- 2024-07-15 WO PCT/CN2024/105493 patent/WO2025026051A1/en active Pending
Patent Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| KR20180102439A (en) * | 2017-03-07 | 2018-09-17 | 한국과학기술원 | Method and Apparatus for providing a private execution environment using ARM TrustZone |
| CN115016886A (en) * | 2021-12-31 | 2022-09-06 | 荣耀终端有限公司 | Service processing method and device |
| CN115344871A (en) * | 2022-08-17 | 2022-11-15 | 上海交通大学 | Confidential computing environment construction method and system based on ARM architecture |
| CN116502214A (en) * | 2023-04-21 | 2023-07-28 | 麒麟软件有限公司 | Virtual safety peripheral management and control method, system and medium based on trusted execution environment |
| CN116881987A (en) * | 2023-06-28 | 2023-10-13 | 华为技术有限公司 | Method and device for enabling PCIE equipment to pass through virtual machine and related equipment |
Also Published As
| Publication number | Publication date |
|---|---|
| CN119440714A (en) | 2025-02-14 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US10949247B2 (en) | Systems and methods for auditing a virtual machine | |
| US7950020B2 (en) | Secure operating system switching | |
| US8996864B2 (en) | System for enabling multiple execution environments to share a device | |
| US9575790B2 (en) | Secure communication using a trusted virtual machine | |
| US20140337558A1 (en) | Mediating communication of a universal serial bus device | |
| US10108800B1 (en) | ARM processor-based hardware enforcement of providing separate operating system environments for mobile devices with capability to employ different switching methods | |
| US11200350B2 (en) | Method and apparatus for trusted display on untrusted computing platforms to secure applications | |
| CN101876954B (en) | Virtual machine control system and working method thereof | |
| CN111949369B (en) | Method and system for building a trusted execution environment for graphics processors | |
| WO2025002060A1 (en) | Method and apparatus for pcie device to pass through to virtual machine, and related device | |
| CN114707140A (en) | Kernel architecture based on PKS system | |
| CN118036012A (en) | A trusted execution environment design method and system based on virtual machine manager | |
| WO2025026051A1 (en) | Implementation method and apparatus for virtual machine, and computer-readable storage medium | |
| CN119149163B (en) | Data processing method, device and computer readable storage medium | |
| WO2024217281A1 (en) | Data processing method and apparatus, and computer-readable storage medium | |
| CN105740044A (en) | Method for reducing trusted computing base of host virtual software | |
| KR102833142B1 (en) | Dynamic kernel module protection method of mobile device and system using the same | |
| Chen et al. | DScope: To Reliably and Securely Acquire Live Data from Kernel-Compromised ARM Devices | |
| Danisevskis | Accelerated secure GUI for virtualized mobile handsets | |
| Mallachiev et al. | Protecting Applications from Highly Privileged Malware Using Bare-metal Hypervisor | |
| HK1254084B (en) | System and methods for auditing a virtual machine | |
| Martin | Attacking disk storage using hypervisor-based malware | |
| Wang et al. | SoK: Analysis of Accelerator TEE Designs |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 24848010 Country of ref document: EP Kind code of ref document: A1 |