AMDESE / AMDSEV

AMD Secure Encrypted Virtualization
272 stars 84 forks source link

Why is guest VM's private memory showing zero? #201

Closed ksy980324 closed 7 months ago

ksy980324 commented 7 months ago

I launched a guest VM with SEV-SNP enabled with the following specs.

I figured out the virtual address for the VM on the host and converted it to a physical address then I dumped the VM memory. I checked that most contents are showing as 0 except for shared memory. (not ciphertext) image image

I'm curious about the reason for this Is it due to the RMP check, or the memory backend, or something else? (I know that even in a SEV-SNP environment, you can check the ciphertext of VM memory)

If you need more specs, I will write them down

tlendacky commented 7 months ago

This has to do with the gmem support and the page that is actually used for the guest depending on whether the page is shared or private. That is why you are seeing zeroes for the private pages as opposed to cipher text. @mdroth can provide more details if needed.

ksy980324 commented 7 months ago

This has to do with the gmem support and the page that is actually used for the guest depending on whether the page is shared or private. That is why you are seeing zeroes for the private pages as opposed to cipher text. @mdroth can provide more details if needed.

Thank you for your reply. I looked for information on gmem and found an fd-based approach. I checked the RFC patch history below. https://lore.kernel.org/linux-mm/20221202061347.1070246-1-chao.p.peng@linux.intel.com/ https://lore.kernel.org/linux-mm/20230612042559.375660-1-michael.roth@amd.com/

It looks like one of the options for the memory backend is gmem. Thanks.