Security protection method and device for virtual machine control block and related apparatus

By using a dynamically changing virtual machine control block key encryption protection method, the problem of the virtual machine control block key being easily cracked is solved, thereby improving the security of the virtual machine control block and preventing data leakage.

CN115640099BActive Publication Date: 2026-06-02HYGON YUNXIN INTEGRATED CIRCUIT DESIGN (SHANGHAI) CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HYGON YUNXIN INTEGRATED CIRCUIT DESIGN (SHANGHAI) CO LTD
Filing Date
2022-10-21
Publication Date
2026-06-02

AI Technical Summary

Technical Problem

In existing technologies, the encryption protection key for the virtual machine control block is a fixed key, which allows attackers to build a dictionary of ciphertext and plaintext, thereby cracking the virtual machine control block key and posing a risk of leakage.

Method used

By using a dynamically changing virtual machine control block key, the dynamic value associated with the virtual machine control block is determined by obtaining data write commands related to the virtual machine, the virtual machine control block key is derived, and the virtual machine control block data is encrypted using this key.

Benefits of technology

This increases the difficulty for attackers to crack the virtual machine control block key, enhances the security of the virtual machine control block, and ensures the security of stored data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115640099B_ABST
    Figure CN115640099B_ABST
Patent Text Reader

Abstract

The embodiment of the application provides a kind of virtual machine control block security protection method, device and related device, wherein method includes: obtaining the data write command related to virtual machine;If the data write command is used to write the virtual machine control block data of the virtual machine into the virtual machine control block of the virtual machine, determine the dynamically changing numerical value associated with the virtual machine control block;According to the numerical value, derive the virtual machine control block key of the virtual machine control block;Using the virtual machine control block key, the virtual machine control block data is encrypted, and the encrypted virtual machine control block data is written into the virtual machine control block.This embodiment of the application uses dynamically changing virtual machine control block key, and the virtual machine control block data written into virtual machine control block is encrypted and protected, improves the difficulty of attacker to break virtual machine control block key, can improve the security of virtual machine control block, and guarantees the security of the data stored in virtual machine control block.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of virtual machine technology, specifically to a method, apparatus, and related devices for the security protection of a virtual machine control block. Background Technology

[0002] Virtualization technology allows a host machine to virtualize multiple virtual machines (VMs), thereby efficiently utilizing the host's hardware resources. In virtualization, the VMM (Virtual Machine Monitor) used to manage the VMs and the guest operating system share the underlying processor resources. Therefore, the hardware needs to automatically save or restore the runtime context of the VMs through a physical memory area, which can be called the virtual machine control block.

[0003] The virtual machine control block stores confidential data related to the virtual machine. Therefore, how to improve the security of the virtual machine control block has become a technical problem that urgently needs to be solved by those skilled in the art. Summary of the Invention

[0004] In view of this, embodiments of this application provide a method, apparatus, and related devices for the security protection of virtual machine control blocks, so as to improve the security of virtual machine control blocks.

[0005] To achieve the above objectives, the embodiments of this application provide the following technical solutions.

[0006] In a first aspect, embodiments of this application provide a method for security protection of a virtual machine control block, including:

[0007] Write commands to retrieve data related to the virtual machine;

[0008] If the data write command is used to write the virtual machine control block data of the virtual machine to the virtual machine control block, determine the dynamically changing value associated with the virtual machine control block;

[0009] Based on the value, derive the virtual machine control block key of the virtual machine control block;

[0010] The virtual machine control block (VMC) data is encrypted using the VMC key, and the encrypted VMC data is then written into the VMC.

[0011] Secondly, embodiments of this application provide a method for security protection of a virtual machine control block, comprising:

[0012] Commands for retrieving data related to the virtual machine;

[0013] If the data read command is used to read virtual machine control block data from the virtual machine control block of the virtual machine, then the dynamically changing value associated with the virtual machine control block is determined;

[0014] Based on the value, derive the virtual machine control block key of the virtual machine control block;

[0015] The virtual machine control block data in the virtual machine control block is decrypted using the virtual machine control block key, and the decrypted virtual machine control block data is output.

[0016] Thirdly, embodiments of this application provide a security protection device for a virtual machine control block, comprising:

[0017] The write command acquisition module is used to acquire virtual machine-related data and write commands.

[0018] The first value determination module is used to determine a dynamically changing value associated with the virtual machine control block if the data write command is used to write the virtual machine control block data of the virtual machine to the virtual machine control block of the virtual machine.

[0019] The first derivation module is used to derive the virtual machine control block key of the virtual machine control block based on the value;

[0020] An encryption module is used to encrypt the virtual machine control block data using the virtual machine control block key, and write the encrypted virtual machine control block data into the virtual machine control block.

[0021] Fourthly, embodiments of this application provide a security protection device for a virtual machine control block, comprising:

[0022] The read command acquisition module is used to acquire data read commands related to the virtual machine.

[0023] The second value determination module is used to determine the dynamically changing value associated with the virtual machine control block if the data read command is used to read virtual machine control block data from the virtual machine control block of the virtual machine.

[0024] The second derivation module is used to derive the virtual machine control block key of the virtual machine control block based on the value;

[0025] The decryption module is used to decrypt the virtual machine control block data in the virtual machine control block using the virtual machine control block key, and output the decrypted virtual machine control block data.

[0026] Fifthly, embodiments of this application provide a memory controller configured to execute the security protection method for the virtual machine control block as described in the first aspect above, or the security protection method for the virtual machine control block as described in the second aspect above.

[0027] Sixthly, embodiments of this application provide a chip including the memory controller described in the fifth aspect above.

[0028] In a seventh aspect, embodiments of this application provide an electronic device including the chip described in the sixth aspect above.

[0029] In the security protection method for the virtual machine control block provided in this application embodiment, after the memory controller obtains a data write command related to the virtual machine, if it determines that the data write command is used to write the virtual machine control block data of the virtual machine to the virtual machine control block, the memory controller can determine the dynamically changing value associated with the virtual machine control block, and thereby derive a virtual machine control block key for encrypting the virtual machine control block based on the value; then, the memory controller can use the derived virtual machine control block key to encrypt the virtual machine control block data, and write the encrypted virtual machine control block data to the virtual machine control block, thereby achieving secure encryption protection when writing data to the virtual machine control block. Since the value associated with the virtual machine control block is in a dynamically changing state, the virtual machine control block key derived from this value will also change dynamically accordingly; this application embodiment uses a dynamically changing virtual machine control block key to encrypt and protect the virtual machine control block data written to the virtual machine control block, which makes it impossible for attackers to build a dictionary of ciphertext and plaintext by observing the read and write data of the virtual machine control block, increasing the difficulty for attackers to crack the virtual machine control block key, improving the security of the virtual machine control block, and ensuring the security of the data stored in the virtual machine control block. Attached Figure Description

