linux-stable/arch
Isaku Yamahata 2c163520e1 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:32:07 +02:00
..
alpha local64.h: make <asm/local64.h> mandatory 2021-01-12 20:18:16 +01:00
arc arch/arc: add copy_user_page() to <asm/page.h> to fix build error on ARC 2021-01-19 18:27:26 +01:00
arm ARM: dts: imx6ull: fix ubi filesystem mount failed 2021-03-30 14:32:01 +02:00
arm64 arm64: kdump: update ppos when reading elfcorehdr 2021-03-30 14:32:03 +02:00
c6x
csky csky: Fix a size determination in gpr_get() 2021-03-04 11:38:21 +01:00
h8300 h8300: fix PREEMPTION build, TI_PRE_COUNT undefined 2021-02-17 11:02:28 +01:00
hexagon local64.h: make <asm/local64.h> mandatory 2021-01-12 20:18:16 +01:00
ia64 ia64: fix ptrace(PTRACE_SYSCALL_INFO_EXIT) sign 2021-03-30 14:31:52 +02:00
m68k local64.h: make <asm/local64.h> mandatory 2021-01-12 20:18:16 +01:00
microblaze local64.h: make <asm/local64.h> mandatory 2021-01-12 20:18:16 +01:00
mips MIPS: compressed: fix build with enabled UBSAN 2021-03-25 09:04:12 +01:00
nds32 local64.h: make <asm/local64.h> mandatory 2021-01-12 20:18:16 +01:00
nios2 nios2: fixed broken sys_clone syscall 2021-03-04 11:38:16 +01:00
openrisc sched/idle: Fix arch_cpu_idle() vs tracing 2020-11-24 16:47:35 +01:00
parisc parisc: Enable -mlong-calls gcc option with CONFIG_COMPILE_TEST 2021-03-11 14:17:21 +01:00
powerpc powerpc/4xx: Fix build errors from mfdcr() 2021-03-30 14:31:47 +02:00
riscv RISC-V: correct enum sbi_ext_rfence_fid 2021-03-25 09:04:09 +01:00
s390 s390/pci: fix leak of PCI device structure 2021-03-25 09:04:05 +01:00
sh sh: Remove unused HAVE_COPY_THREAD_TLS macro 2021-01-27 11:55:20 +01:00
sparc sparc64: Fix opcode filtering in handling of no fault loads 2021-03-30 14:31:50 +02:00
um um: defer killing userspace on page table update failures 2021-03-04 11:38:42 +01:00
x86 x86/mem_encrypt: Correct physical address calculation in __set_clr_pte_enc() 2021-03-30 14:32:07 +02:00
xtensa local64.h: make <asm/local64.h> mandatory 2021-01-12 20:18:16 +01:00
.gitignore
Kconfig fanotify: Fix sys_fanotify_mark() on native x86-32 2021-01-17 14:16:59 +01:00