2024-06-13 16:07:51

by Dave Hansen

[permalink] [raw]
Subject: Re: [PATCH] virt: tdx-guest: Fix the decrypted failure memory free

On 6/13/24 04:19, Li RongQing wrote:
> When set_memory_decrypted() fails, the memory should be encrypted
> via set_memory_encrypted(); if encrypting the memory fails, leak it

Please, always cc LKML on this stuff.

Second, Rick was looking in this area, but I'm not sure we ever applied
his patches. The idea was to never leak memory silently in these
failures. Doesn't this silently leak memory?


2024-06-13 16:23:38

by Edgecombe, Rick P

[permalink] [raw]
Subject: Re: [PATCH] virt: tdx-guest: Fix the decrypted failure memory free

On Thu, 2024-06-13 at 09:07 -0700, Dave Hansen wrote:
> Second, Rick was looking in this area, but I'm not sure we ever applied
> his patches.  The idea was to never leak memory silently in these
> failures.  Doesn't this silently leak memory?

They did get applied actually. After a fair amount of discussion the solution
was to always leak the pages, and rely on the WARN that happens in set_memory()
to make noise about it.

It looks like this instance popped up after the sweep through the code was done.
(at least in my local branch with the patches for the fixes, this code was not
merged yet)