[0030] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0031] Figure 1 This is a schematic diagram of the system architecture for secure virtualization technology.

[0032] Figure 2 This is an example diagram showing the format of a physical address.

[0033] Figure 3 This is an example diagram of C-bit combinations for a two-level page table.

[0034] Figure 4A This is an example diagram for encrypting and protecting the virtual machine control block.

[0035] Figure 4B Example diagram showing how attackers can create dictionaries of ciphertext and plaintext.

[0036] Figure 5 A flowchart illustrating a security protection method for a virtual machine control block provided in an embodiment of this application.

[0037] Figure 6 Another flowchart of the security protection method for the virtual machine control block provided in the embodiments of this application.

[0038] Figure 7 Another flowchart illustrating the security protection method for the virtual machine control block provided in this application embodiment.

[0039] Figure 8 This is another flowchart of a security protection method for a virtual machine control block provided in an embodiment of this application.

[0040] Figure 9A A block diagram of a security protection device for a virtual machine control block provided in an embodiment of this application.

[0041] Figure 9B Another block diagram of the security protection device for the virtual machine control block provided in the embodiments of this application. Detailed Implementation

[0042] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0043] In virtualization technology, virtualized virtual machines can allocate virtual machine memory within physical memory. Each virtual machine's virtual machine memory is primarily used for task consumption and supporting virtualization. To protect the security of virtual machine memory, secure virtualization technology has emerged. This technology allows for the encryption of some or all of the virtual machine's memory, with different virtual machines using different virtual machine keys. Even the virtual machine monitor cannot access these keys, thus preventing the host and virtual machine monitor from accessing or tampering with the virtual machine data in its memory, thereby enhancing the security of virtual machine data.

[0044] To facilitate understanding of secure virtualization technology, Figure 1 An exemplary system architecture diagram of secure virtualization technology is shown, such as... Figure 1As shown, the system architecture for secure virtualization may include: a processor (e.g., a central processing unit CPU) 110, a memory controller 120, physical memory 130, and a security processor 140.

[0045] The processor 110 can configure the virtual machine monitor 111 through software and virtualize multiple virtual machines 112 through virtualization technology. The virtual machine monitor can manage the memory of the virtual machines in the physical memory 130.

[0046] The memory controller 120 is hardware that controls the physical memory 130 and enables data exchange between the physical memory 130 and the processor 110. Part or all of the physical memory 130 can be used as virtual machine memory allocated for virtual machines. In a typical computer system, the memory controller 120 is responsible for handling memory access commands (including commands to read data from memory and write data). For example, if the address corresponding to a memory access command is not recorded in the cache, the memory controller 120 can traverse the page table of memory to find the address and read the corresponding data at that address.

[0047] The security processor 140 is a processor responsible for data security, configured using secure virtualization technology. The virtual machine monitor 111 can be configured with an API (Application Programming Interface) to communicate with the security processor 140, enabling data interaction between the virtual machine monitor 111 and the security processor 140. Simultaneously, the memory controller 120 can be configured with an encryption / decryption engine 121, which stores virtual machine keys used for encrypting and decrypting virtual machine memory. Different virtual machines use different virtual machine keys for encryption and decryption. In one example, the virtual machine key might be a VEK (Virtualization Encrypted Key). The VEK can be programmed by the security processor 140, thereby assigning different VEKs to different virtual machines.

[0048] In secure virtualization technology, a virtual machine's identifier is bound to its virtual machine key. A security processor 140 assigns a virtual machine key to the virtual machine. During the virtual machine's operation after startup, the security processor 140 can use the encryption / decryption engine 121 to encrypt and decrypt the virtual machine's memory using the virtual machine key bound to the virtual machine identifier, thereby achieving secure data isolation between the virtual machine and the host, as well as between different virtual machines. In one example, the virtual machine's identifier can be, for example, the virtual machine's ASID (Address Space ID). Different virtual machines have different ASIDs. If the virtual machine's memory is encrypted, the security processor can assign a virtual machine key bound to the virtual machine's ASID.

[0049] In secure virtualization technology, whether the memory page corresponding to the virtual machine memory is encrypted can be indicated by an indicator bit (also known as C-bit). Thus, when reading and writing virtual machine memory, the virtual machine identifier and C-bit can be carried by the physical address. When the C-bit indicates that the memory page to be read or written is encrypted, the virtual machine key bound to the virtual machine identifier can be retrieved using the virtual machine identifier to encrypt and decrypt the memory page to be read or written.

[0050] For ease of understanding, let's take ASID as the virtual machine identifier as an example. Figure 2 An example diagram illustrating the format of a physical address is shown below, such as... Figure 2 As shown, when the ASID is 4 bits, the ASID corresponds to bits [43:46] in the physical address. At this time, the firmware of the security processor can record the physical address format of the ASID as [43:46]. Thus, the security processor can write the ASID to the position with a physical address offset of [43:46] based on the physical address format recorded in the firmware. The C-bit is written at the position with a physical address offset of 47 to indicate whether the memory page corresponding to the physical address is encrypted.

[0051] When the ASID is 9 bits (a 9-bit ASID can be upgraded from a 4-bit ASID), the security processor's firmware can record the physical address format of the ASID as [45:46][48:54]. Based on the physical address format recorded by the firmware, the security processor writes the ASID to the position with a physical address offset of [45:46][48:54], where the C-bit is written at the position with a physical address offset of 47.

[0052] It's important to further explain that when accessing virtual machine memory through the page table, the virtual machine's physical address can carry a tag corresponding to the virtual machine's ASID. This tag is used to determine which virtual machine's data is being accessed or manipulated. Simultaneously, the virtual machine's ASID is used during page table traversal to distinguish the TLB (Translation Lookaside Buffer). The TLB caches the mapping between virtual and physical addresses, while the cache caches the mapping between physical addresses and data. In the cache, the C-bit and ASID are used to distinguish cache lines.

[0053] In secure virtualization technology, enabling secure virtualization requires the host to enable memory encryption and the virtual machine's control block to enable NPT (Nested Paging Table) functionality. This is to ensure that C-bit control is not interfered with by software during operation. If there are two levels of page tables, there will be C-bit combinations of PTE (Page Table Entry) in both levels of page tables, which determines how the final virtual machine memory pages are encrypted and decrypted. For ease of understanding, Figure 3 An exemplary diagram of a two-level page table C-bit combination is shown, such as... Figure 3 As shown, both the Guest Page Table (GPT) and the NPT (Non-Planet Page Table) contain a C-bit in their page table entries. The C-bit can be 0 or 1. When both the GPT and NPT C-bits are 0, it indicates that the virtual machine memory page is not encrypted. If the GPT C-bit is 1 and the NPT C-bit is 0, it indicates that the virtual machine memory page is encrypted using a virtual machine key (e.g., VEK). If the GPT C-bit is 0 and the NPT C-bit is 1, it indicates that the virtual machine memory page is encrypted using a host key. If both the GPT and NPT C-bits are 1, it indicates that the virtual machine memory page is encrypted using a virtual machine key.

