linux_dsm_epyc7002/arch/x86/mm
Isaku Yamahata 2c163520e1 x86/mem_encrypt: Correct physical address calculation in __set_clr_pte_enc()
commit 8249d17d3194eac064a8ca5bc5ca0abc86feecde 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
..
pat x86: fix seq_file iteration for pat/memtype.c 2021-03-04 11:38:38 +01:00
amdtopology.c
cpu_entry_area.c
debug_pagetables.c
dump_pagetables.c
extable.c This feature enhances the current guest memory encryption support 2020-10-14 10:21:34 -07:00
fault.c x86/fault: Fix AMD erratum #91 errata fixup for user code 2021-03-04 11:38:34 +01:00
highmem_32.c
hugetlbpage.c
ident_map.c x86/mm/ident_map: Check for errors from ident_pud_init() 2020-12-30 11:52:58 +01:00
init_32.c
init_64.c
init.c
iomap_32.c
ioremap.c
kasan_init_64.c
kaslr.c
kmmio.c
maccess.c
Makefile
mem_encrypt_boot.S
mem_encrypt_identity.c x86/mm/mem_encrypt: Fix definition of PMD_FLAGS_DEC_WP 2020-12-10 12:28:06 +01:00
mem_encrypt.c x86/mem_encrypt: Correct physical address calculation in __set_clr_pte_enc() 2021-03-30 14:32:07 +02:00
mm_internal.h
mmap.c
mmio-mod.c
numa_32.c
numa_64.c
numa_emulation.c x86/numa: cleanup configuration dependent command-line options 2020-10-13 18:38:27 -07:00
numa_internal.h
numa.c mm: fix phys_to_target_node() and memory_add_physaddr_to_nid() exports 2020-11-22 10:48:22 -08:00
pf_in.c
pf_in.h
pgtable_32.c
pgtable.c x86/mm: Fix leak of pmd ptlock 2021-01-12 20:18:22 +01:00
physaddr.c
physaddr.h
pkeys.c
pti.c
setup_nx.c
srat.c
testmmiotrace.c
tlb.c x86/membarrier: Get rid of a dubious optimization 2020-12-09 09:37:42 +01:00