From: Andy Lutomirski <luto@kernel.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
X86 ML <x86@kernel.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Andy Lutomirsky <luto@kernel.org>,
Dave Hansen <dave.hansen@intel.com>,
Borislav Petkov <bpetkov@suse.de>,
Greg KH <gregkh@linuxfoundation.org>,
Kees Cook <keescook@google.com>, Hugh Dickins <hughd@google.com>,
Brian Gerst <brgerst@gmail.com>,
Josh Poimboeuf <jpoimboe@redhat.com>,
Denys Vlasenko <dvlasenk@redhat.com>,
Boris Ostrovsky <boris.ostrovsky@oracle.com>,
Juergen Gross <jgross@suse.com>,
David Laight <David.Laight@aculab.com>,
Eduardo Valentin <eduval@amazon.com>,
"Liguori, Anthony" <aliguori@amazon.com>,
Will Deacon <will.deacon@arm.com>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
Dan Williams <dan.j.williams@intel.com>
Subject: Re: [PATCH v2 00/17] x86/ldt: Use a VMA based read only mapping
Date: Thu, 14 Dec 2017 08:35:50 -0800 [thread overview]
Message-ID: <CALCETrV8MAVD_4mvQQ_=E2H1CMtRm=Axutqwc9hzjqkK8NwVSQ@mail.gmail.com> (raw)
In-Reply-To: <20171214120853.u2vc4x55faurkgec@hirez.programming.kicks-ass.net>
On Thu, Dec 14, 2017 at 4:08 AM, Peter Zijlstra <peterz@infradead.org> wrote:
> On Thu, Dec 14, 2017 at 01:03:37PM +0100, Thomas Gleixner wrote:
>> On Thu, 14 Dec 2017, Peter Zijlstra wrote:
>> > So here's a second posting of the VMA based LDT implementation; now without
>> > most of the crazy.
>> >
>> > I took out the write fault handler and the magic LAR touching code.
>> >
>> > Additionally there are a bunch of patches that address generic vm issue.
>> >
>> > - gup() access control; In specific I looked at accessing !_PAGE_USER pages
>> > because these patches rely on not being able to do that.
>> >
>> > - special mappings; A whole bunch of mmap ops don't make sense on special
>> > mappings so disallow them.
>> >
>> > Both things make sense independent of the rest of the series. Similarly, the
>> > patches that kill that rediculous LDT inherit on exec() are also unquestionably
>> > good.
>> >
>> > So I think at least the first 6 patches are good, irrespective of the
>> > VMA approach.
>> >
>> > On the whole VMA approach, Andy I know you hate it with a passion, but I really
>> > rather like how it ties the LDT to the process that it belongs to and it
>> > reduces the amount of 'special' pages in the whole PTI mapping.
>> >
>> > I'm not the one going to make the decision on this; but I figured I at least
>> > post a version without the obvious crap parts of the last one.
>> >
>> > Note: if we were to also disallow munmap() for special mappings (which I
>> > suppose makes perfect sense) then we could further reduce the actual LDT
>> > code (we'd no longer need the sm::close callback and related things).
>>
>> That makes a lot of sense for the other special mapping users like VDSO and
>> kprobes.
>
> Right, and while looking at that I also figured it might make sense to
> unconditionally disallow splitting special mappings.
>
>
> --- a/mm/mmap.c
> +++ b/mm/mmap.c
> @@ -2698,6 +2698,9 @@ int do_munmap(struct mm_struct *mm, unsi
> }
> vma = prev ? prev->vm_next : mm->mmap;
>
> + if (vma_is_special_mapping(vma))
> + return -EINVAL;
> +
> if (unlikely(uf)) {
> /*
> * If userfaultfd_unmap_prep returns an error the vmas
> @@ -3223,10 +3226,11 @@ static int special_mapping_fault(struct
> */
> static void special_mapping_close(struct vm_area_struct *vma)
> {
> - struct vm_special_mapping *sm = vma->vm_private_data;
> +}
>
> - if (sm->close)
> - sm->close(sm, vma);
> +static int special_mapping_split(struct vm_area_struct *vma, unsigned long addr)
> +{
> + return -EINVAL;
> }
>
> static const char *special_mapping_name(struct vm_area_struct *vma)
> @@ -3252,6 +3256,7 @@ static const struct vm_operations_struct
> .fault = special_mapping_fault,
> .mremap = special_mapping_mremap,
> .name = special_mapping_name,
> + .split = special_mapping_split,
> };
>
> static const struct vm_operations_struct legacy_special_mapping_vmops = {
Disallowing splitting seems fine. Disallowing munmap might not be.
Certainly CRIU relies on being able to mremap() the VDSO.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2017-12-14 16:36 UTC|newest]
Thread overview: 76+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-14 11:27 Peter Zijlstra
2017-12-14 11:27 ` [PATCH v2 01/17] mm/gup: Fixup p*_access_permitted() Peter Zijlstra
2017-12-14 12:41 ` Peter Zijlstra
2017-12-14 14:37 ` Peter Zijlstra
2017-12-14 20:44 ` Dave Hansen
2017-12-14 20:54 ` Peter Zijlstra
2017-12-14 21:18 ` Peter Zijlstra
2017-12-15 5:04 ` Dave Hansen
2017-12-15 6:09 ` Linus Torvalds
2017-12-15 7:51 ` Peter Zijlstra
2017-12-16 0:20 ` Linus Torvalds
2017-12-16 0:29 ` Dan Williams
2017-12-16 1:10 ` Linus Torvalds
2017-12-16 1:25 ` Dave Hansen
2017-12-16 2:28 ` Linus Torvalds
2017-12-16 2:48 ` Al Viro
2017-12-16 2:52 ` Linus Torvalds
2017-12-16 3:00 ` Linus Torvalds
2017-12-16 3:21 ` Dave Hansen
2017-12-16 1:29 ` Dan Williams
2017-12-16 0:31 ` Al Viro
2017-12-16 1:05 ` Linus Torvalds
2017-12-15 8:00 ` Peter Zijlstra
2017-12-15 10:25 ` Peter Zijlstra
2017-12-15 11:38 ` Peter Zijlstra
2017-12-15 16:38 ` Dan Williams
2017-12-18 11:54 ` Peter Zijlstra
2017-12-18 18:42 ` Dan Williams
2017-12-15 14:04 ` Peter Zijlstra
2017-12-14 11:27 ` [PATCH v2 02/17] mm: Exempt special mappings from mlock(), mprotect() and madvise() Peter Zijlstra
2017-12-14 16:19 ` Andy Lutomirski
2017-12-14 17:36 ` Peter Zijlstra
2018-01-02 16:44 ` Dmitry Safonov
2017-12-14 11:27 ` [PATCH v2 03/17] arch: Allow arch_dup_mmap() to fail Peter Zijlstra
2017-12-14 16:22 ` Andy Lutomirski
2017-12-14 11:27 ` [PATCH v2 04/17] x86/ldt: Rework locking Peter Zijlstra
2017-12-14 11:27 ` [PATCH v2 05/17] x86/ldt: Prevent ldt inheritance on exec Peter Zijlstra
2017-12-14 16:32 ` Andy Lutomirski
2017-12-14 11:27 ` [PATCH v2 06/17] x86/ldt: Do not install LDT for kernel threads Peter Zijlstra
2017-12-14 19:43 ` Peter Zijlstra
2017-12-14 21:27 ` Andy Lutomirski
2017-12-14 11:27 ` [PATCH v2 07/17] mm/softdirty: Move VM_SOFTDIRTY into high bits Peter Zijlstra
2017-12-14 11:27 ` [PATCH v2 08/17] mm/x86: Allow special mappings with user access cleared Peter Zijlstra
2017-12-14 11:27 ` [PATCH v2 09/17] mm: Provide vm_special_mapping::close Peter Zijlstra
2017-12-14 11:27 ` [PATCH v2 10/17] selftest/x86: Implement additional LDT selftests Peter Zijlstra
2017-12-14 11:27 ` [PATCH v2 11/17] selftests/x86/ldt_gdt: Prepare for access bit forced Peter Zijlstra
2017-12-14 16:20 ` Andy Lutomirski
2017-12-14 19:43 ` Linus Torvalds
2017-12-14 21:22 ` Andy Lutomirski
2017-12-14 21:44 ` Linus Torvalds
2017-12-14 21:48 ` Linus Torvalds
2017-12-14 22:02 ` Peter Zijlstra
2017-12-14 22:14 ` Linus Torvalds
2017-12-14 22:24 ` Peter Zijlstra
2017-12-14 22:52 ` Linus Torvalds
2017-12-14 22:11 ` Andy Lutomirski
2017-12-14 22:15 ` Linus Torvalds
2017-12-14 22:30 ` Andy Lutomirski
2017-12-14 22:23 ` Thomas Gleixner
2017-12-14 22:50 ` Linus Torvalds
2017-12-14 11:27 ` [PATCH v2 12/17] mm: Make populate_vma_page_range() available Peter Zijlstra
2017-12-14 11:27 ` [PATCH v2 13/17] x86/mm: Force LDT desc accessed bit Peter Zijlstra
2017-12-14 16:21 ` Andy Lutomirski
2017-12-14 11:27 ` [PATCH v2 14/17] x86/ldt: Reshuffle code Peter Zijlstra
2017-12-14 16:23 ` Andy Lutomirski
2017-12-14 16:31 ` Thomas Gleixner
2017-12-14 16:32 ` Thomas Gleixner
2017-12-14 16:34 ` Andy Lutomirski
2017-12-14 17:47 ` Peter Zijlstra
2017-12-14 11:27 ` [PATCH v2 15/17] x86/ldt: Prepare for VMA mapping Peter Zijlstra
2017-12-14 11:27 ` [PATCH v2 16/17] x86/ldt: Add VMA management code Peter Zijlstra
2017-12-14 11:27 ` [PATCH v2 17/17] x86/ldt: Make it read only VMA mapped Peter Zijlstra
2017-12-14 12:03 ` [PATCH v2 00/17] x86/ldt: Use a VMA based read only mapping Thomas Gleixner
2017-12-14 12:08 ` Peter Zijlstra
2017-12-14 16:35 ` Andy Lutomirski [this message]
2017-12-14 17:50 ` Peter Zijlstra
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='CALCETrV8MAVD_4mvQQ_=E2H1CMtRm=Axutqwc9hzjqkK8NwVSQ@mail.gmail.com' \
--to=luto@kernel.org \
--cc=David.Laight@aculab.com \
--cc=aliguori@amazon.com \
--cc=boris.ostrovsky@oracle.com \
--cc=bpetkov@suse.de \
--cc=brgerst@gmail.com \
--cc=dan.j.williams@intel.com \
--cc=dave.hansen@intel.com \
--cc=dvlasenk@redhat.com \
--cc=eduval@amazon.com \
--cc=gregkh@linuxfoundation.org \
--cc=hughd@google.com \
--cc=jgross@suse.com \
--cc=jpoimboe@redhat.com \
--cc=keescook@google.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=will.deacon@arm.com \
--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