[0054] It's important to note that secure virtualization places requirements on both the host and guest machines (guest machines are also called virtual machines). Guest machines must be compatible with the hardware features of secure virtualization, require control over the C-bit, and are not allowed to perform DMA (Direct Memory Access) operations on the encrypted memory space. DMA operations can only be implemented using the guest's shared memory space. Furthermore, similar to memory space encryption, before accessing memory pages using different C-bits, the memory pages must be flushed from the cache to memory.

[0055] As can be seen, the main idea of ​​secure virtualization is to encrypt and protect the virtual machine's memory, so that the host and other virtual machines cannot directly read or steal the data in the virtual machine's memory, thus protecting the virtual machine's memory from physical attacks, cross-virtual machine attacks, and attacks from the host.

[0056] In secure virtualization technology, besides the virtual machine data stored in the virtual machine's memory, which is encrypted using a virtual machine key, the virtual machine control block (VMB), a memory data structure storing confidential virtual machine data, can also be encrypted using a key. For example, the virtual machine's register state can be stored in the VMB, and the VMB can be encrypted using a key, thus ensuring the security of the register state and other data stored in the VMB. In optional implementations, the key used to encrypt the VMB can be different from the virtual machine key (e.g., VEK) used to encrypt the virtual machine's memory.

[0057] It should be noted that when the Virtual Machine Control Block (VMC) saves the virtual machine's register state, the guest machine needs to share the register state with the host machine. Furthermore, the VMC is divided into two parts: VMCA (Virtual Machine Control Area) and VMSA (Virtual Machine Save Area). In this scenario, the processor will exit from guest mode (also known as virtual machine mode) to host mode under two events: the Automatic Exit (AE) event and the Non-Automatic Exit (NAE) event.

[0058] For AE events, which do not require host simulation, such as asynchronous events (e.g., interrupt events) or events that do not require virtual machine register state (e.g., pause instructions), the NAE events require host simulation and will generate a VMM Communication Exception.

[0059] In one example, the virtual machine (VM) can determine the shared register state via the GHCB (Guest-Hypervisor Communication Block). When the VM executes a new VMGEXIT instruction (causing an AE event), the VM can update its register state using the result provided by the host. The AE event causes the CPU hardware to save the encrypted VM register state and read the host state. After the host processes the exit event, the VM is restarted using the VMRUN (VM Run) command. Conversely, the NAE event is generated when the VM executes specific instructions, such as reading registers from a simulated device. When a NAE event occurs, a new exception (e.g., VMM CommunicationException) is generated, and this exception is handled by the VM.

[0060] As described above, secure virtualization technology, in addition to using the virtual machine's virtual machine key to encrypt and protect the virtual machine's memory, can also use the key to encrypt and protect the virtual machine control block in the physical memory. For ease of understanding, Figure 4A An example diagram illustrating the encryption protection of the virtual machine control block is shown, such as... Figure 4A As shown, when a virtual machine exits, its register state can be saved to VMSA, and VMSA is stored in the virtual machine's virtual machine control block. This virtual machine control block is encrypted and protected using a key. When the virtual machine is running, the virtual machine control block can use the key to decrypt the register state, and then use the virtual machine's register state to restore the virtual machine's operation.

[0061] Although secure virtualization technology can encrypt and protect the virtual machine control block of a virtual machine, the inventors of this application discovered during their research that the encryption protection performance of secure virtualization technology for the virtual machine control block still needs to be improved: the key used by secure virtualization technology to encrypt and protect the virtual machine control block is a fixed key, which allows attackers to build a dictionary of ciphertext and plaintext. After confirming the correspondence between ciphertext and plaintext, attackers can crack the key of the virtual machine control block, thus leading to the risk of leakage of the key of the virtual machine control block.

[0062] It should be noted that when the virtual machine executes the encryption program, the key is stored in a register. When the CPU switches from virtual machine mode (also known as guest mode) to host mode, the virtual machine's register state can be stored in the virtual machine's virtual machine control block. In this case, if the key used to encrypt the virtual machine control block is a fixed key, then once an attacker builds a dictionary of ciphertext and plaintext in the register storing the key, the attacker will be able to crack the virtual machine control block's key, leading to a risk of the virtual machine control block's key being leaked.

[0063] It is worth noting that when attackers build the dictionary of ciphertext and plaintext, the number of plaintexts in the virtual machine control block is limited, thus the encryption process state of the encryption algorithm and the number of ciphertexts obtained are also limited. On this basis, if the key of the virtual machine control block is set to a fixed key, attackers can guess the plaintext corresponding to the ciphertext based on the template of the encryption algorithm's operation through replay attacks and other methods, thereby building a dictionary of ciphertext and plaintext, making it possible for the key of the virtual machine control block to be cracked and leaked.

[0064] In one example Figure 4B An example diagram illustrating an attacker building a dictionary of ciphertext and plaintext is shown below. Figure 4B As shown, when the virtual machine exits, the CPU switches from virtual machine mode to host mode. At this time, the virtual machine's register state can be saved in the virtual machine's control block (VC). When executing virtual machine instructions in host mode, the CPU switches back to virtual machine mode, and the virtual machine can determine the shared register state via GHCB. This process involves saving and restoring the register state in the VC, and the VC handler can be used to achieve both. When the VC key is a fixed key, since the amount of plaintext in the register state is limited, an attacker can learn the ciphertext when entering or exiting the VC handler, thus building a dictionary of ciphertext and plaintext and cracking the key used for encryption in the VC.

[0065] As can be seen from the above introduction, although secure virtualization technology provides numerous security encryption methods and can encrypt and protect the virtual machine control block of a virtual machine, the key used to encrypt the virtual machine control block is a fixed key (that is, the key used to encrypt the virtual machine control block is fixed and unchanging). This makes it possible for attackers to crack the key of the virtual machine control block, and there is a security risk of the virtual machine control block key being leaked.

[0066] Based on this, embodiments of this application provide an improved security protection scheme for the virtual machine control block, so that the key of the virtual machine control block is in a dynamically changing state, increasing the difficulty for attackers to crack the key of the virtual machine control block, thereby improving the security of the virtual machine control block.

