Multi-CPU virtual machine operation method and device, storage medium, and computer equipment
By building multiple CPUs into the virtual machine and selecting the appropriate CPU to execute the target program according to the execution scenario, the limitation of existing virtual machines that can only be used in specific scenarios is solved, and the versatility and versatility of the virtual machine in multiple scenarios are achieved. Efficiency.
Patent Information
- Application Number
- CN201910943739.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-09-30
- Publication Date
- 2024-09-10
- Estimated Expiration
- 2039-09-30
AI Technical Summary
Existing virtual machines can only simulate one type of CPU and cannot be used in multiple scenarios. This results in the need to develop virtual machine anti-virus software for different scenarios, which is a waste of resources and lengthy time.
Multiple CPUs are built into the virtual machine, and the appropriate CPU is selected for execution according to the execution scenario of the target program, including obtaining the target program and execution scenario, selecting the CPU corresponding to the scenario, and using the CPU to execute the target program and perform virus analysis.
It achieves the double guarantee of the versatility and execution efficiency and quality of virtual machines in different scenarios, and avoids doubling the workload of developing virtual machines for different scenarios.
Smart Images

Figure CN112579249B
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of virtual machines, and in particular to a method and device for operating a multi-CPU virtual machine, a storage medium, and a computer device. Background Art
[0002] In the virtual machines of the prior art, a virtual machine can only simulate one type of CPU. For example, for the x86 architecture, multiple CPUs such as Bochs and QEMU can be included, but only one of Bochs, QEMU or other CPUs can be selected in the virtual machine. Therefore, in products built using virtual machines, such as virtual machine antivirus software, only one CPU can be provided to simulate the operation of antivirus files.
[0003] In this way, the virtual machine antivirus software can only be applied to a certain special scenario that matches the CPU it contains, and cannot be used in multiple scenarios. Therefore, when developing virtual machine antivirus software, it is necessary to develop it for different scenarios separately. For example, develop a set of virtual machine antivirus software for personal computer equipment of ordinary users, and develop a set of virtual machine antivirus software for enterprise computer equipment, so as to adapt to the application of different scenarios. Obviously, this solution is more troublesome and wastes resources and time. Summary of the invention
[0004] In view of this, the present application provides a method and apparatus for operating a multi-CPU virtual machine, a storage medium, and a computer device.
[0005] According to one aspect of the present application, a method for operating a multi-CPU virtual machine is provided, comprising:
[0006] Obtaining a target program and an execution scenario of the target program;
[0007] According to the execution scenario of the target program, selecting a target CPU corresponding to the execution scenario in the virtual machine;
[0008] The target program is executed using the target CPU of the virtual machine.
[0009] Specifically, the virtual machine includes at least two CPUs, and each execution scenario corresponds to a unique CPU.
[0010] Specifically, the obtaining of the target program and the execution scenario of the target program specifically includes:
[0011] Acquire the target program and output an execution scenario acquisition instruction, wherein the execution scenario acquisition instruction includes an execution scenario corresponding to any CPU in the virtual machine;
[0012] Based on the received execution scenario selection instruction, the execution scenario of the target program is confirmed.
[0013] Specifically, selecting a target CPU corresponding to the execution scenario in the virtual machine according to the execution scenario of the target program specifically includes:
[0014] Based on the execution scenario of the target program, the target CPU corresponding to the execution scenario is selected from the CPUs of the virtual machine.
[0015] Specifically, the CPU includes at least Bochs and QEMU, wherein Bochs corresponds to a fine-strength execution scenario, and QEMU corresponds to a coarse-strength execution scenario.
[0016] Specifically, after the target CPU of the virtual machine is used to execute the target program, the method further includes:
[0017] The execution process of the target program is analyzed to obtain the execution characteristics of the target program.
[0018] Specifically, the method further includes:
[0019] The execution characteristics of the target program are compared with the execution characteristics of malicious programs and / or safe programs contained in a preset execution characteristic library, and virus analysis is performed on the target program.
[0020] According to another aspect of the present application, a multi-CPU virtual machine operation device is provided, comprising:
[0021] A target acquisition module, used to acquire a target program and an execution scenario of the target program;
[0022] A CPU selection module, configured to select a target CPU corresponding to the execution scenario in the virtual machine according to the execution scenario of the target program;
[0023] A program execution module is used to execute the target program using the target CPU of the virtual machine.
[0024] Specifically, the virtual machine includes at least two CPUs, and each execution scenario corresponds to a unique CPU.
[0025] Specifically, the target acquisition module includes:
[0026] An execution scenario acquisition unit, configured to acquire the target program and output an execution scenario acquisition instruction, wherein the execution scenario acquisition instruction includes an execution scenario corresponding to any CPU in the virtual machine;
[0027] The execution scenario determination unit is used to determine the execution scenario of the target program based on the received execution scenario selection instruction.
[0028] Specifically, the CPU selection module is specifically used to:
[0029] Based on the execution scenario of the target program, the target CPU corresponding to the execution scenario is selected from the CPUs of the virtual machine.
[0030] Specifically, the CPU includes at least Bochs and QEMU, wherein Bochs corresponds to a fine-strength execution scenario, and QEMU corresponds to a coarse-strength execution scenario.
[0031] Specifically, the device also includes:
[0032] The execution feature analysis module is used to analyze the execution process of the target program after executing the target program using the target CPU of the virtual machine to obtain the execution feature of the target program.
[0033] Specifically, the device also includes:
[0034] The virus analysis module is used to compare the execution characteristics of the target program with the execution characteristics of malicious programs and / or safe programs contained in a preset execution characteristic library, and perform virus analysis on the target program.
[0035] According to another aspect of the present application, a storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the operating method of the multi-CPU virtual machine is implemented.
[0036] According to another aspect of the present application, a computer device is provided, including a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, wherein the processor implements the above-mentioned method for operating a multi-CPU virtual machine when executing the program.
[0037] By means of the above technical solution, the present application provides a method and device for operating a multi-CPU virtual machine, a storage medium, and a computer device, which provide target CPUs suitable for their corresponding execution scenarios for different target programs by building multiple CPUs into the virtual machine, thereby using the target CPU to execute the target program. The present application overcomes the defect of the prior art that multiple virtual machines are developed for different scenarios, resulting in an exponential increase in workload, by building multiple CPUs suitable for different scenarios into the virtual machine. At the same time, the target program is executed using the target CPU that matches the execution scenario of the target program, thereby achieving dual guarantees of execution efficiency and execution quality.
[0038] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0040] Figure 1 A schematic diagram of a process flow of a multi-CPU virtual machine operation method provided in an embodiment of the present application is shown;
[0041] Figure 2 A schematic diagram of a flow chart of another method for operating a multi-CPU virtual machine provided in an embodiment of the present application is shown;
[0042] Figure 3 A schematic diagram of the structure of a multi-CPU virtual machine operation device provided in an embodiment of the present application is shown;
[0043] Figure 4 A schematic diagram of the structure of another multi-CPU virtual machine operating device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0044] The present application will be described in detail below with reference to the accompanying drawings and in combination with embodiments. It should be noted that the embodiments and features in the embodiments of the present application can be combined with each other without conflict.
[0045] In this embodiment, a method for operating a multi-CPU virtual machine is provided, such as Figure 1 As shown, the method includes:
[0046] Step 101, obtaining a target program and an execution scenario of the target program;
[0047] Step 102, according to the execution scenario of the target program, selecting a target CPU corresponding to the execution scenario in the virtual machine;
[0048] Step 103: Utilize the target CPU of the virtual machine to execute the target program.
[0049] In the above embodiment, multiple types of CPUs are built into the virtual machine. The virtual machine in the embodiment of the present application is mainly used in the security field, and can be specifically used in scenarios such as virus detection and killing, virus analysis, etc. Specifically, after obtaining the target program to be run, the execution scenario corresponding to the target program should be obtained first. For example, execution scenario 1 may be that the user's personal computer device needs to use virtual machine antivirus software for virus detection and killing. For example, execution scenario 2 may be that the enterprise computer device needs to use virtual machine antivirus software for virus analysis or is performing virtual machine debugging. Secondly, after obtaining the execution scenario corresponding to the target program, according to the execution scenario, a target CPU that is most suitable for the execution scenario is selected from multiple CPUs of the virtual machine. For example, a CPU with a coarser execution granularity can be selected for the target program of execution scenario 1 to be suitable for the scenario to achieve fast execution and fast virus killing. For example, a CPU with a finer execution granularity can be selected for the target program of execution scenario 2 to be suitable for the scenario to achieve fine analysis. Finally, the target program is executed using the selected target CPU to adapt to the corresponding scenario, so that the virtual machine can adapt to the execution scenario of the target program to achieve dual guarantees of execution efficiency and execution quality.
[0050] It should be noted that the multiple CPUs built into the virtual machine in the embodiment of the present application are generally multiple CPUs under the same architecture. When establishing a virtual machine, it is only necessary to write parameters for the initialization interface, execution interface, register-related structures, and memory processing-related structures of the virtual machine to implement interface modification so that multiple CPUs can be compatible in the virtual machine.
[0051] By applying the technical solution of this embodiment, by building multiple CPUs into the virtual machine, target CPUs suitable for their corresponding execution scenarios are provided for different target programs, so that the target CPU is used to execute the target program. By building multiple CPUs suitable for different scenarios into the virtual machine, the present application overcomes the defect of the prior art that multiple virtual machines are developed for different scenarios, resulting in an exponential increase in workload. At the same time, the target program is executed using the target CPU that matches the execution scenario of the target program, thereby achieving dual guarantees of execution efficiency and execution quality.
[0052] Further, as a refinement and extension of the specific implementation of the above embodiment, in order to fully illustrate the specific implementation process of this embodiment, another method for running a multi-CPU virtual machine is provided, such as Figure 2 As shown, the method includes:
[0053] Step 201, obtaining a target program and outputting an execution scenario acquisition instruction, wherein the execution scenario acquisition instruction includes an execution scenario corresponding to any CPU in the virtual machine;
[0054] Step 202, confirming the execution scenario of the target program based on the received execution scenario selection instruction;
[0055] Step 203 : Based on the execution scenario of the target program, a target CPU corresponding to the execution scenario is selected from the CPUs of the virtual machine.
[0056] Step 204: Utilize the target CPU of the virtual machine to execute the target program.
[0057] In any of the above embodiments, specifically, the virtual machine includes at least two types of CPUs, and each execution scenario corresponds to a unique CPU.
[0058] In any of the above embodiments, specifically, the CPU includes at least Bochs and QEMU, wherein Bochs corresponds to a fine-grained execution scenario, and QEMU corresponds to a coarse-grained execution scenario.
[0059] In the above steps 201 to 204, the CPU in the virtual machine in the embodiment of the present application includes at least Bochs and QEMU. The virtual machine can be applicable to at least two execution scenarios, and each execution scenario corresponds to only one CPU. Among them, Bochs corresponds to fine-grained execution scenarios. For example, the fine-grained execution scenario may be that the enterprise computer equipment needs to use virtual machine antivirus software for virus analysis or is debugging the virtual machine. QEMU corresponds to coarse-grained execution scenarios. For example, the coarse-grained execution scenario may be that the user's personal computer equipment needs to use virtual machine antivirus software for virus detection.
[0060] When there is a target program to be executed, the execution scenario of the target program can be obtained by outputting execution scenario acquisition instructions, such as displaying the execution scenarios corresponding to the various CPUs in the virtual machine, so that the user can select the execution scenario corresponding to the target program to be executed. Specifically, the execution scenarios such as "personal antivirus (or fast antivirus)", "enterprise antivirus (or fine antivirus)", "virus analysis" and so on can be displayed. The corresponding CPU is determined based on the user's selection of the execution scenario. In this example, "personal antivirus (or fast antivirus)" can correspond to QEMU, "enterprise antivirus (or fine antivirus)" and "virus analysis" can correspond to Bochs. After determining the target CPU corresponding to the execution scenario of the target program, the target CPU can be used to implement the execution of the target program.
[0061] Step 205: parse the execution process of the target program to obtain the execution characteristics of the target program.
[0062] Step 206 , compare the execution characteristics of the target program with the execution characteristics of malicious programs and / or safe programs contained in a preset execution characteristic library, and perform virus analysis on the target program.
[0063] In step 205 and step 206, a method for virus analysis using a virtual machine is defined. Specifically, when the target program is executed in the virtual machine, the execution characteristics of the target program are obtained, thereby the execution characteristics of the target program are matched according to a preset execution characteristic library, and then it is determined whether the target program contains viruses. Wherein, first, the calling pile function of the target program is recorded during the execution of the target program; secondly, the execution characteristics of the target program are analyzed for the pile function called by the recorded target program, and the process of parsing the execution characteristics is equivalent to "translating" the sequence of calling the pile function into corresponding characteristics, for example, a series of pile function execution codes are translated into the form of flow description, and the execution characteristics of the target program are used as the basis for virus detection; finally, the execution characteristics of the target program are analyzed to determine whether the program is a virus program to realize virus detection based on a virtual machine.
[0064] In step 206 of the embodiment of the present application, the following virus detection implementations may be included:
[0065] Implementation A:
[0066] Step A1, obtaining a preset execution feature list, wherein the preset execution feature list includes a preset execution feature blacklist;
[0067] Step A2, querying whether the execution feature of the target program belongs to the malicious execution feature included in the preset execution feature blacklist;
[0068] Step A3: If the execution feature of the target program is a malicious execution feature, it is determined that the target program contains a virus.
[0069] Step A4: if the execution feature of the target program does not belong to a malicious execution feature, query whether the execution feature of the target program belongs to a safe execution feature included in a preset execution feature whitelist;
[0070] Step A5: If the execution feature of the target program is a safe execution feature, it is determined that the target program does not contain a virus.
[0071] Step A6: if the execution feature of the target program does not belong to the safe execution feature, the target program is marked as a suspicious program, and the execution feature corresponding to the suspicious program is reported to the virus management system, so that the virus management system is used to analyze whether the suspicious program contains a virus.
[0072] In implementation mode A, a preset execution feature list is used to determine whether the target program is infected with viruses. The preset execution feature list includes a blacklist and a whitelist. The blacklist pre-stores malicious execution features corresponding to virus programs, and the whitelist pre-stores safe execution features corresponding to safe programs. Therefore, it is determined whether the target program is an infected program based on whether the execution feature of the target program can hit the blacklist or the whitelist. If it hits the blacklist, it is an infected program. If it hits the whitelist, it is a safe program. If the execution feature of the target program hits neither the blacklist nor the whitelist, it is determined that the program is a suspicious program, and the suspicious program is reported to the virus management system for further determination of the program. The virus management system can specifically be an expert system.
[0073] Implementation B:
[0074] Step B1, calculating a virus detection value of the target program according to the execution characteristics of the target program and the preset execution characteristic virus detection experience value, wherein the virus detection value of the target program is the sum of the preset execution characteristic virus detection experience values corresponding to the execution characteristics of the target program;
[0075] Step B2, determining whether the target program contains a virus according to the relationship between the virus detection value of the target program and a preset virus experience value.
[0076] The above embodiment is illustrated below. Assuming that the execution characteristics of the target program include A, B, C, and D, and the preset execution characteristic virus detection experience values are 0, 1, 2, and 3 respectively, then the virus detection value of the target program is 0+1+2+3=6, and the preset virus experience value is [5, +∞). The virus detection value of the target program is within the virus experience value interval, and it can be judged that the program contains a virus. Among them, the preset virus experience value is obtained by analyzing a large number of virus samples and safe samples. The preset virus experience value is used as a partition to make the maximum difference between the virus experience value of the virus sample and the virus experience value of the safe sample.
[0077] On this basis, it is possible to further determine whether the target program is a safe program or a suspicious program. Specifically, the preset experience value of the safe program and / or the preset experience value of the suspicious program can be limited. The specific step B2 can be: according to the relationship between the virus detection value of the target program and the preset virus experience value, the preset safety experience value and the preset suspicious experience value, the target program is subjected to a safety check.
[0078] In step B2, it is determined whether the target program is a virus program, a safe program, or a suspicious program according to the empirical value interval of the virus detection value of the target program.
[0079] In addition, if it is a suspicious program, it can be reported to the virus management system, which can then use the virus management system to determine whether the target program is infected. Based on the judgment results of the virus management system, adaptive adjustments can be made to each preset experience value to improve the accuracy and efficiency of virus detection.
[0080] Further, as Figure 1 The specific implementation of the method, the embodiment of the present application provides a multi-CPU virtual machine operation device, such as Figure 3 As shown, the device includes: a target acquisition module 31, a CPU selection module 32, and a program execution module 33.
[0081] A target acquisition module 31 is used to acquire a target program and an execution scenario of the target program;
[0082] A CPU selection module 32, configured to select a target CPU corresponding to an execution scenario in a virtual machine according to an execution scenario of a target program;
[0083] The program execution module 33 is used to execute the target program using the target CPU of the virtual machine.
[0084] In specific application scenarios, such as Figure 4 As shown, the virtual machine includes at least two types of CPUs, and each execution scenario corresponds to a unique CPU.
[0085] In specific application scenarios, such as Figure 4 As shown, the target acquisition module 31 specifically includes:
[0086] An execution scenario acquisition unit 311 is used to acquire a target program and output an execution scenario acquisition instruction, wherein the execution scenario acquisition instruction includes an execution scenario corresponding to any CPU in the virtual machine;
[0087] The execution scenario determining unit 312 is used to determine the execution scenario of the target program based on the received execution scenario selection instruction.
[0088] In a specific application scenario, the CPU selection module 32 is specifically used to select a target CPU corresponding to the execution scenario from the CPUs of the virtual machine based on the execution scenario of the target program.
[0089] In a specific application scenario, the CPU includes at least Bochs and QEMU, wherein Bochs corresponds to a fine-strength execution scenario, and QEMU corresponds to a coarse-strength execution scenario.
[0090] In specific application scenarios, such as Figure 4 As shown, the device also includes:
[0091] The execution feature analysis module 34 is used to analyze the execution process of the target program after executing the target program using the target CPU of the virtual machine to obtain the execution feature of the target program.
[0092] In specific application scenarios, such as Figure 4 As shown, the device also includes:
[0093] The virus analysis module 35 is used to compare the execution characteristics of the target program with the execution characteristics of malicious programs and / or safe programs contained in a preset execution characteristic library, and perform virus analysis on the target program.
[0094] The virus analysis module 35 is also used to implement the steps in the following two implementations:
[0095] Implementation A:
[0096] Step A1, obtaining a preset execution feature list, wherein the preset execution feature list includes a preset execution feature blacklist;
[0097] Step A2, querying whether the execution feature of the target program belongs to the malicious execution feature included in the preset execution feature blacklist;
[0098] Step A3: If the execution feature of the target program is a malicious execution feature, it is determined that the target program contains a virus.
[0099] Step A4: if the execution feature of the target program does not belong to a malicious execution feature, query whether the execution feature of the target program belongs to a safe execution feature included in a preset execution feature whitelist;
[0100] Step A5: If the execution feature of the target program is a safe execution feature, it is determined that the target program does not contain a virus.
[0101] Step A6: if the execution feature of the target program does not belong to the safe execution feature, the target program is marked as a suspicious program, and the execution feature corresponding to the suspicious program is reported to the virus management system, so that the virus management system can analyze whether the suspicious program contains a virus.
[0102] In implementation mode A, a preset execution feature list is used to determine whether the target program is infected with viruses. The preset execution feature list includes a blacklist and a whitelist. The blacklist pre-stores malicious execution features corresponding to virus programs, and the whitelist pre-stores safe execution features corresponding to safe programs. Therefore, it is determined whether the target program is an infected program based on whether the execution feature of the target program can hit the blacklist or the whitelist. If it hits the blacklist, it is an infected program. If it hits the whitelist, it is a safe program. If the execution feature of the target program hits neither the blacklist nor the whitelist, it is determined that the program is a suspicious program, and the suspicious program is reported to the virus management system for further determination of the program. The virus management system can specifically be an expert system.
[0103] Implementation B:
[0104] Step B1, calculating a virus detection value of the target program according to the execution characteristics of the target program and the preset execution characteristic virus detection experience value, wherein the virus detection value of the target program is the sum of the preset execution characteristic virus detection experience values corresponding to the execution characteristics of the target program;
[0105] Step B2, determining whether the target program contains a virus according to the relationship between the virus detection value of the target program and a preset virus experience value.
[0106] The above embodiment is illustrated below. Assuming that the execution characteristics of the target program include A, B, C, and D, and the preset execution characteristic virus detection experience values are 0, 1, 2, and 3 respectively, then the virus detection value of the target program is 0+1+2+3=6, and the preset virus experience value is [5, +∞). The virus detection value of the target program is within the virus experience value interval, and it can be judged that the program contains a virus. Among them, the preset virus experience value is obtained by analyzing a large number of virus samples and safe samples. The preset virus experience value is used as a partition to make the maximum difference between the virus experience value of the virus sample and the virus experience value of the safe sample.
[0107] On this basis, it is possible to further determine whether the target program is a safe program or a suspicious program. Specifically, the preset experience value of the safe program and / or the preset experience value of the suspicious program can be limited. The specific step B2 can be: according to the relationship between the virus detection value of the target program and the preset virus experience value, the preset safety experience value and the preset suspicious experience value, the target program is subjected to a safety check.
[0108] In step B2, it is determined whether the target program is a virus program, a safe program, or a suspicious program according to the empirical value interval of the virus detection value of the target program.
[0109] In addition, if it is a suspicious program, it can be reported to the virus management system, which can then use the virus management system to determine whether the target program is infected. Based on the judgment results of the virus management system, adaptive adjustments can be made to each preset experience value to improve the accuracy and efficiency of virus detection.
[0110] It should be noted that for other corresponding descriptions of the functional units involved in the operating device of a multi-CPU virtual machine provided in the embodiment of the present application, reference can be made to Figure 1 and Figure 2 The corresponding description in will not be repeated here.
[0111] Based on the above Figure 1 and Figure 2 The method shown in the embodiment of the present application accordingly provides a storage medium on which a computer program is stored, and when the program is executed by a processor, the above-mentioned Figure 1 and Figure 2 The operating method of the multi-CPU virtual machine shown.
[0112] Based on this understanding, the technical solution of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.), and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each implementation scenario of the present application.
[0113] Based on the above Figure 1 , Figure 2 The method shown, and Figure 3 , Figure 4 In order to achieve the above-mentioned purpose, the embodiment of the present application further provides a computer device, which can be a personal computer, a server, a network device, etc. The computer device includes a storage medium and a processor; the storage medium is used to store a computer program; the processor is used to execute the computer program to achieve the above-mentioned Figure 1 and Figure 2 The operating method of the multi-CPU virtual machine shown.
[0114] Optionally, the computer device may further include a user interface, a network interface, a camera, a radio frequency (RF) circuit, a sensor, an audio circuit, a WI-FI module, etc. The user interface may include a display, an input unit such as a keyboard, etc., and the optional user interface may also include a USB interface, a card reader interface, etc. The network interface may optionally include a standard wired interface, a wireless interface (such as a Bluetooth interface, a WI-FI interface), etc.
[0115] Those skilled in the art will appreciate that the computer device structure provided in this embodiment does not limit the computer device, and may include more or fewer components, or a combination of certain components, or different component arrangements.
[0116] The storage medium may also include an operating system and a network communication module. The operating system is a program that manages and saves the hardware and software resources of the computer device, and supports the operation of information processing programs and other software and / or programs. The network communication module is used to realize communication between the components inside the storage medium, and communication with other hardware and software in the physical device.
[0117] Through the description of the above implementation methods, those skilled in the art can clearly understand that the present application can be implemented by means of software plus the necessary general hardware platform, or by hardware by building multiple CPUs into the virtual machine to provide target CPUs suitable for their corresponding execution scenarios for different target programs, thereby using the target CPU to execute the target program. The present application overcomes the defect of the prior art that multiple virtual machines are developed for different scenarios, resulting in an exponential increase in workload, by building multiple CPUs suitable for different scenarios into the virtual machine. At the same time, the target program is executed using the target CPU that matches the execution scenario of the target program, thereby achieving dual guarantees of execution efficiency and execution quality.
[0118] Those skilled in the art will appreciate that the accompanying drawings are only schematic diagrams of a preferred implementation scenario, and the modules or processes in the accompanying drawings are not necessarily necessary for implementing the present application. Those skilled in the art will appreciate that the modules in the devices in the implementation scenario can be distributed in the devices of the implementation scenario according to the description of the implementation scenario, or can be changed accordingly and located in one or more devices different from the present implementation scenario. The modules of the above-mentioned implementation scenario can be combined into one module, or can be further split into multiple submodules.
[0119] The above serial numbers of this application are only for description and do not represent the advantages and disadvantages of the implementation scenarios. The above disclosure is only a few specific implementation scenarios of this application, but this application is not limited to them, and any changes that can be thought of by technicians in this field should fall within the scope of protection of this application.
Claims
1. A method for operating a multi-CPU virtual machine, characterized in that: include: Obtaining a target program and an execution scenario of the target program; According to the execution scenario of the target program, a target CPU corresponding to the execution scenario is selected in the virtual machine, wherein the execution scenario includes execution scenarios of different granularities, and the virtual machine is used for virus detection or virus analysis scenarios in the security field, wherein the CPU includes at least Bochs and QEMU, wherein Bochs corresponds to a fine-grained execution scenario, and QEMU corresponds to a coarse-grained execution scenario; Utilizing the target CPU of the virtual machine to execute the target program, so as to perform virus detection or virus analysis on the target program based on the execution characteristics of the target program; Among them, the virtual machine includes at least two CPUs, each execution scenario corresponds to a unique CPU, and during the construction process of the virtual machine, interface modification is completed by parameter writing of the initialization interface, execution interface, register-related structure and memory processing-related structure of the virtual machine, so that the virtual machine is compatible with multiple CPUs.
2. The method according to claim 1, characterized in that The obtaining of the target program and the execution scenario of the target program specifically includes: Acquire the target program and output an execution scenario acquisition instruction, wherein the execution scenario acquisition instruction includes an execution scenario corresponding to any CPU in the virtual machine; Based on the received execution scenario selection instruction, the execution scenario of the target program is confirmed.
3. The method according to claim 1, characterized in that The step of selecting a target CPU corresponding to the execution scenario in the virtual machine according to the execution scenario of the target program specifically includes: Based on the execution scenario of the target program, the target CPU corresponding to the execution scenario is selected from the CPUs of the virtual machine.
4. The method according to any one of claims 1 to 3, characterized in that After the target CPU of the virtual machine is used to execute the target program, the method further includes: The execution process of the target program is analyzed to obtain the execution characteristics of the target program.
5. The method according to claim 4, characterized in that The method further comprises: The execution characteristics of the target program are compared with the execution characteristics of malicious programs and / or safe programs contained in a preset execution characteristic library, and virus analysis is performed on the target program.
6. A multi-CPU virtual machine operation device, characterized in that: include: A target acquisition module, used to acquire a target program and an execution scenario of the target program; A CPU selection module, used to select a target CPU corresponding to the execution scenario in the virtual machine according to the execution scenario of the target program, wherein the execution scenario includes execution scenarios of different granularities, and the virtual machine is used for virus detection or virus analysis scenarios in the security field, wherein the CPU includes at least Bochs and QEMU, wherein Bochs corresponds to a fine-grained execution scenario, and QEMU corresponds to a coarse-grained execution scenario; A program execution module, used to execute the target program using the target CPU of the virtual machine, so as to perform virus detection or virus analysis on the target program based on the execution characteristics of the target program; Among them, the virtual machine includes at least two CPUs, each execution scenario corresponds to a unique CPU, and during the construction process of the virtual machine, interface modification is completed by parameter writing of the initialization interface, execution interface, register-related structure and memory processing-related structure of the virtual machine, so that the virtual machine is compatible with multiple CPUs.
7. The device according to claim 6, characterized in that The target acquisition module specifically includes: An execution scenario acquisition unit, configured to acquire the target program and output an execution scenario acquisition instruction, wherein the execution scenario acquisition instruction includes an execution scenario corresponding to any CPU in the virtual machine; The execution scenario determination unit is used to determine the execution scenario of the target program based on the received execution scenario selection instruction.
8. The device according to claim 6, characterized in that The CPU selection module is specifically used for: Based on the execution scenario of the target program, the target CPU corresponding to the execution scenario is selected from the CPUs of the virtual machine.
9. The device according to any one of claims 6 to 8, characterized in that The device also includes: The execution feature analysis module is used to analyze the execution process of the target program after executing the target program using the target CPU of the virtual machine to obtain the execution feature of the target program.
10. The device according to claim 9, characterized in that The device also includes: The virus analysis module is used to compare the execution characteristics of the target program with the execution characteristics of malicious programs and / or safe programs contained in a preset execution characteristic library, and perform virus analysis on the target program.
11. A storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the operating method of the multi-CPU virtual machine according to any one of claims 1 to 5 is implemented.
12. A computer device comprising a storage medium, a processor, and a computer program stored in the storage medium and executable on the processor, characterized in that: When the processor executes the program, the operating method of the multi-CPU virtual machine according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Method and device for distributing CPU resources in virtual scene
CN104461735A
Foreground application program scene synchronization method, apparatus and system
CN106095592A
System and method of analysis of files for maliciousness in virtual machine
CN108399332A
Thread scheduling method and device, electronic equipment and storage medium
CN108804211A
Sleeping time control method and device for programs
CN109002325A
