Messages in this thread | | | Date | Fri, 14 Apr 2023 12:40:44 +0800 | Subject | Re: [RFC PATCH V4 06/17] x86/hyperv: decrypt VMBus pages for sev-snp enlightened guest | From | Tianyu Lan <> |
| |
On 4/12/2023 10:32 PM, Michael Kelley (LINUX) wrote: >> @@ -191,6 +222,15 @@ void hv_synic_free(void) >> free_page((unsigned long)hv_cpu->synic_event_page); >> free_page((unsigned long)hv_cpu->synic_message_page); >> free_page((unsigned long)hv_cpu->post_msg_page); >> + >> + if (hv_isolation_type_en_snp()) { >> + set_memory_encrypted((unsigned long) >> + hv_cpu->synic_message_page, 1); >> + set_memory_encrypted((unsigned long) >> + hv_cpu->synic_event_page, 1); >> + set_memory_encrypted((unsigned long) >> + hv_cpu->post_msg_page, 1); >> + } > The re-encryption must be done*before* pages are freed! > > Furthermore, if the re-encryption fails, we should not free > the page as it would pollute the free memory pool. The best > we can do is leak the memory. See Patch 5 in Dexuan's > TDX series, which does the same thing (but still doesn't > get it quite right, per my comments). >
You are right. The order is wrong. we should figure out a right solution to handle such case.
| |