[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.21.1907101318170.197432@chino.kir.corp.google.com>
Date: Wed, 10 Jul 2019 13:19:35 -0700 (PDT)
From: David Rientjes <rientjes@...gle.com>
To: Ingo Molnar <mingo@...hat.com>,
Thomas Gleixner <tglx@...utronix.de>,
Borislav Petkov <bp@...en8.de>
cc: Cfir Cohen <cfir@...gle.com>,
Thomas Lendacky <Thomas.Lendacky@....com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Andy Lutomirski <luto@...nel.org>,
linux-kernel@...r.kernel.org, x86@...nel.org
Subject: [patch] x86/mm: Free sme_early_buffer after init
We want to be able to clear the contents of sme_early_buffer after
__sme_early_enc_dec() because it is used to move encrypted and decrypted
data, but since __sme_early_enc_dec() is __init we can simply free this
buffer after init.
This saves a page that is otherwise unreferenced after init.
Reported-by: Cfir Cohen <cfir@...gle.com>
Signed-off-by: David Rientjes <rientjes@...gle.com>
---
arch/x86/mm/mem_encrypt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/mm/mem_encrypt.c b/arch/x86/mm/mem_encrypt.c
--- a/arch/x86/mm/mem_encrypt.c
+++ b/arch/x86/mm/mem_encrypt.c
@@ -41,7 +41,7 @@ EXPORT_SYMBOL_GPL(sev_enable_key);
bool sev_enabled __section(.data);
/* Buffer used for early in-place encryption by BSP, no locking needed */
-static char sme_early_buffer[PAGE_SIZE] __aligned(PAGE_SIZE);
+static char sme_early_buffer[PAGE_SIZE] __initdata __aligned(PAGE_SIZE);
/*
* This routine does not change the underlying encryption setting of the
Powered by blists - more mailing lists