[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0106e3fc-9780-e872-2274-fecf79c28923@intel.com>
Date: Fri, 21 Apr 2017 14:52:21 -0700
From: Dave Hansen <dave.hansen@...el.com>
To: Tom Lendacky <thomas.lendacky@....com>, linux-arch@...r.kernel.org,
linux-efi@...r.kernel.org, kvm@...r.kernel.org,
linux-doc@...r.kernel.org, x86@...nel.org,
kexec@...ts.infradead.org, linux-kernel@...r.kernel.org,
kasan-dev@...glegroups.com, linux-mm@...ck.org,
iommu@...ts.linux-foundation.org
Cc: Rik van Riel <riel@...hat.com>,
Radim Krčmář <rkrcmar@...hat.com>,
Toshimitsu Kani <toshi.kani@....com>,
Arnd Bergmann <arnd@...db.de>,
Jonathan Corbet <corbet@....net>,
Matt Fleming <matt@...eblueprint.co.uk>,
"Michael S. Tsirkin" <mst@...hat.com>,
Joerg Roedel <joro@...tes.org>,
Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>,
Paolo Bonzini <pbonzini@...hat.com>,
Larry Woodman <lwoodman@...hat.com>,
Brijesh Singh <brijesh.singh@....com>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Andy Lutomirski <luto@...nel.org>,
"H. Peter Anvin" <hpa@...or.com>,
Andrey Ryabinin <aryabinin@...tuozzo.com>,
Alexander Potapenko <glider@...gle.com>,
Dave Young <dyoung@...hat.com>,
Thomas Gleixner <tglx@...utronix.de>,
Dmitry Vyukov <dvyukov@...gle.com>
Subject: Re: [PATCH v5 09/32] x86/mm: Provide general kernel support for
memory encryption
On 04/18/2017 02:17 PM, Tom Lendacky wrote:
> @@ -55,7 +57,7 @@ static inline void copy_user_page(void *to, void *from, unsigned long vaddr,
> __phys_addr_symbol(__phys_reloc_hide((unsigned long)(x)))
>
> #ifndef __va
> -#define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET))
> +#define __va(x) ((void *)(__sme_clr(x) + PAGE_OFFSET))
> #endif
It seems wrong to be modifying __va(). It currently takes a physical
address, and this modifies it to take a physical address plus the SME bits.
How does that end up ever happening? If we are pulling physical
addresses out of the page tables, we use p??_phys(). I'd expect *those*
to be masking off the SME bits.
Is it these cases?
pgd_t *base = __va(read_cr3());
For those, it seems like we really want to create two modes of reading
cr3. One that truly reads CR3 and another that reads the pgd's physical
address out of CR3. Then you only do the SME masking on the one
fetching a physical address, and the SME bits never leak into __va().
Powered by blists - more mailing lists