Movatterモバイル変換


[0]ホーム

URL:


CN118520464B - Method for performing operations on registers, computer device, storage medium and program product - Google Patents

Method for performing operations on registers, computer device, storage medium and program product
Download PDF

Info

Publication number
CN118520464B
CN118520464BCN202410987349.2ACN202410987349ACN118520464BCN 118520464 BCN118520464 BCN 118520464BCN 202410987349 ACN202410987349 ACN 202410987349ACN 118520464 BCN118520464 BCN 118520464B
Authority
CN
China
Prior art keywords
target
policy
register
instruction
operation instruction
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202410987349.2A
Other languages
Chinese (zh)
Other versions
CN118520464A (en
Inventor
许鑫
苏志远
徐国振
戴纯兴
吴保锡
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Suzhou Metabrain Intelligent Technology Co Ltd
Original Assignee
Suzhou Metabrain Intelligent Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Suzhou Metabrain Intelligent Technology Co LtdfiledCriticalSuzhou Metabrain Intelligent Technology Co Ltd
Priority to CN202410987349.2ApriorityCriticalpatent/CN118520464B/en
Publication of CN118520464ApublicationCriticalpatent/CN118520464A/en
Application grantedgrantedCritical
Publication of CN118520464BpublicationCriticalpatent/CN118520464B/en
Activelegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Classifications

Landscapes

Abstract

The invention relates to the technical field of virtual machines and discloses a method for executing operation on a register, computer equipment, a storage medium and a program product, wherein the method comprises the steps of capturing a target operation instruction, wherein the target operation instruction is an operation instruction for causing the virtual machine to be switched from a working state to an exit state; the method comprises the steps of determining the type of a target operation instruction according to the target operation instruction, obtaining an original value corresponding to a target register when the target operation instruction is determined to be the instruction for operating the target register according to the type of the target operation instruction, obtaining a first new value corresponding to the target operation instruction, determining whether target strategy data corresponding to the target register exists in a pre-constructed strategy table, and selecting one or more elements from the target strategy data, the original value and the first new value to execute operation on the target register when the target strategy data exists in the strategy table. The invention can prevent certain software from attacking the virtual machine operating system by bypassing the kernel reinforcement technology.

Description

Method for performing operations on registers, computer device, storage medium and program product
Technical Field
The present invention relates to the field of virtual machine technology, and in particular, to a method for executing an operation on a register, a computer device, a storage medium, and a program product.
Background
With the rise of cloud computing, many users select cloud computing, storage, network and other resources to construct a computing environment at the present stage. As a support technology for cloud computing, virtualization technology has implemented the functions of most physical devices.
In the field of virtual machine technology, security means of a virtual machine operating system is consistent with security defense means of a physical machine operating system, for example, kernel reinforcement technology. The kernel reinforcement technology refers to modifying, optimizing and encrypting the kernel of the operating system to improve the security of the system and the capability of resisting external attacks. For example, kernel reinforcement techniques may prevent some software from performing a destructive operation on a virtual machine operating system by invoking critical kernel functions to obtain operating system permissions by restricting the critical kernel functions.
However, the kernel reinforcement technology is implemented at the kernel level, and in the virtual machine scenario, the virtual machine kernel is not running in the highest authority of the processor, so there is a risk that some software bypasses the kernel reinforcement technology and attacks the virtual machine operating system.
Disclosure of Invention
In view of the foregoing, the present invention provides a method, apparatus, computer device, storage medium and program product for performing operations on registers to solve the problem that some software bypasses kernel reinforcement technology and attacks the virtual machine operating system.
In a first aspect, the present invention provides a method for performing an operation on a register, capturing a target operation instruction, where the target operation instruction is an operation instruction that causes a virtual machine to switch from a working state to an exit state;
determining the type of the target operation instruction according to the target operation instruction;
When the target operation instruction is determined to be an instruction for operating a target register according to the type of the target operation instruction, acquiring an original value corresponding to the target register;
Acquiring a first new value corresponding to the target operation instruction;
determining whether target policy data corresponding to the target register exists in a pre-constructed policy table;
When it is determined that the target policy data is present in the policy table, one or more elements are selected from the target policy data, the original value, and the first new value, and an operation is performed on the target register.
The method for executing the operation on the register has the following advantages:
because the modification of the value in the register is the bottommost modification mode, although some software bypasses the kernel reinforcement technology, the scheme can directly intercept the target operation instruction at the register level, and can specifically analyze the target operation instruction according to the policy data in the pre-constructed policy table and the obtained original value and the first new value of the target register before executing the operation on the target register. In this way, virtual machine security problems caused by some software directly modifying the values in the registers can be avoided.
In an alternative embodiment, the target register is a control register;
the selecting one or more elements from the target policy data, the original value, and the first new value when it is determined that the target policy data exists in the policy table, performing an operation on the target register, including:
Performing an exclusive-or operation on the original value and the first new value to determine whether at least one modified bit exists;
When it is determined that at least one modification bit exists, updating a value corresponding to each modification bit in the first new value according to each modification bit and the target policy data to obtain a second new value;
and according to the second new value, executing updating operation on the target register.
Specifically, since each bit of the control register is used to indicate one function, policy verification operations are performed for each bit, and all functions can be covered in whole. And, update is carried out after strategy verification is carried out on each modification bit, so that the finally updated value is ensured to be a safe value, and the safety of the virtual machine can be improved.
In an alternative embodiment, when it is determined that at least one modified bit exists, updating a value corresponding to each modified bit in the first new value according to each modified bit and the target policy data to obtain a second new value, where the updating includes:
Determining whether policy sub-data corresponding to target modification bits exists in the target policy data according to the target modification bits, wherein the target modification bits are any modification bit in at least one modification bit;
When the strategy sub-data exists in the target strategy data, updating a value corresponding to the target modification bit in the first new value according to the strategy sub-data;
And after determining that the modification bits of the strategy sub-data exist, all performing updating operation, and obtaining the second new value.
Specifically, by the modification bit of the policy sub-data, after the first new value is updated, a security value, that is, a second new value, can be obtained, it can be ensured that the finally updated value is the security value, and the security of the virtual machine can be improved.
In an alternative embodiment, when determining that the policy sub-data exists in the target policy data, updating a value corresponding to the target modification bit in the first new value according to the policy sub-data includes:
When the strategy sub-data is determined to comprise a first fixed value corresponding to the target modification bit, modifying a value corresponding to the target modification bit in the first new value into the first fixed value;
Or alternatively
And when determining that the strategy sub-data comprises the instruction information for prohibiting modification, restoring the value corresponding to the target modification bit in the first new value into the value corresponding to the target modification bit in the original value.
Specifically, different modification bits may correspond to different modification manners, where the modification manners are related to functions of the corresponding modification bits, and by using the corresponding modification manners, the first new value may be updated to a security value, so that security of the virtual machine may be improved.
In an alternative embodiment, the destination register is a special module MSR register;
the selecting one or more elements from the target policy data, the original value, and the first new value when it is determined that the target policy data exists in the policy table, performing an operation on the target register, including:
when the target strategy data comprises a second fixed value corresponding to the target register, setting an execution mark for the target operation instruction according to the first new value and the second fixed value;
Or alternatively
When the target strategy data does not comprise a second fixed value corresponding to the target register, setting the execution mark for the target operation instruction according to whether the target strategy data comprises the instruction information for prohibiting modification;
And executing the operation corresponding to the execution mark on the target register according to the execution mark.
In particular, when the second fixed value is present, unauthorized modification can be prevented, ensuring that the register value remains within a secure range, depending on the first new value and the second fixed value. When the second fixed value is not present but the instruction information for prohibiting modification is present, the modification operation is directly prevented, and the protection of the target register is further enhanced.
In an optional embodiment, the execution flag is a first flag or a second flag, where the first flag is used to indicate that the target operation instruction is executed, and the second flag is used to indicate that the target operation instruction is prohibited from being executed;
when the target policy data includes a second fixed value corresponding to the target register, setting an execution flag for the target operation instruction according to the first new value and the second fixed value, including:
comparing the first new value with the second fixed value;
when the comparison result is that the first new value is consistent with the second fixed value, setting an execution flag of the target operation instruction as the first flag;
Or alternatively
And when the comparison result is that the first new value is inconsistent with the second fixed value, setting an execution flag of the target operation instruction as the second flag.
Specifically, the scheme can ensure that the modification operation is allowed to be executed only when the new value is completely consistent with the preset fixed value, so that unauthorized modification is effectively prevented, and the safety of the virtual machine is improved.
In an optional implementation manner, when it is determined that the target policy data does not include the second fixed value corresponding to the target register, the setting the execution flag for the target operation instruction according to whether the target policy data includes the instruction information for prohibiting modification includes:
When the target policy data is determined to comprise the modification prohibition instruction information, setting an execution flag of the target operation instruction to the second flag;
Or alternatively
And when the target strategy data does not comprise the instruction information for prohibiting modification, setting an execution flag of the target operation instruction as the first flag.
Specifically, by prohibiting modification to a particular register, unauthorized modification can be effectively prevented, protecting the virtual machine from dangerous operations, and security is enhanced.
In an alternative embodiment, the performing, according to the execution flag, an operation corresponding to the execution flag on the target register includes:
when the execution flag is determined to be a first flag, updating the value in the target register according to the first new value;
Or alternatively
And when the execution flag is determined to be a second flag, not performing updating operation on the target register.
Specifically, by setting the execution flag, it is ensured that only authenticated and authorized operations can update the target register, unauthorized access or modification is effectively prevented, and security of the virtual machine is enhanced.
In an alternative embodiment, the method further comprises:
Determining whether the target policy data comprises indication information for enabling a log;
When determining that the target policy data comprises the indication information of enabling the log, setting a log record mark for the target operation instruction, wherein the log record mark is used for indicating recording policy verification information;
Or alternatively
And when determining that the indication information of enabling the log is not included in the target strategy data, not setting a log record mark for the target operation instruction.
In particular, for important and valuable events, by enabling the indication information of the log, the history record of the register operation is tracked, so that the analysis by subsequent technicians is facilitated, and the strategy is improved. For events with low value, only policy verification is performed to avoid security problems, log recording is not needed, and storage space can be saved.
In an alternative embodiment, the obtaining a first new value corresponding to the target operation instruction includes:
Acquiring a first operand stored in a first general register and a second operand stored in a second general register;
And obtaining the first new value according to the first operand and the second operand.
Specifically, a complete first new value may be obtained by combining operands stored in two general purpose registers separately.
In an alternative embodiment, the method further comprises:
When the target operation instruction is determined to be an instruction for creating a storage area according to the type of the target operation instruction, a first storage area and a second storage area are created according to the target operation instruction, wherein the first storage area is used for storing the strategy table, and the second storage area is used for storing a log.
In particular, by storing the policy table and log in separate areas, a clear classification and organization of data may be maintained, facilitating management and retrieval. Also, since policy tables may require frequent access, while journals are more focused on long-term storage and archiving, such separation may optimize the respective access and storage policies. In addition, since the policy table and the log may have different access modes and performance requirements, dividing the storage area is more conducive to flexibly setting the access modes of the policy table and the log.
In an alternative embodiment, the method further comprises:
when the target operation instruction is determined to be an instruction for acquiring negotiation information according to the type of the target operation instruction, acquiring target negotiation information;
Storing the target negotiation information in a virtual machine control structure body, and informing the virtual machine to read, wherein the target negotiation information is used for the virtual machine to perform matching operation with a virtual machine monitor according to the target negotiation information.
In particular, the negotiation information typically includes security parameters and the like regarding communication between the virtual machine and the virtual machine monitor. Through the matching operation of the negotiation information, the interaction safety between the virtual machine and the virtual machine monitor can be ensured, and unauthorized access or data leakage can be prevented.
In a second aspect, the present invention provides an apparatus for performing an operation on a register, the apparatus comprising:
The capturing module is used for capturing a target operation instruction, wherein the target operation instruction is an operation instruction for causing the virtual machine to be switched from a working state to an exit state;
the determining module is used for determining the type of the target operation instruction according to the target operation instruction;
The acquisition module is used for acquiring an original value corresponding to the target register when the target operation instruction is determined to be an instruction for operating the target register according to the type of the target operation instruction;
The determining module is further configured to determine, in a pre-constructed policy table, whether target policy data corresponding to the target register exists;
And the execution module is used for selecting one or more elements from the target policy data, the original value and the first new value when the target policy data exists in the policy table, and executing operation on the target register.
In a third aspect, the present invention provides a computer device comprising a memory and a processor, the memory and the processor being communicatively coupled to each other, the memory having stored therein computer instructions, the processor executing the computer instructions to perform the method of performing an operation on a register of the first aspect or any of its corresponding embodiments.
In a fourth aspect, the present invention provides a computer readable storage medium having stored thereon computer instructions for causing a computer to perform the method of performing an operation on a register of the first aspect or any of its corresponding embodiments.
In a fifth aspect, the present invention provides a computer program product comprising computer instructions for causing a computer to perform the method of performing an operation on a register of the first aspect or any of its corresponding embodiments.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the related art, the drawings that are required to be used in the description of the embodiments or the related art will be briefly described, and it is apparent that the drawings in the description below are some embodiments of the present invention, and other drawings may be obtained according to the drawings without inventive effort for those skilled in the art.
FIG. 1 is a system architecture diagram according to an embodiment of the present invention;
FIG. 2 is a flow diagram of a method of performing operations on registers according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of a policy enforcement flow for control registers according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of a policy enforcement flow of MSR registers according to an embodiment of the present invention;
FIG. 5 is a flow diagram of a method of setting a logging flag according to an embodiment of the present invention;
FIG. 6 is a flow chart of a negotiation method according to an embodiment of the present invention;
FIG. 7 is a flow chart of a method of creating a storage area according to an embodiment of the invention;
FIG. 8 is a flow chart of a method of writing strategy data according to an embodiment of the present invention;
FIG. 9 is a flow diagram of a method of deleting policy data according to an embodiment of the invention;
FIG. 10 is a block diagram of an apparatus for performing operations on registers according to an embodiment of the present invention;
Fig. 11 is a schematic diagram of a hardware structure of a computer device according to an embodiment of the present invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are some embodiments of the present invention, but not all embodiments of the present invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The following explains the technical terms related to the embodiments of the present invention.
Virtual machine Exit (Virtual Machine Exit, VM Exit), which refers to a "trap" operation triggered when certain sensitive instructions are executed in the Non-Root mode of the virtual machine, causes the processor to switch back from the Non-Root mode to Root mode (Root), i.e., back to the Virtual Machine Monitor (VMM) MACHINE MANAGER.
Virtual MACHINE ENTERY, VM Entry is a process corresponding to VM Exit, and when the Virtual machine monitor processes the sensitive instruction executed by the Virtual machine, the control right of the processor is given to the Virtual machine through VM Entry operation. This operation causes the processor to switch from the root mode to the non-root mode, allowing the virtual machine to continue running.
The virtual machine control structure (Virtual Machine Control Structure, VMCS) is a memory area for storing and managing state and control information of the virtual machine, etc. The right of the virtual machine to the data stored in the virtual machine control structure is read-only. The authority of the virtual machine monitor to the data stored in the virtual machine control structure is read/write.
The embodiment of the invention is applied to computer equipment, and a virtual machine monitor and at least one virtual machine can be installed on the computer equipment. For example, the computer device may be a server, a terminal, or the like. As shown in fig. 1, the virtual machine monitor may include an event filtering module and a policy verification module, and at least one storage area is managed, where each storage area has an association relationship with one virtual machine, that is, each virtual machine may perform operations of writing data and reading data in a corresponding storage area. The event filtering module may be configured to identify sensitive operations of the virtual machine, that is, capture target operation instructions. The policy validation module may be configured to perform a policy validation operation on the target operation instruction using the policy data in the policy table. The Virtual Machine may include a negotiation module, a policy management module, a log management module, and a Virtual Machine (VM) communication module. The negotiation module may be configured to perform authentication of negotiation information. The policy management module may be used for writing and deleting policy data, etc. The log management module may be used to read the log stored in the storage area. The communication module may be used to accomplish interactions of the virtual machine and the virtual machine monitor. The detailed operation of each module mentioned above may be referred to in the following, and will not be described herein.
The embodiment of the invention provides a method for executing operation on a register, which can improve the security of a virtual machine operating system by monitoring an instruction for executing operation on the register, and then performing policy verification and processing.
In accordance with an embodiment of the present invention, there is provided a method embodiment for performing operations on registers, it being noted that the steps shown in the flowchart of the figures may be performed in a computer system, such as a set of computer executable instructions, and, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in an order other than that shown or described herein.
In this embodiment, a method for performing an operation on a register is provided, which may be performed by the computer device described above, and fig. 2 is a flowchart of a method for performing an operation on a register according to an embodiment of the present invention, as shown in fig. 2, where the flowchart includes the following steps:
Step S201, capturing a target operation instruction.
The target operation instruction may be an operation instruction that causes the virtual machine to switch from the working state to the exit state. The target operation instruction may be an instruction to operate a target register, an instruction to acquire negotiation information, an instruction to create a storage area, an instruction to write policy data, an instruction to delete policy data, and the like. Taking the x86 instruction set as an example, the instruction to obtain negotiation information may be the cpuid instruction. The instruction for creating the storage area, the instruction for writing the policy data, and the instruction for deleting the policy data may be vmcall instructions, and the vmcall instructions may include custom parameters, where the custom parameters are different to indicate different instructions, for example, when the custom parameter is a, the vmcall instruction is an instruction for creating the storage area, and when the custom parameter is B, the vmcall instruction is an instruction for writing the policy data. The instructions operating on the target register may be movcr 0 instructions, rdmsr instructions, wrmsr instructions, and the like.
Specifically, after the virtual machine acquires the target operation instruction, the target operation instruction is executed, and information related to the target operation instruction is recorded in a designated area in the virtual machine control structure (Virtual Machine Control Structure, VMCS). And when the computer equipment monitors that the target operation instruction is a sensitive instruction (namely an instruction which can cause a security problem to the virtual machine), triggering the virtual machine to enter a VM Exit mode, namely entering processing logic of a virtual machine monitor (Virtual Machine Monitor, VMM). The event filtering module of the virtual machine monitor may read information about the target operation instruction from the specified area of the virtual machine control structure, that is, the target operation instruction is captured.
Step S202, determining the type of the target operation instruction according to the target operation instruction.
Wherein the type of the target operation instruction may be used to indicate the operation object. The operation object may be one of a register, a virtual machine, or a virtual machine monitor.
Specifically, the event filtering module analyzes the related information of the target operation instruction, and determines the type of the target operation instruction.
In step S203, when the target operation instruction is determined to be an instruction for operating the target register according to the type of the target operation instruction, the original value corresponding to the target register is obtained.
The target Register may be a Control Register (CR), a special module Register (Model SPECIFIC REGISTERS, MSR), or the like.
Specifically, when it is determined that the operation target is a control register according to the type of the target operation instruction, the original value is stored in a control register area in the virtual machine control structure body, and at this time, the original value can be read from the control register area. Or when the target register is an MSR register, the original value is stored in an MSR register area in the virtual machine control structure body, and the original value can be read from the MSR register area.
In step S204, a first new value corresponding to the target operation instruction is obtained.
Specifically, when the target register is a control register, a first new value may be read from a source register region in the virtual machine control fabric. Or when the destination register is an MSR register, the steps of obtaining a first operand stored in the first general purpose register and a second operand stored in the second general purpose register, and obtaining a first new value according to the first operand rax and the second operand rck (which are combined after bitwise operation of the first operand and the second operand). The first general-purpose register may be an eax register, and the second general-purpose register may be an edx register.
In step S205, in the pre-constructed policy table, it is determined whether or not there is target policy data corresponding to the target register.
The policy table may store a plurality of pieces of policy data, and policy identification information corresponding to each piece of policy data. The policy data may include a policy verification object and policy indication information, wherein the policy indication information may be one of indication information for prohibiting modification and a fixed value. The policy object may be a register. Since each bit of the control register corresponds to a function, when the policy object is the control register, the policy indication information may include at least one bit of policy indication information (i.e., at least one piece of policy sub-data). For example, for Write Protect bit (WP) of CR0 register, the program may read and Write any physical page when wp=0, and Write operation will be disabled for read-only physical pages when wp=1. And one MSR register is used to handle one function, such as performance monitoring, power management, virtualization support, etc. Or the policy data may also include log-enabled indication information. Or when the register is a control register, the log-enabled indication information may also be set at the granularity of bits.
Specifically, the policy verification module may match the policy object included in each piece of policy data in the policy table according to the identification information of the target register. When the policy data corresponding to the identification information of the target register is matched, it may be determined that the policy table has the target policy data corresponding to the target register. When the policy data corresponding to the identification information of the target register is not matched, the target operation instruction is indicated to be a safe operation instruction, and the target operation instruction can be directly executed.
In step S206, when it is determined that the target policy data exists in the policy table, one or more elements are selected from the target policy data, the original value, and the first new value, and an operation is performed on the target register.
Specifically, since there is a difference in the workflow of different registers, it is necessary to perform a policy verification process according to its own operating characteristics for different registers. The control register and the MSR register are respectively described as examples.
First, the target register is a control register.
Step one, exclusive-or operation is performed on the original value and the first new value to determine whether at least one modification bit exists.
Specifically, the policy validation module may traverse each bit of the original value (or the first new value), traverse to one bit each time, obtain a first value corresponding to the traversed bit from the original value, and obtain a second value corresponding to the traversed bit from the first new value, compare the first value with the second value, determine that the bit is not a modified bit if the two are the same, and determine that the bit is a modified bit if the two are different. Similarly, it may be determined whether a modification bit is present. If not, the target operation instruction is indicated to be a safe operation instruction and can be directly executed. If there is a modification bit, a subsequent step two may be performed.
And step two, when at least one modification bit exists, updating the value corresponding to each modification bit in the first new value according to each modification bit and the target strategy data to obtain a second new value.
Step 1, determining whether policy sub-data corresponding to the target modification bit exists in the target policy data according to the target modification bit.
Wherein the target modification bit is any one of the at least one modification bit.
Specifically, the policy validation module may traverse policy sub-data included in the target policy data according to the target modification bit to determine whether there is policy sub-data matching the target modification bit. If yes, the target operation instruction is indicated to be a safe operation instruction and can be directly executed. If not, a subsequent step 2 may be performed.
And 2, when determining that the target strategy data has strategy sub-data, updating a value corresponding to the target modification bit in the first new value according to the strategy sub-data.
Specifically, when it is determined that the policy sub-data includes a first fixed value corresponding to the target modification bit, a value corresponding to the target modification bit in the first new value is modified to the first fixed value. Or when the strategy sub-data is determined to comprise the instruction information for prohibiting modification, restoring the value corresponding to the target modification bit in the first new value into the value corresponding to the target modification bit in the original value.
And step 3, after the fact that all the modification bits of the strategy sub data exist are updated is determined, a second new value is obtained.
And step three, according to the second new value, updating the target register.
Specifically, the virtual machine monitor may update the original value in the target register to the second new value.
The policy enforcement flow for the control registers is shown in fig. 3.
Second, the destination register is an MSR register.
When the target strategy data comprises a second fixed value corresponding to the target register, setting an execution mark for the target operation instruction according to the first new value and the second fixed value.
Wherein the execution flag is a first flag or a second flag. The first flag is used for indicating execution of the target operation instruction, and the second flag is used for indicating prohibition of execution of the target operation instruction. For example, the first flag may be "allow" and the second flag may be "redirect".
Specifically, the specific step of setting the execution flag for the target operation instruction according to the first new value and the second fixed value may include:
and step 1, comparing the first new value with the second fixed value.
And step 2, setting the execution flag of the target operation instruction as a first flag when the comparison result is that the first new value is consistent with the second fixed value.
And step 3, setting the execution flag of the target operation instruction as a second flag when the comparison result is that the first new value is inconsistent with the second fixed value.
And step two, when the fact that the target strategy data does not comprise the second fixed value corresponding to the target register is determined, setting an execution mark for the target operation instruction according to whether the target strategy data comprises the instruction information for prohibiting modification.
Specifically, when it is determined that the instruction information for prohibiting modification is included in the target policy data, the execution flag of the target operation instruction may be set to the second flag. Or when it is determined that the instruction information for prohibiting modification is not included in the target policy data, the execution flag of the target operating instruction may be set to the first flag.
And step three, executing the operation corresponding to the execution mark on the target register according to the execution mark.
Specifically, when the execution flag is determined to be the first flag, the value in the target register is updated according to the first new value, i.e., the original value in the target register is updated to the first new value. Or when the execution flag is determined to be the second flag, the update operation is not performed on the target register.
The policy enforcement flow for the MSR register is shown in FIG. 4.
In the method for executing the operation on the register provided in this embodiment, since the modification of the value in the register is the bottommost modification, although some software bypasses the kernel reinforcement technology, the method directly intercepts the target operation instruction at the register layer, and can execute the operation on the target register after specifically analyzing the target operation instruction according to the policy data in the policy table constructed in advance and the obtained original value and the first new value of the target register. In this way, virtual machine security problems caused by some software directly modifying the values in the registers can be avoided.
In this embodiment, a method for setting a logging flag is provided, which may be executed by the above-mentioned computer device, and fig. 5 is a flowchart of a method for setting a logging flag according to an embodiment of the present invention, as shown in fig. 5, where the flowchart includes the following steps:
in step S501, it is determined whether the indication information of enabling the log is included in the target policy data.
In step S502, when it is determined that the indication information for enabling the log is included in the target policy data, a log record flag is set for the target operation instruction.
Wherein the log record flag is used for indicating the record strategy verification information. The policy verification information may include the modification result, for example, the second new value.
In step S503, when it is determined that the instruction information for enabling the log is not included in the target policy data, the log record flag is not set for the target operation instruction.
Thus, for the control register, it may be determined whether the target operation instruction is set with the log record flag after the update operation is performed on the control register, and if so, policy verification information in the flow shown in fig. 2 (shown in fig. 4) may be recorded. For the MSR register, it may be determined whether the target operation instruction is set with the logging flag after setting the logging flag, and if so, policy verification information in the flow as shown in FIG. 2 may be recorded (as shown in FIG. 5).
The method for setting the log record mark provided by the embodiment is beneficial to tracking the history record of the register operation by enabling the indication information of the log for important and valuable events, so that the analysis by subsequent technicians is facilitated, and the strategy is improved. For events with low value, only policy verification is performed to avoid security problems, log recording is not needed, and storage space can be saved.
Since there are various cases of the target operation instruction, such as an instruction to operate the target register, an instruction to acquire negotiation information, an instruction to create a storage area, an instruction to write policy data, an instruction to delete policy data, and the like, steps S203 to S206 are mainly described with respect to the policy verification process of the instruction to operate the target register. The execution of the target operation instruction for other cases will be specifically described below.
First, a negotiation method. And when the target operation instruction is determined to be the instruction for acquiring the negotiation information according to the type of the target operation instruction, acquiring the target negotiation information. The target negotiation information is stored in the virtual machine control structure body, and the virtual machine is informed to read.
The target negotiation information is used for the virtual machine to perform matching operation with the virtual machine monitor according to the target negotiation information. The target negotiation information is a message determined in advance by the virtual machine negotiation module and the virtual machine monitor, and is not limited to specific content, and only needs to be approved by the negotiation module.
Specifically, as shown in fig. 6, the negotiation module executes cpuid an instruction (relevant information of the instruction is recorded in the virtual machine control structure body), triggers a negotiation information request, further triggers VM Exit, and jumps to the processing logic of the virtual machine monitor. The virtual machine monitor may acquire cpuid instructions from the virtual machine control structure, determine that the reason for the virtual machine exit event is to execute cpuid instructions, that is, the virtual machine monitor captures a target operation instruction, and determine that the target operation instruction is an instruction for acquiring negotiation information. At this time, the virtual machine monitor stores the designated negotiation information (target negotiation information) in the virtual machine control structure, triggers VM Entry (also referred to as VM Resume), and jumps to the processing logic of the virtual machine. The virtual machine can acquire the target negotiation information from the virtual machine control structure body, determine whether to run in a matched virtual machine monitor according to whether the target negotiation information carries the mark information matched with the virtual machine control structure body, and if so, can perform the subsequent operation of creating the storage area.
Second, a method of creating a storage area. When the target operation instruction is determined to be an instruction for creating a storage area according to the type of the target operation instruction, a first storage area and a second storage area are created according to the target operation instruction.
The first storage area is used for storing a policy table, and the second storage area is used for storing a log. The first storage area is read only for the virtual machine, the virtual machine monitor is read only, and the second storage area is read only for the virtual machine, and the virtual monitor is read only.
Specifically, as shown in fig. 7, the virtual machine executes vmcall an instruction (the relevant information of the instruction is recorded in the virtual machine control structure), triggers an initialization request, further triggers VM Exit, and jumps to the processing logic of the virtual machine monitor. The virtual machine monitor may acquire vmcall instructions from the virtual machine control structure, determine that the reason for the virtual machine exit event is to execute vmcall instructions, that is, the virtual machine monitor captures a target operation instruction, and determine, according to a first custom parameter in the vmcall instruction, that the target operation instruction is an instruction for creating a storage area. The virtual machine monitor performs an operation of initializing the shared memory area, divides the shared memory area into a policy area (first storage area) and a log area (second storage area), stores the position information of the first storage area and the position information of the second storage area as return values in the virtual machine control structure, triggers the VM Entry, and jumps to the processing logic of the virtual machine. The virtual machine may acquire the position information of the first storage area and the position information of the second storage area from the virtual machine control structure body, and map the position information of the first storage area and the position information of the second storage area to perform subsequent operations of writing policy data and reading log data.
Third, a method of writing policy data. And when the target operation instruction is determined to be the instruction for writing the strategy data according to the type of the target operation instruction, acquiring a plurality of pieces of strategy data written by the virtual machine from the first storage area. And constructing a policy table according to the plurality of policies.
Specifically, as shown in fig. 8, after the virtual machine acquires a plurality of pieces of policy data, the virtual machine may encapsulate the policy enabling command, and write the acquired policy data into the first storage area according to the encapsulated policy enabling command. The virtual machine may then execute vmcall an instruction (the relevant information for which is recorded in the virtual machine control structure), trigger an initialization policy request, further trigger VM Exit, and jump to the processing logic of the virtual machine monitor. The virtual machine monitor can acquire vmcall instructions from the virtual machine control structure body, determines that the reason for the virtual machine exit event is that vmcall instructions are executed, namely, the virtual machine monitor captures a target operation instruction, and when determining that the target operation instruction is an instruction for creating a storage area according to a second custom parameter in vmcall instructions, converts policy data written into the first storage area to generate a policy table.
Fourth, a method of deleting policy data. And when the target operation instruction is determined to be the instruction for deleting the strategy data according to the type of the target operation instruction, acquiring the first strategy identification information. And deleting the strategy data corresponding to the first strategy identification information from the strategy table according to the first strategy identification information.
Specifically, as shown in fig. 9, after the virtual machine obtains the first policy identification information, the virtual machine may encapsulate the first policy identification information into a policy shutdown instruction, and write the obtained first policy identification information into the first storage area according to the policy shutdown instruction. The virtual machine may then execute vmcall an instruction (the relevant information for which is recorded in the virtual machine control structure), trigger a delete policy request, further trigger VM Exit, and jump to the processing logic of the virtual machine monitor. When the virtual machine monitor acquires vmcall instructions from the virtual machine control structure, namely the virtual machine monitor captures a target operation instruction and determines that the target operation instruction is an instruction for deleting policy data according to a third user-defined parameter in the vmcall instructions, first policy identification information is acquired from the first storage area, and policy data corresponding to the first policy identification information is determined in a policy table according to the first policy identification information and deleted.
In some alternative embodiments, since various software updates that pose security problems to the virtual machine are faster, the policy data needs to be updated accordingly. The virtual machine may extract the second policy identification information and the modified policy data from the policy data update instruction after the policy data update instruction is acquired, and write the second policy identification information into the first storage area. When the virtual machine monitor is in a state of not performing policy verification, the second policy identification information and the modified policy data can be extracted from the first storage area, the policy data corresponding to the second policy identification information is determined in the policy table according to the second policy identification information to be deleted, and the modified policy data is supplemented. Therefore, the method can keep updating of the strategy data, can defend the damage of the latest software to the virtual machine, and improves the safety of the virtual machine.
In some optional embodiments, after the virtual machine monitor identifies that the number of the logs in the second storage area is greater than the preset threshold, the virtual machine may be notified, and the virtual machine reads all the logs from the second storage area, after the virtual machine completes the reading operation, the virtual machine monitor may delete the logs in time, so as to avoid the problem that after the second storage data is full, important logs cannot be stored, which results in the subsequent failure of technical analysis by a technician.
In some alternative embodiments, a third storage area may also be created, in which the policy table is backed up. When the fact that the strategy data stored in the first storage area are lost or the first storage area is damaged by related software is detected, the backup strategy table is read from the third storage area and is processed in time, and the virtual machine security problem caused by incapability of performing strategy verification is prevented. The security level can be further improved by the backup operation.
In this embodiment, a device for performing an operation on a register is further provided, and the device is used to implement the foregoing embodiments and preferred embodiments, and will not be described again. As used below, the term "module" may be a combination of software and/or hardware that implements a predetermined function. While the means described in the following embodiments are preferably implemented in software, implementation in hardware, or a combination of software and hardware, is also possible and contemplated.
The present embodiment provides an apparatus for performing an operation on a register, as shown in fig. 10, including:
The capturing module 1001 is configured to capture a target operation instruction, where the target operation instruction is an operation instruction that causes the virtual machine to switch from a working state to an exit state;
a determining module 1002, configured to determine a type of the target operation instruction according to the target operation instruction;
An obtaining module 1003, configured to obtain an original value corresponding to the target register when the target operation instruction is determined to be an instruction for operating the target register according to the type of the target operation instruction;
The determining module 1002 is further configured to determine, in a pre-constructed policy table, whether target policy data corresponding to the target register exists;
The executing module 1004 is configured to, when it is determined that the target policy data exists in the policy table, select one or more elements from the target policy data, the original value, and the first new value, and execute an operation on the target register.
In an alternative embodiment, the destination register is a control register;
The execution module 1004 is specifically configured to:
Exclusive-or operating the original value and the first new value to determine whether at least one modification bit exists;
when at least one modification bit exists, updating a value corresponding to each modification bit in the first new value according to each modification bit and target strategy data to obtain a second new value;
And according to the second new value, performing an updating operation on the target register.
In an alternative embodiment, execution module 1004 is specifically configured to:
Determining whether policy sub-data corresponding to the target modification bit exists in the target policy data according to the target modification bit, wherein the target modification bit is any modification bit in at least one modification bit;
When determining that the target strategy data has strategy sub-data, updating a value corresponding to the target modification bit in the first new value according to the strategy sub-data;
after determining that the modified bits of the policy sub-data are all updated, a second new value is obtained.
In an alternative embodiment, execution module 1004 is specifically configured to:
when the strategy sub-data comprises a first fixed value corresponding to the target modification bit, modifying a value corresponding to the target modification bit in the first new value into the first fixed value;
Or alternatively
And when determining that the strategy sub-data comprises the instruction information for prohibiting modification, restoring the value corresponding to the target modification bit in the first new value into the value corresponding to the target modification bit in the original value.
In an alternative embodiment, the destination register is a special module MSR register;
The execution module 1004 is specifically configured to:
When the target strategy data comprises a second fixed value corresponding to the target register, setting an execution mark for the target operation instruction according to the first new value and the second fixed value;
Or alternatively
When the target strategy data does not comprise a second fixed value corresponding to the target register, setting an execution mark for the target operation instruction according to whether the target strategy data comprises the instruction information for prohibiting modification or not;
and executing the operation corresponding to the execution flag on the target register according to the execution flag.
In an alternative embodiment, the execution flag is a first flag or a second flag, where the first flag is used to indicate that the target operation instruction is executed, and the second flag is used to indicate that the target operation instruction is prohibited from being executed;
The execution module 1004 is specifically configured to:
comparing the first new value with the second fixed value;
When the comparison result is that the first new value is consistent with the second fixed value, setting an execution mark of the target operation instruction as a first mark;
Or alternatively
And when the comparison result is that the first new value is inconsistent with the second fixed value, setting the execution flag of the target operation instruction as a second flag.
In an alternative embodiment, execution module 1004 is specifically configured to:
When the target policy data comprises the instruction information for prohibiting modification, setting an execution flag of the target operation instruction as a second flag;
Or alternatively
When it is determined that the instruction information for prohibiting modification is not included in the target policy data, an execution flag of the target operating instruction is set to a first flag.
In an alternative embodiment, execution module 1004 is specifically configured to:
when the execution flag is determined to be the first flag, updating the value in the target register according to the first new value;
Or alternatively
When the execution flag is determined to be the second flag, the update operation is not performed on the target register.
In an alternative embodiment, the apparatus further comprises a setting module 1005, the setting module 1005 being configured to:
determining whether the target policy data comprises indication information for enabling the log;
When determining that the target strategy data comprises indication information for enabling the log, setting a log record mark for the target operation instruction, wherein the log record mark is used for indicating to record strategy verification information;
Or alternatively
When it is determined that the indication information for enabling the log is not included in the target policy data, a log record flag is not set for the target operation instruction.
In an alternative embodiment, the obtaining module 1003 is specifically configured to:
Acquiring a first operand stored in a first general register and a second operand stored in a second general register;
a first new value is obtained based on the first operand and the second operand.
In an alternative embodiment, the apparatus further comprises a creation module 1006, the creation module 1006 for:
when the target operation instruction is determined to be an instruction for creating a storage area according to the type of the target operation instruction, a first storage area and a second storage area are created according to the target operation instruction, wherein the first storage area is used for storing a policy table, and the second storage area is used for storing a log.
In an alternative embodiment, the obtaining module 1003 is further configured to:
When the target operation instruction is determined to be an instruction for acquiring negotiation information according to the type of the target operation instruction, acquiring the target negotiation information;
storing target negotiation information in a virtual machine control structure body, and informing a virtual machine to read, wherein the target negotiation information is used for the virtual machine to perform matching operation with a virtual machine monitor according to the target negotiation information.
Further functional descriptions of the above respective modules and units are the same as those of the above corresponding embodiments, and are not repeated here.
The means for performing operations on registers in this embodiment are presented as functional units, where the units are ASIC (Application SPECIFIC INTEGRATED Circuit) circuits, processors and memory that execute one or more software or firmware programs, and/or other devices that can provide the functionality described above.
The embodiment of the invention also provides a computer device which is provided with the device for executing the operation on the register shown in the figure 10.
Referring to fig. 11, fig. 11 is a schematic structural diagram of a computer device according to an alternative embodiment of the present invention, and as shown in fig. 11, the computer device includes one or more processors 10, a memory 20, and interfaces for connecting components, including a high-speed interface and a low-speed interface. The various components are communicatively coupled to each other using different buses and may be mounted on a common motherboard or in other manners as desired. The processor may process instructions executing within the computer device, including instructions stored in or on memory to display graphical information of the GUI on an external input/output device, such as a display device coupled to the interface. In some alternative embodiments, multiple processors and/or multiple buses may be used, if desired, along with multiple memories and multiple memories. Also, multiple computer devices may be connected, each providing a portion of the necessary operations (e.g., as a server array, a set of blade servers, or a multiprocessor system). One processor 10 is illustrated in fig. 11.
The processor 10 may be a central processor, a network processor, or a combination thereof. The processor 10 may further include a hardware chip, among others. The hardware chip may be an application specific integrated circuit, a programmable logic device, or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general-purpose array logic, or any combination thereof.
Wherein the memory 20 stores instructions executable by the at least one processor 10 to cause the at least one processor 10 to perform the methods shown in implementing the above embodiments.
The memory 20 may include a storage program area that may store an operating system, application programs required for at least one function, and a storage data area that may store data created according to the use of the computer device, etc. In addition, the memory 20 may include high-speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid-state storage device. In some alternative embodiments, memory 20 may optionally include memory located remotely from processor 10, which may be connected to the computer device via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The memory 20 may comprise volatile memory, such as random access memory, or nonvolatile memory, such as flash memory, hard disk or solid state disk, or the memory 20 may comprise a combination of the above types of memory.
The computer device further comprises input means 30 and output means 40. The processor 10, memory 20, input device 30, and output device 40 may be connected by a bus or other means, for example in fig. 11.
The input device 30 may receive input numeric or character information and generate key signal inputs related to user settings and function control of the computer apparatus, such as a touch screen, a keypad, a mouse, a trackpad, a touchpad, a pointer stick, one or more mouse buttons, a trackball, a joystick, and the like. The output means 40 may include a display device, auxiliary lighting means (e.g., LEDs), tactile feedback means (e.g., vibration motors), and the like. Such display devices include, but are not limited to, liquid crystal displays, light emitting diodes, displays and plasma displays. In some alternative implementations, the display device may be a touch screen.
The computer device also includes a communication interface 30 for the computer device to communicate with other devices or communication networks.
The embodiments of the present invention also provide a computer readable storage medium, and the method according to the embodiments of the present invention described above may be implemented in hardware, firmware, or as a computer code which may be recorded on a storage medium, or as original stored in a remote storage medium or a non-transitory machine readable storage medium downloaded through a network and to be stored in a local storage medium, so that the method described herein may be stored on such software process on a storage medium using a general purpose computer, a special purpose processor, or programmable or special purpose hardware. The storage medium may be a magnetic disk, an optical disk, a read-only memory, a random-access memory, a flash memory, a hard disk, a solid state disk, or the like, and further, the storage medium may further include a combination of the above types of memories. It will be appreciated that a computer, processor, microprocessor controller or programmable hardware includes a storage element that can store or receive software or computer code that, when accessed and executed by the computer, processor or hardware, implements the methods illustrated by the above embodiments.
Portions of the present invention may be implemented as a computer program product, such as computer program instructions, which when executed by a computer, may invoke or provide methods and/or aspects in accordance with the present invention by way of operation of the computer. Those skilled in the art will appreciate that the existence of computer program instructions in a computer-readable medium includes, but is not limited to, source files, executable files, installation package files, and the like, and accordingly, the manner in which computer program instructions are executed by a computer includes, but is not limited to, the computer directly executing the instructions, or the computer compiling the instructions and then executing the corresponding compiled programs, or the computer reading and executing the instructions, or the computer reading and installing the instructions and then executing the corresponding installed programs. Herein, a computer-readable medium may be any available computer-readable storage medium or communication medium that can be accessed by a computer.
Although embodiments of the present invention have been described in connection with the accompanying drawings, various modifications and variations may be made by those skilled in the art without departing from the spirit and scope of the invention, and such modifications and variations fall within the scope of the invention as defined by the appended claims.

Claims (15)

Translated fromChinese
1.一种对寄存器执行操作的方法,其特征在于,所述方法包括:1. A method for performing an operation on a register, characterized in that the method comprises:捕获目标操作指令,其中,所述目标操作指令为对目标寄存器进行操作的指令、获取协商信息的指令、创建存储区域的指令、写入策略数据的指令、删除策略数据的指令中的一种,所述协商信息用于匹配虚拟机和虚拟机监视器,所述目标寄存器为控制寄存器或模块特定寄存器MSR,所述对目标寄存器进行操作的指令、所述获取协商信息的指令、所述创建存储区域的指令、所述写入策略数据的指令、所述删除策略数据的指令均为导致所述虚拟机从工作状态切换为退出状态的指令;Capturing a target operation instruction, wherein the target operation instruction is one of an instruction to operate a target register, an instruction to obtain negotiation information, an instruction to create a storage area, an instruction to write policy data, and an instruction to delete policy data, the negotiation information is used to match a virtual machine and a virtual machine monitor, the target register is a control register or a module specific register MSR, and the instruction to operate the target register, the instruction to obtain negotiation information, the instruction to create a storage area, the instruction to write policy data, and the instruction to delete policy data are all instructions that cause the virtual machine to switch from a working state to an exit state;根据所述目标操作指令,确定所述目标操作指令的类型,其中,所述目标操作指令的类型用于指示所述目标操作指令的操作对象,所述操作对象为所述目标寄存器、所述虚拟机和所述虚拟机监视器中的一种;Determine, according to the target operation instruction, a type of the target operation instruction, wherein the type of the target operation instruction is used to indicate an operation object of the target operation instruction, and the operation object is one of the target register, the virtual machine, and the virtual machine monitor;当根据所述目标操作指令的类型,确定所述目标操作指令为所述对目标寄存器进行操作的指令时,获取与所述目标寄存器对应的原值;When it is determined according to the type of the target operation instruction that the target operation instruction is the instruction for operating the target register, obtaining an original value corresponding to the target register;获取与所述目标操作指令对应的第一新值;Acquire a first new value corresponding to the target operation instruction;在预构建的策略表中,确定是否存在与所述目标寄存器对应的目标策略数据,其中,所述目标策略数据中包括策略验证对象和策略指示信息,当所述策略验证对象为所述MSR时,所述策略指示信息包括一条,或者,当所述策略验证对象为所述控制寄存器时,所述策略指示信息包括至少一条策略子数据,每一条所述策略子数据为所述控制寄存器中对应比特位的策略指示信息,所述策略指示信息为禁止修改的指示信息或固定值;In the pre-built policy table, determine whether there is target policy data corresponding to the target register, wherein the target policy data includes a policy verification object and policy indication information, when the policy verification object is the MSR, the policy indication information includes one piece, or when the policy verification object is the control register, the policy indication information includes at least one policy sub-data, each of which is the policy indication information of the corresponding bit in the control register, and the policy indication information is indication information prohibited from modification or a fixed value;当确定所述策略表中存在所述目标策略数据时,根据所述目标策略数据、所述原值,以及所述第一新值中的多个元素,对所述目标寄存器执行操作。When it is determined that the target policy data exists in the policy table, an operation is performed on the target register according to the target policy data, the original value, and a plurality of elements in the first new value.2.根据权利要求1所述的方法,其特征在于,所述目标寄存器为所述控制寄存器;2. The method according to claim 1, wherein the target register is the control register;所述当确定所述策略表中存在所述目标策略数据时,根据所述目标策略数据、所述原值,以及所述第一新值中的多个元素,对所述目标寄存器执行操作,包括:When it is determined that the target policy data exists in the policy table, performing an operation on the target register according to the target policy data, the original value, and multiple elements in the first new value, including:对所述原值和所述第一新值进行异或操作,确定是否存在至少一个修改位;Performing an XOR operation on the original value and the first new value to determine whether there is at least one modified bit;当确定存在至少一个所述修改位时,根据每一个所述修改位和所述目标策略数据,对所述第一新值中与每一个所述修改位对应的值进行更新,得到第二新值;When it is determined that there is at least one modification bit, updating the value corresponding to each modification bit in the first new value according to each modification bit and the target policy data to obtain a second new value;根据所述第二新值,对所述目标寄存器执行更新操作。An update operation is performed on the target register according to the second new value.3.根据权利要求2所述的方法,其特征在于,所述当确定存在至少一个所述修改位时,根据每一个所述修改位和所述目标策略数据,对所述第一新值中与每一个所述修改位对应的值进行更新,得到第二新值,包括:3. The method according to claim 2, characterized in that when it is determined that there is at least one modification bit, updating the value corresponding to each modification bit in the first new value according to each modification bit and the target policy data to obtain the second new value, comprises:根据目标修改位,确定所述目标策略数据中是否存在与所述目标修改位对应的策略子数据,其中,所述目标修改位为至少一个所述修改位中的任一个修改位;According to the target modification bit, determining whether there is policy sub-data corresponding to the target modification bit in the target policy data, wherein the target modification bit is any modification bit of at least one of the modification bits;当确定所述目标策略数据中存在所述策略子数据时,根据所述策略子数据,对所述第一新值中与所述目标修改位对应的值进行更新;When it is determined that the policy sub-data exists in the target policy data, updating the value corresponding to the target modification bit in the first new value according to the policy sub-data;在确定存在策略子数据的修改位均被执行更新操作后,得到所述第二新值。After determining that all modification bits of the existing policy sub-data have been updated, the second new value is obtained.4.根据权利要求3所述的方法,其特征在于,所述当确定所述目标策略数据中存在所述策略子数据时,根据所述策略子数据,对所述第一新值中与所述目标修改位对应的值进行更新,包括:4. The method according to claim 3, characterized in that when it is determined that the target policy data contains the policy sub-data, updating the value corresponding to the target modification bit in the first new value according to the policy sub-data comprises:当确定所述策略子数据中包括与所述目标修改位对应的第一固定值时,将所述第一新值中与所述目标修改位对应的值修改为所述第一固定值;When it is determined that the policy sub-data includes a first fixed value corresponding to the target modification bit, modifying the value corresponding to the target modification bit in the first new value to the first fixed value;或者,or,当确定所述策略子数据中包括所述禁止修改的指示信息时,将所述第一新值中与所述目标修改位对应的值进行还原为所述原值中与所述目标修改位对应的值。When it is determined that the policy sub-data includes the indication information of prohibiting modification, the value corresponding to the target modification bit in the first new value is restored to the value corresponding to the target modification bit in the original value.5.根据权利要求1所述的方法,其特征在于,所述目标寄存器为所述MSR;5. The method according to claim 1, wherein the target register is the MSR;所述当确定所述策略表中存在所述目标策略数据时,根据所述目标策略数据、所述原值,以及所述第一新值中的多个元素,对所述目标寄存器执行操作,包括:When it is determined that the target policy data exists in the policy table, performing an operation on the target register according to the target policy data, the original value, and multiple elements in the first new value, including:当确定所述目标策略数据中包括与所述目标寄存器对应的第二固定值时,根据所述第一新值和所述第二固定值,对所述目标操作指令设置执行标志;When it is determined that the target policy data includes a second fixed value corresponding to the target register, setting an execution flag for the target operation instruction according to the first new value and the second fixed value;或者,or,当确定所述目标策略数据中不包括与所述目标寄存器对应的第二固定值时,根据所述目标策略数据中是否包括所述禁止修改的指示信息,对所述目标操作指令设置所述执行标志;When it is determined that the target policy data does not include the second fixed value corresponding to the target register, setting the execution flag for the target operation instruction according to whether the target policy data includes the instruction information prohibiting modification;根据所述执行标志,对所述目标寄存器执行与所述执行标志对应的操作。According to the execution flag, an operation corresponding to the execution flag is performed on the target register.6.根据权利要求5所述的方法,其特征在于,所述执行标志为第一标志或第二标志,其中,所述第一标志用于指示执行所述目标操作指令,所述第二标志用于指示禁止执行所述目标操作指令;6. The method according to claim 5, characterized in that the execution flag is a first flag or a second flag, wherein the first flag is used to indicate that the target operation instruction is executed, and the second flag is used to indicate that the target operation instruction is prohibited from being executed;所述当确定所述目标策略数据中包括与所述目标寄存器对应的第二固定值时,根据所述第一新值和所述第二固定值,对所述目标操作指令设置执行标志,包括:When it is determined that the target policy data includes a second fixed value corresponding to the target register, setting an execution flag for the target operation instruction according to the first new value and the second fixed value includes:对所述第一新值和所述第二固定值进行比较;comparing the first new value and the second fixed value;当比较结果为所述第一新值和所述第二固定值一致时,将所述目标操作指令的执行标志设置为所述第一标志;When the comparison result is that the first new value and the second fixed value are consistent, setting the execution flag of the target operation instruction to the first flag;或者,or,当比较结果为所述第一新值和所述第二固定值不一致时,将所述目标操作指令的执行标志设置为所述第二标志。When the comparison result is that the first new value and the second fixed value are inconsistent, the execution flag of the target operation instruction is set to the second flag.7.根据权利要求6所述的方法,其特征在于,所述当确定所述目标策略数据中不包括与所述目标寄存器对应的第二固定值时,根据所述目标策略数据中是否包括禁止修改的指示信息,对所述目标操作指令设置所述执行标志,包括:7. The method according to claim 6, characterized in that when it is determined that the target policy data does not include the second fixed value corresponding to the target register, setting the execution flag for the target operation instruction according to whether the target policy data includes indication information prohibiting modification, comprises:当确定所述目标策略数据中包括所述禁止修改的指示信息时,将所述目标操作指令的执行标志设置为所述第二标志;When it is determined that the target policy data includes the instruction information prohibiting modification, setting the execution flag of the target operation instruction to the second flag;或者,or,当确定所述目标策略数据中不包括所述禁止修改的指示信息时,将所述目标操作指令的执行标志设置为所述第一标志。When it is determined that the target policy data does not include the instruction information prohibiting modification, the execution flag of the target operation instruction is set to the first flag.8.根据权利要求5所述的方法,其特征在于,所述根据所述执行标志,对所述目标寄存器执行与所述执行标志对应的操作,包括:8. The method according to claim 5, wherein the step of performing an operation corresponding to the execution flag on the target register according to the execution flag comprises:当确定所述执行标志为第一标志时,根据所述第一新值,对所述目标寄存器中的值进行更新操作;When it is determined that the execution flag is the first flag, updating the value in the target register according to the first new value;或者,or,当确定所述执行标志为第二标志时,不对所述目标寄存器进行更新操作。When it is determined that the execution flag is the second flag, no update operation is performed on the target register.9.根据权利要求1至8任一项所述的方法,其特征在于,所述方法还包括:9. The method according to any one of claims 1 to 8, characterized in that the method further comprises:确定所述目标策略数据中是否包括启用日志的指示信息;Determining whether the target policy data includes instruction information for enabling logging;当确定所述目标策略数据中包括所述启用日志的指示信息时,对所述目标操作指令设置日志记录标志,其中,所述日志记录标志用于指示记录策略验证信息;When it is determined that the target policy data includes the instruction information for enabling the log, setting a log record flag for the target operation instruction, wherein the log record flag is used to indicate recording policy verification information;或者,or,当确定所述目标策略数据中不包括所述启用日志的指示信息时,不对所述目标操作指令设置日志记录标志。When it is determined that the target policy data does not include the instruction information for enabling the log, a log record flag is not set for the target operation instruction.10.根据权利要求5所述的方法,其特征在于,所述获取与所述目标操作指令对应的第一新值,包括:10. The method according to claim 5, wherein obtaining a first new value corresponding to the target operation instruction comprises:获取第一通用寄存器中存储的第一操作数和第二通用寄存器中存储的第二操作数;Obtaining a first operand stored in a first general register and a second operand stored in a second general register;根据所述第一操作数和第二操作数,得到所述第一新值。The first new value is obtained according to the first operand and the second operand.11.根据权利要求9所述的方法,其特征在于,所述方法还包括:11. The method according to claim 9, characterized in that the method further comprises:当根据所述目标操作指令的类型,确定所述目标操作指令为所述创建存储区域的指令时,根据所述目标操作指令,创建第一存储区域和第二存储区域,其中,所述第一存储区域用于存储所述策略表,所述第二存储区域用于存储日志。When it is determined that the target operation instruction is an instruction for creating a storage area based on the type of the target operation instruction, a first storage area and a second storage area are created based on the target operation instruction, wherein the first storage area is used to store the policy table and the second storage area is used to store the log.12.根据权利要求1至8任一项所述的方法,其特征在于,所述方法还包括:12. The method according to any one of claims 1 to 8, characterized in that the method further comprises:当根据所述目标操作指令的类型,确定所述目标操作指令为所述获取协商信息的指令时,获取目标协商信息;When it is determined according to the type of the target operation instruction that the target operation instruction is the instruction for obtaining negotiation information, obtaining target negotiation information;将所述目标协商信息存储在虚拟机控制结构体中,并通知所述虚拟机进行读取,以使所述虚拟机根据所述目标协商信息与虚拟机监视器进行匹配操作。The target negotiation information is stored in a virtual machine control structure, and the virtual machine is notified to read the information, so that the virtual machine performs a matching operation with a virtual machine monitor according to the target negotiation information.13.一种计算机设备,其特征在于,包括:13. A computer device, comprising:存储器和处理器,所述存储器和所述处理器之间互相通信连接,所述存储器中存储有计算机指令,所述处理器通过执行所述计算机指令,从而执行权利要求1至12中任一项所述的对寄存器执行操作的方法。A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the method for performing operations on a register according to any one of claims 1 to 12 by executing the computer instructions.14.一种计算机可读存储介质,其特征在于,所述计算机可读存储介质上存储有计算机指令,所述计算机指令用于使计算机执行权利要求1至12中任一项所述的对寄存器执行操作的方法。14. A computer-readable storage medium, characterized in that computer instructions are stored on the computer-readable storage medium, and the computer instructions are used to enable a computer to execute the method for performing an operation on a register according to any one of claims 1 to 12.15.一种计算机程序产品,其特征在于,包括计算机指令,所述计算机指令用于使计算机执行权利要求1至12中任一项所述的对寄存器执行操作的方法。15 . A computer program product, comprising computer instructions, wherein the computer instructions are used to enable a computer to execute the method for performing an operation on a register according to any one of claims 1 to 12.
CN202410987349.2A2024-07-232024-07-23 Method for performing operations on registers, computer device, storage medium and program productActiveCN118520464B (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN202410987349.2ACN118520464B (en)2024-07-232024-07-23 Method for performing operations on registers, computer device, storage medium and program product

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN202410987349.2ACN118520464B (en)2024-07-232024-07-23 Method for performing operations on registers, computer device, storage medium and program product

Publications (2)

Publication NumberPublication Date
CN118520464A CN118520464A (en)2024-08-20
CN118520464Btrue CN118520464B (en)2024-12-03

Family

ID=92277135

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN202410987349.2AActiveCN118520464B (en)2024-07-232024-07-23 Method for performing operations on registers, computer device, storage medium and program product

Country Status (1)

CountryLink
CN (1)CN118520464B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN103765401A (en)*2011-04-072014-04-30威盛电子股份有限公司 A microprocessor that compiles conditional load/store instructions into a variable number of microinstructions
CN114168196A (en)*2021-11-192022-03-11中科可控信息产业有限公司Register control method, system, device, computer equipment and storage medium
CN114880030A (en)*2022-05-162022-08-09海光信息技术股份有限公司 Instruction decoding method and device, electronic device, and storage medium

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN100530164C (en)*2007-12-292009-08-19中国科学院计算技术研究所RISC processor and its register flag bit processing method
CN101221496B (en)*2008-01-232011-10-26中国科学院计算技术研究所RISC processor device and data processing method thereof
EP2367102B1 (en)*2010-02-112013-04-10Nxp B.V.Computer processor and method with increased security properties
US20120173851A1 (en)*2010-12-302012-07-05International Business Machines CorporationMechanism for maintaining dynamic register-level memory-mode flags in a virtual machine system
US10061918B2 (en)*2016-04-012018-08-28Intel CorporationSystem, apparatus and method for filtering memory access logging in a processor
CN111124491B (en)*2019-12-122022-04-22浪潮(北京)电子信息产业有限公司 A batch processing method, device, equipment and storage medium

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN103765401A (en)*2011-04-072014-04-30威盛电子股份有限公司 A microprocessor that compiles conditional load/store instructions into a variable number of microinstructions
CN114168196A (en)*2021-11-192022-03-11中科可控信息产业有限公司Register control method, system, device, computer equipment and storage medium
CN114880030A (en)*2022-05-162022-08-09海光信息技术股份有限公司 Instruction decoding method and device, electronic device, and storage medium

Also Published As

Publication numberPublication date
CN118520464A (en)2024-08-20

Similar Documents

PublicationPublication DateTitle
US11687645B2 (en)Security control method and computer system
KR102189296B1 (en) Event filtering for virtual machine security applications
KR101946982B1 (en)Process Evaluation for Malware Detection in Virtual Machines
US9087199B2 (en)System and method for providing a secured operating system execution environment
RU2645268C2 (en)Complex classification for detecting malware
US8621620B2 (en)System and method for protecting and securing storage devices using below-operating system trapping
CN107977573B (en)Method and system for secure disk access control
US9275223B2 (en)Real-time module protection
IL267241B (en) System and methods for identifying ransomware
JP2013515989A (en) Method and system for protecting an operating system from unauthorized changes
CN109120618B (en) A hardware virtualization-based detection method for controlled side-channel attacks on cloud platforms
US10114948B2 (en)Hypervisor-based buffer overflow detection and prevention
Rhee et al.Data-centric OS kernel malware characterization
CN110737888B (en)Method for detecting attack behavior of kernel data of operating system of virtualization platform
US20150074820A1 (en)Security enhancement apparatus
US11386219B2 (en)Detection of an unauthorized modification to storage and restoration of the storage
CN115904605A (en)Software defense method and related equipment
Shi et al.Vanguard: A cache-level sensitive file integrity monitoring system in virtual machine environment
CN118520464B (en) Method for performing operations on registers, computer device, storage medium and program product
US20250238513A1 (en)Snapshot scoring for intelligent recovery
Zhan et al.Cfwatcher: A novel target-based real-time approach to monitor critical files using vmi
CN118331680A (en)Safety protection method and device and electronic equipment
CN107203410A (en)A kind of VMI method and system based on redirection of system call
Zhan et al.Checking virtual machine kernel control-flow integrity using a page-level dynamic tracing approach
US11526456B1 (en)System and method for filtering process i/o operations in kernel-mode

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination
GR01Patent grant
GR01Patent grant

[8]ページ先頭

©2009-2025 Movatter.jp