[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0d99865a-30d5-9857-1a53-cc26ada6608c@amd.com>
Date: Mon, 22 Mar 2021 16:02:11 -0500
From: Tom Lendacky <thomas.lendacky@....com>
To: Isaku Yamahata <isaku.yamahata@...el.com>,
linux-kernel@...r.kernel.org, stable@...r.kernel.org,
x86@...nel.org, kvm@...r.kernel.org
Cc: brijesh.singh@....com, tglx@...utronix.de, bp@...en8.de,
isaku.yamahata@...il.com,
"Kirill A . Shutemov" <kirill.shutemov@...ux.intel.com>
Subject: Re: [PATCH] X86: __set_clr_pte_enc() miscalculates physical address
On 3/18/21 3:26 PM, Isaku Yamahata wrote:
> __set_clr_pte_enc() miscalculates physical address to operate.
> pfn is in unit of PG_LEVEL_4K, not PGL_LEVEL_{2M, 1G}.
> Shift size to get physical address should be PAGE_SHIFT,
> not page_level_shift().
>
> Fixes: dfaaec9033b8 ("x86: Add support for changing memory encryption attribute in early boot")
> Reviewed-by: Kirill A. Shutemov <kirill.shutemov@...ux.intel.com>
> Signed-off-by: Isaku Yamahata <isaku.yamahata@...el.com>
Reviewed-by: Tom Lendacky <thomas.lendacky@....com>
> ---
> arch/x86/mm/mem_encrypt.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/mm/mem_encrypt.c b/arch/x86/mm/mem_encrypt.c
> index 4b01f7dbaf30..ae78cef79980 100644
> --- a/arch/x86/mm/mem_encrypt.c
> +++ b/arch/x86/mm/mem_encrypt.c
> @@ -262,7 +262,7 @@ static void __init __set_clr_pte_enc(pte_t *kpte, int level, bool enc)
> if (pgprot_val(old_prot) == pgprot_val(new_prot))
> return;
>
> - pa = pfn << page_level_shift(level);
> + pa = pfn << PAGE_SHIFT;
> size = page_level_size(level);
>
> /*
>
Powered by blists - more mailing lists