Time-shift support for encrypted virtual machines
Systems and methods for secure saving sand restoration of virtualized states is disclosed herein, wherein a guest and/or a virtual machine is aware of being executed from a restored snapshot. An example system comprises a hypervisor; an application running in an encrypted virtual machine; a memory; a processor in communication with the memory executing an application, wherein the application is configured to modify, by an application running in an encrypted VM, a shadow identifier (Shadow ID) saved in private memory; and save a state of the encrypted VM, as a snapshot.
1 . A method for mitigating time shifting errors or time reversal errors associated with an encrypted virtual machine (VM), the method comprising:
modifying, by an application running in the encrypted VM, a shadow identifier (Shadow ID) saved in a private memory of the encrypted VM, wherein the private memory is inaccessible to a hypervisor associated with the encrypted VM; and
saving, by the application, a state of the encrypted VM as a snapshot.
2 . The method of claim 1 , further comprising:
receiving, by the application, instructions from the hypervisor to save the state of the encrypted VM.
3 . The method of claim 1 , wherein the modifying comprises:
reading, by the application, a generation identifier (ID) from a public memory that is accessible to the hypervisor, the public memory being different from the private memory;
comparing, by the application, the generation ID to the shadow ID that is stored in the private memory; and
copying, by the application, the generation ID for saving as the shadow ID in the private memory.
4 . The method of claim 1 , wherein the modifying comprises:
generating, by the application, a random identifier to be the shadow ID in the private memory; and
saving, by the application, the generated random identifier as the shadow ID in the private memory.
5 . The method of claim 1 , further comprising:
determining, by the application, whether a guest running inside the encrypted VM is in a state condition that allows the state of the encrypted VM to be saved; and
based on determining that the guest is in the state condition that allows the state of the encrypted VM to be saved, saving, by the application, the snapshot.
6 . The method of claim 1 , further comprising:
injecting, by the application, an interrupt into a guest, wherein the interrupt informs the guest of a saving of the state of the encrypted VM.
7 . The method of claim 1 , further comprising:
initiating restoring of the state from the saved snapshot; and
based on the restoring:
reading, by the application, a generation identifier (ID) from a public memory; and
comparing, by the application, the generation ID with the shadow ID in the private memory.
8 . The method of claim 7 , further comprising:
replacing, by the application, the generation ID in the public memory with the shadow ID in the private memory, based on the generation ID not matching the shadow ID; and
completing the restoring of the state, based on the generation ID not matching the shadow ID.
9 . The method of claim 7 , further comprising:
aborting, by the application, the restoring of the state based on the generation ID matching the shadow ID.
10 . The method of claim 1 , further comprising:
injecting, by the hypervisor, an interrupt into the application to instruct the application to save the state of the encrypted VM; and
saving, by the application, the snapshot based on receiving the interrupt.
11 . The method of claim 1 , wherein the saving of the state of the encrypted VM is a firmware assisted saving undertaken by the application.
12 . The method of claim 1 , wherein the saving of the state of the encrypted VM is a hardware saving undertaken by at least one of a processor or firmware associated with the processor.
13 . The method claim 12 , where the processor is a virtual processor.
14 . The method of claim 1 , wherein the application is firmware.
15 . A system comprising:
a hypervisor;
an application running in an encrypted virtual machine (VM), wherein the encrypted VM is associated with the hypervisor;
a memory;
a processor in communication with the memory executing the application, wherein the application is configured to perform operations including:
modifying, by the application running in the encrypted VM, a shadow identifier (Shadow ID) saved in a private memory of the encrypted VM, wherein the private memory is inaccessible to the hypervisor associated with the encrypted VM; and
saving, by the application, a state of the encrypted VM as a snapshot.
16 . The system of claim 15 , wherein the application is firmware.
17 . The system of claim 15 , wherein the application is further configured to:
initiate restoring of the state from the saved snapshot;
read, by the application, a generation identifier (ID) from a public memory that is separate from the private memory, wherein the public memory is accessible to the hypervisor; and
compare, by the application, the generation ID with the shadow ID.
18 . The system of claim 17 , wherein the application is further configured to:
copy the shadow ID from the private memory into the public memory to replace the generation ID in the public memory, based on the generation ID not matching the shadow ID; and
complete the restoring of the state, based on the generation ID not matching the shadow ID.
19 . The system of claim 17 , wherein the application is further configured to:
abort, by the application, the restoring of the state based on the generation ID matching the shadow ID.
20 . A non-transitory computer-readable storage medium storing instructions that are executable by a processor for causing the processor to perform a method comprising:
modifying, by an application running in an encrypted VM, a shadow identifier (Shadow ID) saved in a private memory of the encrypted VM, wherein the private memory is inaccessible to a hypervisor associated with the encrypted VM; and
saving, by the application, a state of the encrypted VM as a snapshot.