linux-stable/arch
Ard Biesheuvel 835ae8a07a x86/sme: Fix memory encryption setting if enabled by default and not overridden
[ Upstream commit e814b59e6c ]

Commit

  cbebd68f59 ("x86/mm: Fix use of uninitialized buffer in sme_enable()")

'fixed' an issue in sme_enable() detected by static analysis, and broke
the common case in the process.

cmdline_find_option() will return < 0 on an error, or when the command
line argument does not appear at all. In this particular case, the
latter is not an error condition, and so the early exit is wrong.

Instead, without mem_encrypt= on the command line, the compile time
default should be honoured, which could be to enable memory encryption,
and this is currently broken.

Fix it by setting sme_me_mask to a preliminary value based on the
compile time default, and only omitting the command line argument test
when cmdline_find_option() returns an error.

  [ bp: Drop active_by_default while at it. ]

Fixes: cbebd68f59 ("x86/mm: Fix use of uninitialized buffer in sme_enable()")
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
Link: https://lore.kernel.org/r/20240126163918.2908990-2-ardb+git@google.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-03-26 18:19:19 -04:00
..
alpha rtc: Add support for configuring the UIP timeout for RTC reads 2024-01-31 16:18:56 -08:00
arc work around gcc bugs with 'asm goto' with outputs 2024-02-23 09:24:47 +01:00
arm ARM: dts: renesas: rcar-gen2: Add missing #interrupt-cells to DA9063 nodes 2024-03-26 18:19:13 -04:00
arm64 arm64: tegra: Set the correct PHY mode for MGBE 2024-03-26 18:19:14 -04:00
csky work around gcc bugs with 'asm goto' with outputs 2024-02-23 09:24:47 +01:00
hexagon Add x86 shadow stack support 2023-08-31 12:20:12 -07:00
ia64 cpu-hotplug: Provide prototypes for arch CPU registration 2023-10-11 14:27:37 +02:00
loongarch LoongArch: Update cpu_sibling_map when disabling nonboot CPUs 2024-03-01 13:34:58 +01:00
m68k mm: Introduce flush_cache_vmap_early() 2024-02-16 19:10:52 +01:00
microblaze Microblaze patches for 6.6-rc1 2023-09-05 10:15:22 -07:00
mips MIPS: Clear Cause.BD in instruction_pointer_set 2024-03-26 18:19:10 -04:00
nios2 mm: Introduce flush_cache_vmap_early() 2024-02-16 19:10:52 +01:00
openrisc OpenRISC updates for 6.6 2023-09-05 10:09:31 -07:00
parisc parisc/ftrace: add missing CONFIG_DYNAMIC_FTRACE check 2024-03-26 18:19:12 -04:00
powerpc powerpc/rtas: use correct function name for resetting TCE tables 2024-03-06 14:48:43 +00:00
riscv riscv: dts: sifive: add missing #interrupt-cells to pmic 2024-03-26 18:19:11 -04:00
s390 KVM: s390: vsie: fix race during shadow creation 2024-03-15 10:48:21 -04:00
sh mm: Introduce flush_cache_vmap_early() 2024-02-16 19:10:52 +01:00
sparc sparc: Fix undefined reference to fb_is_primary_device 2024-03-01 13:35:00 +01:00
um um: Fix adding '-no-pie' for clang 2024-02-23 09:25:03 +01:00
x86 x86/sme: Fix memory encryption setting if enabled by default and not overridden 2024-03-26 18:19:19 -04:00
xtensa work around gcc bugs with 'asm goto' with outputs 2024-02-23 09:24:47 +01:00
.gitignore
Kconfig scs: add CONFIG_MMU dependency for vfree_atomic() 2024-02-23 09:24:54 +01:00