[0067] Based on the above ideas Figure 5 An exemplary flowchart of an optional security protection method for a virtual machine control block provided in an embodiment of this application is shown. This method can be implemented by a memory controller, for example, by an encryption / decryption engine configured in the memory controller. (Refer to...) Figure 5 The method process may include the following steps.

[0068] In step S510, data write commands related to the virtual machine are obtained.

[0069] In some embodiments, a processor such as a CPU may pass virtual machine-related data write commands to the memory controller.

[0070] In step S511, if the data write command is used to write the virtual machine control block data of the virtual machine to the virtual machine control block, the dynamically changing value associated with the virtual machine control block is determined.

[0071] When a virtual machine writes data to memory, it may be writing virtual machine control block (VMC) data to the VMC block in memory. The VMC block is a data structure for the virtual machine in memory; each virtual machine can store one VMC block in memory. VMC data can be understood as the data carried by the VMC block, such as the virtual machine's register states and other context data related to the virtual machine's operation.

[0072] In one implementation example, when the virtual machine exits, it can write the virtual machine's register state (including the state of the virtual machine when entering and exiting) into the virtual machine control block. For example, when the virtual machine exits, it can pass a data write command to write virtual machine control block data, such as register state, into the virtual machine control block. In this case, the virtual machine control block can be encrypted. That is, the virtual machine control block can be encrypted when exiting the virtual machine.

[0073] The virtual machine can write data to memory, or it can write virtual machine data into its own memory. For example, the virtual machine might write file data, application data, or user data that it processes into its own memory. In an optional implementation, the virtual machine's data is encrypted and decrypted using the virtual machine's virtual machine key, while the virtual machine's control block (VMB) uses a different key for encryption and decryption. For ease of explanation, the VMB key will be referred to as the VMB key below.

[0074] In some embodiments, the data write command may carry a data write address and the data to be written. After obtaining the data write command, the memory controller can determine whether the data write command is used to write virtual machine control block (VMB) data to the VMB or to write virtual machine data to virtual machine memory by parsing the data write address carried by the data write command. Optionally, if the data write address carried by the data write command matches the address of the VMB in physical memory, it can be determined that the data write command is used to write VMB data to the VMB, and the data to be written carried by the data write command is VMB data. Optionally, if the data write address carried by the data write command matches the address allocated in physical memory for the virtual machine memory, it can be determined that the data write command is used to write virtual machine data to virtual machine memory, and the data to be written carried by the data write command is virtual machine data.

[0075] Step S511 focuses on the case where the data write command is used to write virtual machine control block data of the virtual machine into the virtual machine control block. At this time, the memory controller can determine the dynamically changing value associated with the virtual machine control block so that the virtual machine control block key used to encrypt the virtual machine control block can be derived later using the value.

[0076] In some embodiments, the dynamically changing value associated with the virtual machine control block (VM block) can be the number of times the VM block is used, or a random number associated with the VM block. This application embodiment does not limit the form of this dynamically changing value, as long as the value is in a dynamically changing state. It should be noted that the number of times the VM block is used is dynamically changing; for example, the number of times the VM block is used increments by 1 each time it is used. In one implementation example, this application embodiment can use the VM block once when entering a virtual machine (e.g., when the virtual machine runs once) to restore the virtual machine's operation using information such as the register state stored in the VM block.

[0077] As an optional implementation, taking the dynamically changing value as the number of times the virtual machine control block is used as an example, this embodiment of the application can set a counter to count the number of times the virtual machine control block is used. For example, each time a virtual machine is entered, the virtual machine control block of the virtual machine is used once, and the corresponding counter value increments by 1, so that the counter value corresponds to the number of times the virtual machine control block is used. In one implementation example, this embodiment of the application can modify the virtual machine running instructions so that the counter value increments by 1 each time the virtual machine is run; running a virtual machine once can be regarded as entering the virtual machine once, and when entering the virtual machine, the data in the virtual machine control block of the virtual machine needs to be used to realize the operation of the virtual machine.

[0078] In step S512, the virtual machine control block key of the virtual machine control block is derived based on the value.

[0079] Unlike virtual machine control block (VM) keys which are fixed, this application provides dynamically changing VM control block keys, thereby increasing the difficulty for attackers to crack them. In some embodiments, the VM control block key used for encrypting and decrypting the VM control block can be derived based on dynamically changing values ​​associated with the VM control block. Alternatively, this application can derive the VM control block key based on the number of times the VM control block is used. Based on this, after determining the number of times the VM control block is used (for example, by reading a counter), the memory controller can derive the VM control block key using a key derivation algorithm based on the number of uses.

[0080] In some further embodiments, since one virtual machine corresponds to one virtual machine control block, the virtual machine key of the present application can be further combined when deriving the virtual machine control block key. As an optional implementation, the virtual machine control block key can be derived based on the dynamically changing value associated with the virtual machine control block (e.g., the number of times the virtual machine control block is used) and the virtual machine key of the virtual machine.

[0081] In some further embodiments, based on the embodiments of this application, the encryption and decryption functions of the virtual machine control block are implemented through the memory controller. The embodiments of this application can modify the control path of memory encryption in the memory controller, so that when memory encryption involves the encryption of the virtual machine control block in memory, the virtual machine control block key is derived by using the number of times the virtual machine control block is used (which can be further combined with the virtual machine key of the virtual machine).

[0082] In step S513, the virtual machine control block data is encrypted using the virtual machine control block key, and the encrypted virtual machine control block data is written into the virtual machine control block.

[0083] After the memory controller derives and generates a virtual machine control block key for encrypting the virtual machine control block, it can use the virtual machine control block key to encrypt the virtual machine control block data carried by the virtual machine-related data write command. This results in encrypted virtual machine control block data, which is then written into the virtual machine control block, thus achieving encrypted security protection for the data stored in the virtual machine control block.

[0084] Since the virtual machine control block (VMB) key used to encrypt the VMB is derived from a dynamically changing value associated with the VMB (e.g., the number of times the VMB has been used), the VMB key changes accordingly as the value changes. Therefore, this embodiment of the application can use the dynamically changing VMB key to encrypt and protect VMB data that needs to be written to the VMB. When the VMB key changes dynamically, attackers will not be able to build a dictionary of ciphertext and plaintext by observing the read and write data of the VMB, thereby increasing the difficulty for attackers to crack the VMB key and improving the security of the VMB.

