From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dmitry Safonov <0x7f454c46@gmail.com> Subject: Re: [PATCHv3 12/27] x86/vdso: Restrict splitting VVAR VMA Date: Thu, 25 Apr 2019 19:46:48 +0100 Message-ID: References: <20190425161416.26600-1-dima@arista.com> <20190425161416.26600-13-dima@arista.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org To: Jann Horn , Dmitry Safonov Cc: kernel list , Adrian Reber , Andrei Vagin , Andy Lutomirski , Arnd Bergmann , Christian Brauner , Cyrill Gorcunov , "Eric W. Biederman" , "H. Peter Anvin" , Ingo Molnar , Jeff Dike , Oleg Nesterov , Pavel Emelyanov , Shuah Khan , Thomas Gleixner , Vincenzo Frascino , containers@lists.linux-foundation.org, criu@openvz.org, Linux API , the arch/x86 maintainers List-Id: linux-api@vger.kernel.org On 4/25/19 7:41 PM, Jann Horn wrote: > On Thu, Apr 25, 2019 at 6:17 PM Dmitry Safonov wrote: >> Although, time namespace can work with VVAR VMA split, it seems worth >> to forbid splitting VVAR resulting in stricter ABI and reducing amount >> of corner-cases to consider while working further on VDSO. > [...] >> diff --git a/arch/x86/entry/vdso/vma.c b/arch/x86/entry/vdso/vma.c >> index babc4e7a519c..ff9875a4d53b 100644 >> --- a/arch/x86/entry/vdso/vma.c >> +++ b/arch/x86/entry/vdso/vma.c > [...] >> +static int vvar_mremap(const struct vm_special_mapping *sm, >> + struct vm_area_struct *new_vma) >> +{ >> + unsigned long new_size = new_vma->vm_end - new_vma->vm_start; >> + const struct vdso_image *image = current->mm->context.vdso_image; > > Using current->mm in here is a bit awkward. So far the ->mremap > handler can only be invoked for `current`, but still, maybe > new_vma->vm_mm would be better here? Yep, can do - also in vdso_mremap(). Though, it should be only stylistic as it's checked in special_mapping_mremap() to be the same. > >> + if (new_size != -image->sym_vvar_start) >> + return -EINVAL; >> + >> + return 0; >> +} > [...] > Thanks, Dima