Skip to content

Commit

Permalink
percpu: Separate decrypted varaibles anytime encryption can be enabled
Browse files Browse the repository at this point in the history
CONFIG_VIRTUALIZATION may not be enabled for memory encrypted guests.  If
disabled, decrypted per-CPU variables may end up sharing the same page
with variables that should be left encrypted.

Always separate per-CPU variables that should be decrypted into their own
page anytime memory encryption can be enabled in the guest rather than
rely on any other config option that may not be enabled.

Fixes: ac26963 ("percpu: Introduce DEFINE_PER_CPU_DECRYPTED")
Cc: stable@vger.kernel.org # 4.15+
Signed-off-by: Erdem Aktas <erdemaktas@google.com>
Signed-off-by: David Rientjes <rientjes@google.com>
Signed-off-by: Dennis Zhou <dennis@kernel.org>
  • Loading branch information
Erdem Aktas authored and Dennis Zhou committed Jan 31, 2020
1 parent becef18 commit 264b0d2
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions include/linux/percpu-defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,7 @@
* Declaration/definition used for per-CPU variables that should be accessed
* as decrypted when memory encryption is enabled in the guest.
*/
#if defined(CONFIG_VIRTUALIZATION) && defined(CONFIG_AMD_MEM_ENCRYPT)

#ifdef CONFIG_AMD_MEM_ENCRYPT
#define DECLARE_PER_CPU_DECRYPTED(type, name) \
DECLARE_PER_CPU_SECTION(type, name, "..decrypted")

Expand Down

0 comments on commit 264b0d2

Please sign in to comment.