linux-stable/arch/x86
Isaku Yamahata dfd6627c83 x86/mem_encrypt: Correct physical address calculation in __set_clr_pte_enc()
commit 8249d17d31 upstream.

The pfn variable contains the page frame number as returned by the
pXX_pfn() functions, shifted to the right by PAGE_SHIFT to remove the
page bits. After page protection computations are done to it, it gets
shifted back to the physical address using page_level_shift().

That is wrong, of course, because that function determines the shift
length based on the level of the page in the page table but in all the
cases, it was shifted by PAGE_SHIFT before.

Therefore, shift it back using PAGE_SHIFT to get the correct physical
address.

 [ bp: Rewrite commit message. ]

Fixes: dfaaec9033 ("x86: Add support for changing memory encryption attribute in early boot")
Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
Cc: <stable@vger.kernel.org>
Link: https://lkml.kernel.org/r/81abbae1657053eccc535c16151f63cd049dcb97.1616098294.git.isaku.yamahata@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-30 14:35:29 +02:00
..
boot x86/asm: Replace __force_order with a memory clobber 2020-10-29 09:58:01 +01:00
configs vgacon: remove software scrollback support 2020-09-17 13:47:54 +02:00
crypto crypto: x86/aes-ni-xts - use direct calls to and 4-way stride 2021-03-20 10:39:47 +01:00
entry x86/asm/32: Add ENDs to some functions and relabel with SYM_CODE_* 2021-01-17 14:05:30 +01:00
events perf/x86/intel: Fix a crash caused by zero PEBS status 2021-03-24 11:26:43 +01:00
hyperv x86/hyperv: check cpu mask after interrupt has been disabled 2021-01-19 18:26:12 +01:00
ia32
include x86: Introduce TS_COMPAT_RESTART to fix get_nr_restart_syscall() 2021-03-24 11:26:44 +01:00
kernel x86/apic/of: Fix CPU devicetree-node lookups 2021-03-24 11:26:45 +01:00
kvm kvm: x86: replace kvm_spec_ctrl_test_value with runtime test on the host 2021-03-04 10:26:09 +01:00
lib x86/mmx: Use KFPU_387 for MMX string operations 2021-01-27 11:47:49 +01:00
math-emu
mm x86/mem_encrypt: Correct physical address calculation in __set_clr_pte_enc() 2021-03-30 14:35:29 +02:00
net
oprofile
pci x86/PCI: Fix intel_mid_pci.c build error when ACPI is not enabled 2020-11-01 12:01:02 +01:00
platform efi/x86: Free efi_pgd with free_pages() 2020-11-24 13:29:19 +01:00
power x86/asm/32: Add ENDs to some functions and relabel with SYM_CODE_* 2021-01-17 14:05:30 +01:00
purgatory
ras
realmode x86/asm/32: Add ENDs to some functions and relabel with SYM_CODE_* 2021-01-17 14:05:30 +01:00
tools x86/build: Treat R_386_PLT32 relocation as R_386_PC32 2021-03-07 12:20:45 +01:00
um
video
xen Xen/gnttab: handle p2m update errors on a per-slot basis 2021-03-07 12:20:49 +01:00
.gitignore
Kbuild
Kconfig
Kconfig.cpu
Kconfig.debug
Makefile x86/build: Disable CET instrumentation in the kernel for 32-bit too 2021-02-17 10:35:17 +01:00
Makefile.um
Makefile_32.cpu