From: Nadav Amit <namit@vmware.com>
To: Dave Hansen <dave.hansen@intel.com>, Andy Lutomirski <luto@kernel.org>
Cc: Alexander Graf <graf@amazon.com>,
Marius Hillenbrand <mhillenb@amazon.de>,
kvm list <kvm@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Kernel Hardening <kernel-hardening@lists.openwall.com>,
Linux-MM <linux-mm@kvack.org>, Alexander Graf <graf@amazon.de>,
David Woodhouse <dwmw@amazon.co.uk>,
the arch/x86 maintainers <x86@kernel.org>,
Peter Zijlstra <peterz@infradead.org>
Subject: Re: [RFC 00/10] Process-local memory allocations for hiding KVM secrets
Date: Thu, 13 Jun 2019 17:29:14 +0000 [thread overview]
Message-ID: <70BEF143-00BA-4E4B-ACD7-41AD2E6250BE@vmware.com> (raw)
In-Reply-To: <f1dfbfb4-d2d5-bf30-600f-9e756a352860@intel.com>
> On Jun 13, 2019, at 9:20 AM, Dave Hansen <dave.hansen@intel.com> wrote:
>
> 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();
From a security point-of-view, having such an entry is still not too good,
since the mapping protection might override the default protection. This
might lead to potential W+X cases, for example, that might stay for a long
time if they are speculatively cached in the TLB and not invalidated upon
kunmap_atomic().
Having said that, I am not too excited to deal with this issue. Do people
still care about x86/32-bit? In addition, if kunmap_atomic() is used when
IRQs are disabled, sending a TLB shootdown during kunmap_atomic() can cause
a deadlock.
next prev parent reply other threads:[~2019-06-13 17:29 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-12 17:08 [RFC 00/10] Process-local memory allocations for hiding KVM secrets Marius Hillenbrand
2019-06-12 17:08 ` [RFC 01/10] x86/mm/kaslr: refactor to use enum indices for regions Marius Hillenbrand
2019-06-12 17:08 ` [RFC 02/10] x86/speculation, mm: add process local virtual memory region Marius Hillenbrand
2019-06-12 17:08 ` [RFC 03/10] x86/mm, mm,kernel: add teardown for process-local memory to mm cleanup Marius Hillenbrand
2019-06-12 17:08 ` [RFC 04/10] mm: allocate virtual space for process-local memory Marius Hillenbrand
2019-06-12 17:08 ` [RFC 05/10] mm: allocate/release physical pages " Marius Hillenbrand
2019-06-12 17:08 ` [RFC 06/10] kvm/x86: add support for storing vCPU state in " Marius Hillenbrand
2019-06-12 17:08 ` [RFC 07/10] kvm, vmx: move CR2 context switch out of assembly path Marius Hillenbrand
2019-06-12 17:08 ` [RFC 08/10] kvm, vmx: move register clearing " Marius Hillenbrand
2019-06-12 17:08 ` [RFC 09/10] kvm, vmx: move gprs to process local memory Marius Hillenbrand
2019-06-12 17:08 ` [RFC 10/10] kvm, x86: move guest FPU state into " Marius Hillenbrand
2019-06-12 18:25 ` [RFC 00/10] Process-local memory allocations for hiding KVM secrets Sean Christopherson
2019-06-13 7:20 ` Alexander Graf
2019-06-13 10:54 ` Liran Alon
2019-06-12 19:55 ` Dave Hansen
2019-06-12 20:27 ` Andy Lutomirski
2019-06-12 20:41 ` Dave Hansen
2019-06-12 20:56 ` Andy Lutomirski
2019-06-13 1:30 ` Andy Lutomirski
2019-06-13 1:50 ` Nadav Amit
2019-06-13 16:16 ` Andy Lutomirski
2019-06-13 7:52 ` Alexander Graf
2019-06-13 16:13 ` Andy Lutomirski
2019-06-13 16:20 ` Dave Hansen
2019-06-13 17:29 ` Nadav Amit [this message]
2019-06-13 17:49 ` Dave Hansen
2019-06-13 20:05 ` Sean Christopherson
2019-06-14 14:21 ` Thomas Gleixner
2019-06-16 22:18 ` Andy Lutomirski
2019-06-16 22:28 ` Thomas Gleixner
2019-06-17 7:38 ` Alexander Graf
2019-06-17 15:50 ` Dave Hansen
2019-06-17 15:54 ` Andy Lutomirski
2019-06-17 16:03 ` Dave Hansen
2019-06-17 16:14 ` Andy Lutomirski
2019-06-17 16:53 ` Nadav Amit
2019-06-17 18:07 ` Dave Hansen
2019-06-17 18:45 ` Konrad Rzeszutek Wilk
2019-06-17 18:49 ` Dave Hansen
2019-06-17 18:53 ` Andy Lutomirski
2019-06-17 18:50 ` Nadav Amit
2019-06-17 18:55 ` Dave Hansen
2019-06-13 7:27 ` Alexander Graf
2019-06-13 14:19 ` Dave Hansen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=70BEF143-00BA-4E4B-ACD7-41AD2E6250BE@vmware.com \
--to=namit@vmware.com \
--cc=dave.hansen@intel.com \
--cc=dwmw@amazon.co.uk \
--cc=graf@amazon.com \
--cc=graf@amazon.de \
--cc=kernel-hardening@lists.openwall.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=luto@kernel.org \
--cc=mhillenb@amazon.de \
--cc=peterz@infradead.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).