Re: [PATCHv11.1 11/19] x86/tdx: Convert shared memory back to private on kexec

From: Borislav Petkov
Date: Tue Jun 04 2024 - 14:06:42 EST


On Tue, Jun 04, 2024 at 07:14:00PM +0300, Kirill A. Shutemov wrote:
> /*
> * If tdx_enc_status_changed() fails, it leaves memory
> * in an unknown state. If the memory remains shared,
> * it can result in an unrecoverable guest shutdown on
> * the first accessed through a private mapping.

"access"

So this sentence above can go too, right?

Because that comment is in tdx_kexec_finish() and we're basically going
off to kexec. So can a guest even access it through a private mapping?
We're shutting down so nothing is running anymore...

> * The kdump kernel boot is not impacted as it uses
> * a pre-reserved memory range that is always private.
> * However, gathering crash information could lead to
> * a crash if it accesses unconverted memory through
> * a private mapping.

When does the kexec kernel even get such a private mapping? It is not
even up yet...

> * pr_err() may assist in understanding such crashes.

"Print error info in order to leave bread crumbs for debugging." is what
I'd say.

Thx.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette