[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9b69d49f-969c-5720-5723-f89ff0e000c0@intel.com>
Date: Fri, 20 Mar 2020 15:26:09 -0700
From: Dave Hansen <dave.hansen@...el.com>
To: Joerg Roedel <joro@...tes.org>
Cc: David Rientjes <rientjes@...gle.com>, x86@...nel.org,
hpa@...or.com, Andy Lutomirski <luto@...nel.org>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Peter Zijlstra <peterz@...radead.org>,
Thomas Hellstrom <thellstrom@...are.com>,
Jiri Slaby <jslaby@...e.cz>,
Dan Williams <dan.j.williams@...el.com>,
Tom Lendacky <thomas.lendacky@....com>,
Juergen Gross <jgross@...e.com>,
Kees Cook <keescook@...omium.org>,
linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
virtualization@...ts.linux-foundation.org,
Joerg Roedel <jroedel@...e.de>
Subject: Re: [PATCH 21/70] x86/boot/compressed/64: Add function to map a page
unencrypted
On 3/20/20 3:12 PM, Joerg Roedel wrote:
> On Fri, Mar 20, 2020 at 02:02:13PM -0700, Dave Hansen wrote:
>> It *never* flushes global pages. For a generic function like this, that
>> seems pretty dangerous because the PTEs it goes after could quite easily
>> be Global. It's also not _obviously_ correct if PCIDs are in play
>> (which I don't think they are on AMD).
>>
>> A flush_tlb_global() is probably more appropriate. Better yet, is there
>> a reason not to use flush_tlb_kernel_range()? I don't think it's
>> necessary to whack the entire TLB for one PTE set.
>
> This code runs before the actual kernel image is decompressed, so there
> is no PCID and no global pages (I think CR4.PGE is still 0). So a
> cr3-write is enough to flush the TLB. Also the TLB-flush helpers of the
> running kernel are not available here.
Geez, I always forget about the compressed code. :) Good point about PCIDs.
In any case, I thought this all came through initialize_identity_maps(),
which does, for instance:
mapping_info.page_flag = __PAGE_KERNEL_LARGE_EXEC | sme_me_mask;
Where:
#define __PAGE_KERNEL_LARGE_EXEC (__PP|__RW| 0|___A| 0|___D|_PSE|___G)
That looks like it has the Global bit set. Does that not apply here
somehow?
Powered by blists - more mailing lists