LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Andy Lutomirski <luto@kernel.org>
To: "Edgecombe, Rick P" <rick.p.edgecombe@intel.com>
Cc: "luto@kernel.org" <luto@kernel.org>,
"songliubraving@fb.com" <songliubraving@fb.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"daniel@iogearbox.net" <daniel@iogearbox.net>,
"peterz@infradead.org" <peterz@infradead.org>,
"keescook@chromium.org" <keescook@chromium.org>,
"bpf@vger.kernel.org" <bpf@vger.kernel.org>,
"jeyu@kernel.org" <jeyu@kernel.org>,
"kuznet@ms2.inr.ac.ru" <kuznet@ms2.inr.ac.ru>,
"mjg59@google.com" <mjg59@google.com>,
"nadav.amit@gmail.com" <nadav.amit@gmail.com>,
"ast@kernel.org" <ast@kernel.org>,
"thgarnie@chromium.org" <thgarnie@chromium.org>,
"kpsingh@chromium.org" <kpsingh@chromium.org>,
"linux-security-module@vger.kernel.org"
<linux-security-module@vger.kernel.org>,
"x86@kernel.org" <x86@kernel.org>,
"revest@chromium.org" <revest@chromium.org>,
"jannh@google.com" <jannh@google.com>,
"namit@vmware.com" <namit@vmware.com>,
"jackmanb@chromium.org" <jackmanb@chromium.org>,
"Hansen, Dave" <dave.hansen@intel.com>,
"kafai@fb.com" <kafai@fb.com>, "yhs@fb.com" <yhs@fb.com>,
"davem@davemloft.net" <davem@davemloft.net>,
"yoshfuji@linux-ipv6.org" <yoshfuji@linux-ipv6.org>,
"mhalcrow@google.com" <mhalcrow@google.com>,
"andriin@fb.com" <andriin@fb.com>
Subject: Re: [PATCH bpf-next] bpf: Make trampolines W^X
Date: Fri, 10 Jan 2020 10:35:59 -0800 [thread overview]
Message-ID: <CALCETrWjx-D2sdJZbnydPgunNKmxuhYm=+6iPoy0DHEKCMkMsw@mail.gmail.com> (raw)
In-Reply-To: <96dd98b3c4f73b205b6e669ca87fa64901c117d6.camel@intel.com>
> On Jan 9, 2020, at 3:01 PM, Edgecombe, Rick P <rick.p.edgecombe@intel.com> wrote:
>> The vmap code immediately removes PTEs when unmaps occur (which it may
>> very well do right now -- I haven't checked) but also tracks the
>> kernel_tlb_gen associated with each record of an
>> unmapped-but-not-zapped area. Then we split vm_unmap_aliases() into a
>> variant that unmaps all aliases and a variant that merely promises to
>> unmap at least one alias. The former does what the current code does
>> except that it skips the IPI if all areas in question have tlb_gen <
>> flushed_kernel_tlb_gen. The latter clears all areas with tlb_gen <
>> flushed_kernel_tlb_gen and, if there weren't any, does
>> flush_tlb_kernel_range() and flushes everything.
>>
>> (Major caveat: this is wrong for the case where
>> flush_tlb_kernel_range() only flushes some but not all of the kernel.
>> So this needs considerable work if it's actually going to me useful.
>> The plain old "take locks and clean up" approach might be a better
>> bet.)
>>
>
> Hmm. In normal usage (!DEBUG_PAGE_ALLOC), are kernel range tlb shootdowns common
> outside of module space users and lazy vmap stuff? A tlb_gen solution might only
> be worth it in cases where something other than vm_unmap_aliases() and helpers
> was doing this frequently.
I suspect that the two bug users aside from vunmap() will be eBPF and,
eventually, XPFO / “exclusive pages” / less crappy SEV-like
implementations / actual high quality MKTME stuff / KVM
side-channel-proof memory. The latter doesn’t actually exist yet (the
SEV implementation sidesteps this with a horrible hack involving
incoherent mappings that are left active with fingers crossed), but it
really seems like it’s coming.
In general, if we’re going to have a pool of non-RW-direct-mapped
pages, we also want some moderately efficient way to produce such
pages.
Right now, creating and freeing eBPF programs in a loop is probably a
performance disaster on large systems.
next prev parent reply other threads:[~2020-01-10 18:36 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-03 23:47 KP Singh
2020-01-04 0:49 ` Andy Lutomirski
2020-01-05 1:19 ` Justin Capella
2020-01-06 8:23 ` Peter Zijlstra
2020-01-06 22:25 ` Edgecombe, Rick P
2020-01-07 1:36 ` Andy Lutomirski
2020-01-07 19:01 ` Edgecombe, Rick P
2020-01-08 8:41 ` Andy Lutomirski
2020-01-08 20:52 ` Edgecombe, Rick P
2020-01-09 6:48 ` Andy Lutomirski
2020-01-10 1:00 ` Edgecombe, Rick P
2020-01-10 18:35 ` Andy Lutomirski [this message]
[not found] <CAMrEMU8Vsn8rfULqf1gfuYL_-ybqzit29CLYReskaZ8XUroZww@mail.gmail.com>
[not found] ` <768BAF04-BEBF-489A-8737-B645816B262A@amacapital.net>
2020-01-06 22:13 ` Alexei Starovoitov
2020-01-07 9:11 ` Peter Zijlstra
2020-01-07 18:55 ` Alexei Starovoitov
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='CALCETrWjx-D2sdJZbnydPgunNKmxuhYm=+6iPoy0DHEKCMkMsw@mail.gmail.com' \
--to=luto@kernel.org \
--cc=andriin@fb.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=dave.hansen@intel.com \
--cc=davem@davemloft.net \
--cc=jackmanb@chromium.org \
--cc=jannh@google.com \
--cc=jeyu@kernel.org \
--cc=kafai@fb.com \
--cc=keescook@chromium.org \
--cc=kpsingh@chromium.org \
--cc=kuznet@ms2.inr.ac.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=mhalcrow@google.com \
--cc=mjg59@google.com \
--cc=nadav.amit@gmail.com \
--cc=namit@vmware.com \
--cc=peterz@infradead.org \
--cc=revest@chromium.org \
--cc=rick.p.edgecombe@intel.com \
--cc=songliubraving@fb.com \
--cc=thgarnie@chromium.org \
--cc=x86@kernel.org \
--cc=yhs@fb.com \
--cc=yoshfuji@linux-ipv6.org \
--subject='Re: [PATCH bpf-next] bpf: Make trampolines W^X' \
/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
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).