linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] X86: __set_clr_pte_enc() miscalculates physical address
@ 2021-03-18 20:26 Isaku Yamahata
  2021-03-19  6:38 ` Greg KH
  2021-03-22 21:02 ` Tom Lendacky
  0 siblings, 2 replies; 4+ messages in thread
From: Isaku Yamahata @ 2021-03-18 20:26 UTC (permalink / raw)
  To: linux-kernel, stable, x86, kvm
  Cc: brijesh.singh, tglx, bp, isaku.yamahata, thomas.lendacky,
	Isaku Yamahata, Kirill A . Shutemov

__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@linux.intel.com>
Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.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);
 
 	/*
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] X86: __set_clr_pte_enc() miscalculates physical address
  2021-03-18 20:26 [PATCH] X86: __set_clr_pte_enc() miscalculates physical address Isaku Yamahata
@ 2021-03-19  6:38 ` Greg KH
  2021-03-22 21:02 ` Tom Lendacky
  1 sibling, 0 replies; 4+ messages in thread
From: Greg KH @ 2021-03-19  6:38 UTC (permalink / raw)
  To: Isaku Yamahata
  Cc: linux-kernel, stable, x86, kvm, brijesh.singh, tglx, bp,
	isaku.yamahata, thomas.lendacky, Kirill A . Shutemov

On Thu, Mar 18, 2021 at 01:26:57PM -0700, 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@linux.intel.com>
> Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.com>
> ---
>  arch/x86/mm/mem_encrypt.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

<formletter>

This is not the correct way to submit patches for inclusion in the
stable kernel tree.  Please read:
    https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how to do this properly.

</formletter>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] X86: __set_clr_pte_enc() miscalculates physical address
  2021-03-18 20:26 [PATCH] X86: __set_clr_pte_enc() miscalculates physical address Isaku Yamahata
  2021-03-19  6:38 ` Greg KH
@ 2021-03-22 21:02 ` Tom Lendacky
  2021-03-23  7:20   ` Greg KH
  1 sibling, 1 reply; 4+ messages in thread
From: Tom Lendacky @ 2021-03-22 21:02 UTC (permalink / raw)
  To: Isaku Yamahata, linux-kernel, stable, x86, kvm
  Cc: brijesh.singh, tglx, bp, isaku.yamahata, Kirill A . Shutemov

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@linux.intel.com>
> Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.com>

Reviewed-by: Tom Lendacky <thomas.lendacky@amd.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);
>  
>  	/*
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] X86: __set_clr_pte_enc() miscalculates physical address
  2021-03-22 21:02 ` Tom Lendacky
@ 2021-03-23  7:20   ` Greg KH
  0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2021-03-23  7:20 UTC (permalink / raw)
  To: Tom Lendacky
  Cc: Isaku Yamahata, linux-kernel, stable, x86, kvm, brijesh.singh,
	tglx, bp, isaku.yamahata, Kirill A . Shutemov

On Mon, Mar 22, 2021 at 04:02:11PM -0500, Tom Lendacky wrote:
> 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@linux.intel.com>
> > Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.com>
> 
> Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>

<formletter>

This is not the correct way to submit patches for inclusion in the
stable kernel tree.  Please read:
    https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how to do this properly.

</formletter>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-03-23  7:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-18 20:26 [PATCH] X86: __set_clr_pte_enc() miscalculates physical address Isaku Yamahata
2021-03-19  6:38 ` Greg KH
2021-03-22 21:02 ` Tom Lendacky
2021-03-23  7:20   ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).