lkml.org 
[lkml]   [2023]   [Apr]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [RFC PATCH V4 06/17] x86/hyperv: decrypt VMBus pages for sev-snp enlightened guest
From
  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.

\
 
 \ /
  Last update: 2023-04-14 06:41    [W:0.078 / U:0.168 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site