Subject: Re: [RFC 00/10] Process-local memory allocations for hiding KVM secrets References: <20190612170834.14855-1-mhillenb@amazon.de> <459e2273-bc27-f422-601b-2d6cdaf06f84@amazon.com> From: Dave Hansen Message-ID: Date: Thu, 13 Jun 2019 09:20:53 -0700 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit To: Andy Lutomirski , Alexander Graf , Nadav Amit Cc: Marius Hillenbrand , kvm list , LKML , Kernel Hardening , Linux-MM , Alexander Graf , David Woodhouse , the arch/x86 maintainers , Peter Zijlstra List-ID: On 6/13/19 9:13 AM, Andy Lutomirski wrote: >> It might make sense to use it for kmap_atomic() for debug purposes, as >> it ensures that other users can no longer access the same mapping >> through the linear map. However, it does come at quite a big cost, as we >> need to shoot down the TLB of all other threads in the system. So I'm >> not sure it's of general value? > What I meant was that kmap_atomic() could use mm-local memory so that > it doesn't need to do a global shootdown. But I guess it's not > actually used for real on 64-bit, so this is mostly moot. Are you > planning to support mm-local on 32-bit? Do we *do* global shootdowns on kmap_atomic()s on 32-bit? I thought we used entirely per-cpu addresses, so a stale entry from another CPU can get loaded in the TLB speculatively but it won't ever actually get used. I think it goes: kunmap_atomic() -> __kunmap_atomic() -> kpte_clear_flush() -> __flush_tlb_one_kernel() -> __flush_tlb_one_user() -> __native_flush_tlb_one_user() -> invlpg The per-cpu address calculation is visible in kmap_atomic_prot(): idx = type + KM_TYPE_NR*smp_processor_id();