[0085] In the security protection method for the virtual machine control block provided in this application embodiment, after the memory controller obtains a data write command related to the virtual machine, if it determines that the data write command is used to write the virtual machine control block data of the virtual machine to the virtual machine control block, the memory controller can determine the dynamically changing value associated with the virtual machine control block, and thereby derive a virtual machine control block key for encrypting the virtual machine control block based on the value; then, the memory controller can use the derived virtual machine control block key to encrypt the virtual machine control block data, and write the encrypted virtual machine control block data to the virtual machine control block, thereby achieving secure encryption protection when writing data to the virtual machine control block. Since the value associated with the virtual machine control block is in a dynamically changing state, the virtual machine control block key derived from this value will also change dynamically accordingly; this application embodiment uses a dynamically changing virtual machine control block key to encrypt and protect the virtual machine control block data written to the virtual machine control block, which makes it impossible for attackers to build a dictionary of ciphertext and plaintext by observing the read and write data of the virtual machine control block, increasing the difficulty for attackers to crack the virtual machine control block key, improving the security of the virtual machine control block, and ensuring the security of the data stored in the virtual machine control block.

[0086] In some further embodiments, considering that the virtual machine can write virtual machine control block data to the virtual machine control block and write virtual machine data to the virtual machine memory, Figure 6 An exemplary flowchart illustrates another optional method for protecting the security of the virtual machine control block provided in this application embodiment, with reference to... Figure 6 The method process may include the following steps.

[0087] In step S610, data write commands related to the virtual machine are obtained.

[0088] In step S611, if the data write command is used to write the virtual machine control block data of the virtual machine to the virtual machine control block, then the count value of the counter is read to obtain the number of times the virtual machine control block has been used.

[0089] When the memory controller determines that a data write command is used to write virtual machine control block (VMC) data to the VMC, it can read a counter value from a counter used to count the number of times the VMC is used, thereby obtaining the number of times the VMC is used. Optionally, the VMC can be used once when entering a virtual machine, so the number of times the VMC is used corresponds to the number of times the virtual machine is entered (i.e., the number of times the virtual machine runs). Based on this, in an optional implementation, if the VMC data needs to be encrypted and saved to the VMC when exiting the virtual machine, since exiting the virtual machine does not cause a change in the number of times the VMC is used, the number of times the VMC is used in the case of writing data in this embodiment is the number of times the VMC is used corresponding to the last time the virtual machine was entered.

[0090] As an optional implementation, the counter can be set in the virtual machine control block (VM block). For example, a counter that increments sequentially with the number of times the VM block is used can be added to the VM block. Optionally, the counter can be set in a free field of the VM block, so that the memory controller can read the counter value from the free field of the VM block. For example, the counter can be set at a free offset position of the VM block, so that the memory controller can read the counter value from the free offset position of the VM block. In one implementation example, the present application embodiment can set the counter at a free offset position of 108H in the VM block. It should be noted that H represents hexadecimal, and 108H is equivalent to 264 in decimal.

[0091] In an optional implementation, the counter's bit width can be set according to actual conditions. For example, the counter's bit width can be set to 64 bits, so that the counter's count value increases by 1 bit each time the virtual machine control block is used, or after a set number of uses. Optionally, the counter's bit width can be determined based on the upper limit of the virtual machine control block's usage count and the size of the offset position of the counter set in the virtual machine control block. The 64-bit counter mentioned above is only an example, and this application embodiment does not set a limit on the counter's bit width.

[0092] In other optional implementations, embodiments of this application may also set the counter value to increment sequentially every time the virtual machine control block is used a set number of times, rather than necessarily setting the counter value to increment sequentially every time the virtual machine control block is used once; in one example, the set number of times may be greater than 1. For example, embodiments of this application may set the counter value to increment sequentially every time the virtual machine control block is used twice.

[0093] It should be noted that the Virtual Machine Control Block (VMCB) is a data structure that can store data, thus allowing counters to be set in data form within the VMCB. However, this application's embodiments are not limited to setting the counter within the VMCB. For example, the counter can also be set inside the CPU, such as in a CPU register. In other possible implementations, this application's embodiments can also set the counter in any data storage device within the host, such as in an SRAM (Static Random-Access Memory) device.

[0094] It should be further noted that the virtual machine control block referred to in this application embodiment may be a VMCB (Virtual Machine Control Block) or a VMCS (Virtual Machine Control Structure). The name of the virtual machine control block differs in different computer architectures, and this application embodiment does not impose any limitation on this. Taking the virtual machine control block as a VMCB as an example, this application embodiment can add a 64-bit counter to the VMCB that increments sequentially with the number of times the VMCB is used, and set the counter at an offset of 108H in the VMCB. Therefore, this application embodiment can read the counter value from the 108H offset position of the VMCB, and the counter value can be defined as VMCB-enc-Count.

[0095] In step S612, the virtual machine key of the virtual machine is obtained, and the virtual machine control block key of the virtual machine control block is derived based on the virtual machine key and the number of times it is used.

[0096] After reading the count value from the counter to determine the number of times the virtual machine control block (VM block) has been used, the memory controller can obtain the virtual machine key (e.g., VEK). Then, combining the VM key with the usage count, it uses a key derivation algorithm to derive the VM block key. In some embodiments, the VM key can be stored in the memory controller's encryption / decryption engine. The encryption / decryption engine can then use the VM identifier (e.g., ASID) to call the associated VM key; subsequently, based on the called VM key and the determined usage count, it uses a key derivation algorithm to derive the VM block key.

[0097] In one implementation example, embodiments of this application can utilize a hash algorithm to derive the virtual machine control block key by combining the virtual machine key and the number of times the virtual machine control block is used. For example, if the virtual machine control block key is defined as C, then the virtual machine control block key can be derived in the following way:

[0098] C=HASH(VEK|VMCB-enc-Count).

[0099] In other words, the virtual machine control block key can be derived from the virtual machine's VEK and the virtual machine control block's usage count VMCB-enc-Count. Since VMCB-enc-Count is dynamically changing, the virtual machine control block key derived at different times (e.g., different usage counts of the virtual machine control block at different times) is different, thus the virtual machine control block key can be in a dynamically changing state. As an optional implementation, the hash algorithm can be fixed in the hardware of the memory controller (e.g., the memory controller's encryption / decryption engine). Therefore, without obtaining the virtual machine's VEK or determining the virtual machine control block's usage count, an attacker cannot reverse-engineer the virtual machine control block key. This ensures that the dynamically changing virtual machine control block key provided in this application embodiment is difficult for attackers to build a dictionary of ciphertext and plaintext, increasing the difficulty of cracking the dynamically changing virtual machine control block key. It should be further noted that, given the dynamically changing nature of the virtual machine control block key, this application embodiment may not store the virtual machine control block key, but instead derive it when encryption or decryption of the virtual machine control block is required.

[0100] As another possible implementation, the number of times the virtual machine control block is used is only one optional example of a dynamically changing value associated with the virtual machine control block. In this embodiment, the virtual machine control block key can also be derived using a random number associated with the virtual machine control block or other dynamically changing values ​​(which can be further combined with the virtual machine key). In this case, the above formula for deriving the virtual machine control block key based on the hash algorithm can be adjusted accordingly, for example, replacing the number of times the virtual machine control block is used with other dynamically changing values ​​such as a random number associated with the virtual machine control block.

[0101] In step S613, the virtual machine control block data is encrypted using the virtual machine control block key, and the encrypted virtual machine control block data is written into the virtual machine control block.

[0102] As can be seen, since the number of times the virtual machine control block is used during the operation of the virtual machine is dynamically changing, the virtual machine control block key derived from the number of times the virtual machine control block is used will also change dynamically accordingly. This application embodiment uses the dynamically changing virtual machine control block key to encrypt and protect the virtual machine control block data written to the virtual machine control block. This makes it impossible for attackers to build a dictionary of ciphertext and plaintext by observing the read and write data of the virtual machine control block, which increases the difficulty for attackers to crack the virtual machine control block key, improves the security of the virtual machine control block, and ensures the security of the data stored in the virtual machine control block.

[0103] Steps S611 to S613 describe the process of encrypting virtual machine control block data using a dynamically changing virtual machine control block key and writing it into the virtual machine control block when writing virtual machine control block data. The following section will also introduce the situation where virtual machine data may be written into virtual machine memory.

[0104] In step S614, if the data write command is used to write the virtual machine data of the virtual machine into the virtual machine memory of the virtual machine, then the virtual machine key of the virtual machine is invoked.

[0105] In step S615, the virtual machine data is encrypted using the virtual machine key, and the encrypted virtual machine data is written into the virtual machine memory.

[0106] In the case of virtual machines writing virtual machine data into virtual machine memory, based on secure virtualization technology, the memory controller can call the bound virtual machine key according to the virtual machine identifier of the virtual machine, and then use the virtual machine key to encrypt the virtual machine data; then, write the encrypted virtual machine data into the virtual machine memory, so that the virtual machine data in the virtual machine memory can be encrypted and protected.

[0107] It should be noted that the encryption and decryption engine of the memory controller can use encryption algorithms such as SM4 and SM3 to encrypt and decrypt data. This application embodiment does not limit the type of encryption algorithm used by the encryption and decryption engine.

[0108] Based on the data encryption scheme provided in the embodiments of this application, the embodiments of this application also provide a data decryption scheme. As an optional implementation, Figure 7 An exemplary flowchart illustrates another optional method for security protection of the virtual machine control block provided in this application embodiment. This method can be implemented by a memory controller. (Refer to...) Figure 7 The method process may include the following steps.

[0109] In step S710, data read commands related to the virtual machine are obtained.

[0110] In some embodiments, a processor such as a CPU may pass virtual machine-related data read commands to the memory controller.

[0111] In some embodiments, virtual machine-related data read commands may be used to read virtual machine control block data from the virtual machine control block of the virtual machine, or they may be used to read virtual machine data from the virtual machine memory of the virtual machine.

[0112] As an optional implementation, the memory controller can resolve the data read address carried by the data read command. If the data read address matches the address of the virtual machine control block in memory, it can be determined that the data read command is used to read virtual machine control block data from the virtual machine control block. If the data read address matches the address of the virtual machine's virtual machine memory, it can be determined that the data read command is used to read virtual machine data from the virtual machine memory.

[0113] In step S711, if the data read command is used to read virtual machine control block data from the virtual machine control block of the virtual machine, then the dynamically changing value associated with the virtual machine control block is determined.

[0114] In one implementation example, upon entering a virtual machine, this embodiment of the application can read virtual machine control block (VMB) data from the VMB to utilize information such as register states within the VMB data to resume virtual machine operation. In other words, this embodiment of the application can obtain a data read command upon entering the virtual machine. This data read command is used to read VMB data from the VMB of the virtual machine and to decrypt the encrypted VMB data within the VMB.

[0115] In some embodiments, the dynamically changing value determined when reading data can be consistent with the dynamically changing value determined when the corresponding encrypted virtual machine control block is accessed.

[0116] As an optional implementation, in the case of reading data, the dynamically changing value associated with the virtual machine control block can be the number of times the virtual machine control block was last used (for example, reading the last count value from the counter in the virtual machine control block to obtain the number of times the virtual machine control block was last used). In other possible implementations, the dynamically changing value associated with the virtual machine control block can also be a random number associated with the virtual machine control block, etc.

[0117] In the case of reading data, taking the dynamically changing value as the previously recorded number of times the virtual machine control block (VM control block) was used as an example, in an optional implementation, the number of times the VM control block was used is related to the number of times the VM was entered. For example, exiting the VM is not considered as using the VM control block and will not increase the number of times the VM control block is used; only entering the VM (e.g., running the VM) will increase the number of times the VM control block is used. When exiting the VM requires encrypting the VM control block and entering the VM requires decrypting the VM control block, to ensure that the key used to encrypt the VM control block when exiting the VM is symmetrical and consistent with the key used to decrypt the VM control block when entering the VM, this embodiment can use the previously recorded number of times the VM control block was used (e.g., the previous count value of a counter) to derive the VM control block key when entering the VM, in order to decrypt the VM control block data that is already in an encrypted state; and the number of times the VM control block was used in this entry can be used to derive the VM control block key the next time the VM is exited and the next time the VM is entered. In other words, entering and exiting the virtual machine are corresponding. When entering the virtual machine and adjusting the number of times the virtual machine control block is used (e.g., adjusting the counter value), the adjusted number of times the virtual machine control block is used to derive the virtual machine control block key in the next encryption and decryption of the virtual machine control block.

[0118] In step S712, the virtual machine control block key of the virtual machine control block is derived based on the value.

[0119] In some embodiments, the present application can derive a virtual machine control block key based on the stated value and the virtual machine key of the virtual machine. The derivation process of the virtual machine control block key can be referred to the description in the corresponding section above, and will not be repeated here.

[0120] In step S713, the virtual machine control block key is used to decrypt the virtual machine control block data in the virtual machine control block, and the decrypted virtual machine control block data is output.

[0121] In some embodiments, the memory controller may use a derived virtual machine control block key to decrypt the virtual machine control block data that needs to be read in the virtual machine control block, thereby obtaining the decrypted virtual machine control block data; then, the decrypted virtual machine control block data may be output, for example, the decrypted virtual machine control block data may be output to the processor, so that virtual machines that rely on processor resources to run can obtain the decrypted virtual machine control block data.

[0122] In some further embodiments, Figure 8 An exemplary flowchart illustrates another optional method for protecting the security of a virtual machine control block provided in an embodiment of this application, with reference to... Figure 8 As shown, the method flow may include the following steps.

[0123] In step S810, data read commands related to the virtual machine are obtained.

[0124] In step S811, if the data read command is used to read virtual machine control block data from the virtual machine control block of the virtual machine, then the previous count value of the counter is read to obtain the number of times the virtual machine control block was used in the previous record.

[0125] In step S812, the virtual machine key of the virtual machine is obtained, and the virtual machine control block key of the virtual machine control block is derived based on the virtual machine key and the previously recorded number of uses.

[0126] In step S813, the virtual machine control block key is used to decrypt the virtual machine control block data in the virtual machine control block, and the decrypted virtual machine control block data is output.

[0127] In step S814, if the data read command is used to read virtual machine data from the virtual machine memory of the virtual machine, then the virtual machine key of the virtual machine is invoked.

[0128] In step S815, the virtual machine key is used to decrypt the virtual machine data in the virtual machine memory, and the decrypted virtual machine data is output.

[0129] In some embodiments, the memory controller may send the decrypted virtual machine data to the processor.

[0130] The virtual machine control block (VMB) key used in this application for encrypting and decrypting VMBs is derived based on dynamically changing values ​​associated with the VMB. Therefore, the VMB key is in a dynamically changing state, effectively preventing attackers from repeatedly attacking the encrypted VMB and recording and forming a dictionary of ciphertext and plaintext. In one implementation example, this application uses an idle field in the VMB to set a counter to count the number of times the VMB is used (the counter value increments sequentially each time the VMB is used or after a set number of uses). Based on the number of uses counted by the counter, this application can derive different VMB keys each time the VMB is used or after a set number of uses, ensuring the VMB key is in a dynamically changing state. This prevents attackers from cracking the VMB key by recording a dictionary of ciphertext and plaintext, thereby improving the data security of the VMB.

[0131] The following describes the security protection device for the virtual machine control block provided in this application embodiment from the perspective of data encryption. The device described below can be considered as the functional module required by the memory controller to implement the security protection method for the virtual machine control block provided in this application embodiment. This functional module can be a hardware circuit module in the memory controller. The device described below can be referred to in correspondence with the description above.

[0132] As an optional implementation Figure 9A An exemplary block diagram of the security protection device for the virtual machine control block provided in an embodiment of this application is shown, with reference to... Figure 9A As shown, the device may include:

[0133] The write command acquisition module 910 is used to acquire virtual machine-related data and write commands.

[0134] The first value determination module 911 is used to determine the dynamically changing value associated with the virtual machine control block if the data write command is used to write the virtual machine control block data of the virtual machine to the virtual machine control block of the virtual machine.

[0135] The first derivation module 912 is used to derive the virtual machine control block key of the virtual machine control block according to the value;

[0136] The encryption module 913 is used to encrypt the virtual machine control block data using the virtual machine control block key, and write the encrypted virtual machine control block data into the virtual machine control block.

[0137] In some embodiments, the first value determination module 911 is used to determine the dynamically changing value associated with the virtual machine control block, including:

[0138] The number of times the virtual machine control block is used is determined, wherein the virtual machine control block is used once when the virtual machine is entered, and the virtual machine control block data in the virtual machine control block is decrypted when the virtual machine is entered in order to enable the virtual machine to run;

[0139] Alternatively, a random number associated with the virtual machine control block can be determined.

[0140] In some embodiments, the first value determination module 911 is used to determine the number of times the virtual machine control block is used, including:

[0141] The counter value is read to obtain the number of times the virtual machine control block is used; wherein the counter value increases sequentially each time the virtual machine control block is used, or each time the virtual machine control block is used a set number of times; the set number of times is greater than 1.

[0142] In some embodiments, the counter is set in an idle field of the virtual machine control block; the first value determination module 911 is used to read the counter value including:

[0143] Read the counter value from the idle field of the virtual machine control block;

[0144] The free field includes the free offset position of the virtual machine control block.

[0145] In some embodiments, the first derivation module 912 is configured to derive the virtual machine control block key of the virtual machine control block based on the value, including:

[0146] Obtain the virtual machine key of the virtual machine, and derive the virtual machine control block key of the virtual machine control block using the key derivation algorithm based on the virtual machine key and the value.

[0147] In further embodiments, the apparatus provided in this application can also be used for:

[0148] If the data write command is used to write the virtual machine data of the virtual machine to the virtual machine memory of the virtual machine, then the virtual machine key of the virtual machine is invoked;

[0149] The virtual machine data is encrypted using the virtual machine key, and the encrypted virtual machine data is written into the virtual machine memory.

[0150] This application also provides a memory controller that can implement the virtual machine control block security protection method provided in this application by setting the security protection device for the virtual machine control block described above. Optionally, the memory controller can be configured to execute the virtual machine control block security protection method provided in this application.

[0151] The following describes the security protection device for the virtual machine control block provided in this application embodiment from the perspective of data decryption. As an optional implementation, Figure 9B An exemplary diagram illustrates another optional block diagram of the security protection device for the virtual machine control block provided in this application embodiment. This device can be applied to a memory controller, see reference. Figure 9B As shown, the device may include:

[0152] The read command acquisition module 920 is used to acquire data read commands related to the virtual machine.

[0153] The second value determination module 921 is used to determine the dynamically changing value associated with the virtual machine control block if the data read command is used to read virtual machine control block data from the virtual machine control block of the virtual machine.

[0154] The second derivation module 922 is used to derive the virtual machine control block key of the virtual machine control block based on the value;

[0155] The decryption module 923 is used to decrypt the virtual machine control block data in the virtual machine control block using the virtual machine control block key, and output the decrypted virtual machine control block data.

[0156] In some embodiments, the second value determination module 921 is used to determine the dynamically changing value associated with the virtual machine control block, including:

[0157] The number of times the virtual machine control block was used in the last recorded instance is determined. The virtual machine control block is used once when the virtual machine is entered, and the virtual machine control block data in the virtual machine control block is decrypted when the virtual machine is entered in order to enable the virtual machine to run.

[0158] Alternatively, a random number associated with the virtual machine control block can be determined.

[0159] In some embodiments, the second value determination module 921 is used to determine the number of times the virtual machine control block was used in the last recorded instance, including:

[0160] The previous count value of the counter is read to determine the number of times the virtual machine control block was used in the previous record; wherein, the count value of the counter increases sequentially each time the virtual machine control block is used, or each time the virtual machine control block is used a set number of times; the set number of times is greater than 1.

[0161] In some embodiments, the counter is set in an idle field of the virtual machine control block; the second value determination module 921 is used to read the previous count value of the counter, including:

[0162] Read the previous count value of the counter from the idle field of the virtual machine control block;

[0163] The free field includes the free offset position of the virtual machine control block.

[0164] In further embodiments, the apparatus provided in this application can also be used for:

[0165] If the data read command is used to read virtual machine data from the virtual machine's virtual machine memory, then the virtual machine key of the virtual machine is invoked;

[0166] The virtual machine key is used to decrypt the virtual machine data in the virtual machine memory, and the decrypted virtual machine data is output.

[0167] This application also provides a memory controller that can implement the virtual machine control block security protection method provided in this application by setting the security protection device for the virtual machine control block described above. Optionally, the memory controller can be configured to execute the virtual machine control block security protection method provided in this application.

[0168] This application also provides a chip that may include the memory controller provided in this application.

[0169] This application also provides an electronic device, such as a terminal device or a server device, which may include the chip provided in this application.

[0170] The foregoing describes multiple embodiment schemes provided by the embodiments of this application. The optional methods described in each embodiment scheme can be combined and cross-referenced with each other without conflict, thereby extending to a variety of possible embodiment schemes. These can all be considered as the embodiment schemes disclosed and published by the embodiments of this application.

[0171] While the embodiments disclosed above are described in this application, this application is not limited thereto. Any person skilled in the art can make various modifications and alterations without departing from the spirit and scope of this application; therefore, the scope of protection of this application should be determined by the scope defined in the claims.

Claims

1. A method for security protection of a virtual machine control block, characterized in that, include: Write commands to retrieve data related to the virtual machine; If the data write command is used to write the virtual machine control block data of the virtual machine to the virtual machine control block, determine the dynamically changing value associated with the virtual machine control block; Based on the value, derive the virtual machine control block key of the virtual machine control block; The virtual machine control block (VMC) data is encrypted using the VMC key, and the encrypted VMC data is then written into the VMC.

2. The method according to claim 1, characterized in that, The determination of the dynamically changing values ​​associated with the virtual machine control block includes: The number of times the virtual machine control block is used is determined, wherein the virtual machine control block is used once when the virtual machine is entered, and the virtual machine control block data in the virtual machine control block is decrypted when the virtual machine is entered in order to enable the virtual machine to run; Alternatively, a random number associated with the virtual machine control block can be determined.

3. The method according to claim 2, characterized in that, Determining the number of times the virtual machine control block is used includes: The counter value is read to obtain the number of times the virtual machine control block is used; wherein the counter value increases sequentially each time the virtual machine control block is used, or each time the virtual machine control block is used a set number of times; the set number of times is greater than 1.

4. The method according to claim 3, characterized in that, The counter is set in the free field of the virtual machine control block; the count value of the counter is read as follows: Read the counter value from the idle field of the virtual machine control block; The free field includes the free offset position of the virtual machine control block.

5. The method according to any one of claims 1-4, characterized in that, The virtual machine control block key derived from the value includes: Obtain the virtual machine key of the virtual machine, and derive the virtual machine control block key of the virtual machine control block using the key derivation algorithm based on the virtual machine key and the value.

6. The method according to any one of claims 1-4, characterized in that, Also includes: If the data write command is used to write the virtual machine data of the virtual machine to the virtual machine memory of the virtual machine, then the virtual machine key of the virtual machine is invoked; The virtual machine data is encrypted using the virtual machine key, and the encrypted virtual machine data is written into the virtual machine memory.

7. A method for security protection of a virtual machine control block, characterized in that, include: Commands for retrieving data related to the virtual machine; If the data read command is used to read virtual machine control block data from the virtual machine control block of the virtual machine, then the dynamically changing value associated with the virtual machine control block is determined; Based on the value, derive the virtual machine control block key of the virtual machine control block; The virtual machine control block data in the virtual machine control block is decrypted using the virtual machine control block key, and the decrypted virtual machine control block data is output.

8. The method according to claim 7, characterized in that, The determination of the dynamically changing values ​​associated with the virtual machine control block includes: The number of times the virtual machine control block was used in the last recorded instance is determined. The virtual machine control block is used once when the virtual machine is entered, and the virtual machine control block data in the virtual machine control block is decrypted when the virtual machine is entered in order to enable the virtual machine to run. Alternatively, a random number associated with the virtual machine control block can be determined.

9. The method according to claim 8, characterized in that, Determining the number of times the virtual machine control block was last used includes: The previous count value of the counter is read to determine the number of times the virtual machine control block was used in the previous record; wherein, the count value of the counter increases sequentially each time the virtual machine control block is used, or each time the virtual machine control block is used a set number of times; the set number of times is greater than 1.

10. The method according to claim 9, characterized in that, The counter is set in the free field of the virtual machine control block; reading the previous count value of the counter includes: Read the previous count value of the counter from the idle field of the virtual machine control block; The free field includes the free offset position of the virtual machine control block.

11. The method according to any one of claims 7-10, characterized in that, Also includes: If the data read command is used to read virtual machine data from the virtual machine's virtual machine memory, then the virtual machine key of the virtual machine is invoked; The virtual machine key is used to decrypt the virtual machine data in the virtual machine memory, and the decrypted virtual machine data is output.

12. A security protection device for a virtual machine control block, characterized in that, include: The write command acquisition module is used to acquire virtual machine-related data and write commands. The first value determination module is used to determine a dynamically changing value associated with the virtual machine control block if the data write command is used to write the virtual machine control block data of the virtual machine to the virtual machine control block of the virtual machine. The first derivation module is used to derive the virtual machine control block key of the virtual machine control block based on the value; An encryption module is used to encrypt the virtual machine control block data using the virtual machine control block key, and write the encrypted virtual machine control block data into the virtual machine control block.

13. A security protection device for a virtual machine control block, characterized in that, include: The read command acquisition module is used to acquire data read commands related to the virtual machine. The second value determination module is used to determine the dynamically changing value associated with the virtual machine control block if the data read command is used to read virtual machine control block data from the virtual machine control block of the virtual machine. The second derivation module is used to derive the virtual machine control block key of the virtual machine control block based on the value; The decryption module is used to decrypt the virtual machine control block data in the virtual machine control block using the virtual machine control block key, and output the decrypted virtual machine control block data.

14. A memory controller, characterized in that, The memory controller is configured to perform the security protection method for the virtual machine control block as described in any one of claims 1-6, or the security protection method for the virtual machine control block as described in any one of claims 7-11.

15. A chip, characterized in that, Includes the memory controller as described in claim 14.

16. An electronic device, characterized in that, Includes the chip as described in claim 15.