From mboxrd@z Thu Jan 1 00:00:00 1970 From: Catalin Marinas Subject: Re: [PATCH v10 07/12] fs, arm64: untag user pointers in fs/userfaultfd.c Date: Fri, 1 Mar 2019 16:59:08 +0000 Message-ID: <20190301165908.GA130541@arrakis.emea.arm.com> References: <8343cd77ca301df15839796f3b446b75ce5ffbbf.1550839937.git.andreyknvl@google.com> <73f2f3fe-9a66-22a1-5aae-c282779a75f5@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org To: Andrey Konovalov Cc: Dave Hansen , Will Deacon , Mark Rutland , Robin Murphy , Kees Cook , Kate Stewart , Greg Kroah-Hartman , Andrew Morton , Ingo Molnar , "Kirill A . Shutemov" , Shuah Khan , Vincenzo Frascino , Linux ARM , "open list:DOCUMENTATION" , Linux Memory Management List , linux-arch , "open list:KERNEL SELFTEST FRAMEWORK" List-Id: linux-arch.vger.kernel.org On Tue, Feb 26, 2019 at 03:39:08PM +0100, Andrey Konovalov wrote: > On Sat, Feb 23, 2019 at 12:06 AM Dave Hansen wrote: > > > > On 2/22/19 4:53 AM, Andrey Konovalov wrote: > > > userfaultfd_register() and userfaultfd_unregister() use provided user > > > pointers for vma lookups, which can only by done with untagged pointers. > > > > So, we have to patch all these sites before the tagged values get to the > > point of hitting the vma lookup functions. Dumb question: Why don't we > > just patch the vma lookup functions themselves instead of all of these > > callers? > > That might be a working approach as well. We'll still need to fix up > places where the vma fields are accessed directly. Catalin, what do > you think? Most callers of find_vma*() always follow it by a check of vma->vma_start against some tagged address ('end' in the userfaultfd_(un)register()) case. So it's not sufficient to untag it in find_vma(). -- Catalin From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com ([217.140.101.70]:39128 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389170AbfCAQ7Q (ORCPT ); Fri, 1 Mar 2019 11:59:16 -0500 Date: Fri, 1 Mar 2019 16:59:08 +0000 From: Catalin Marinas Subject: Re: [PATCH v10 07/12] fs, arm64: untag user pointers in fs/userfaultfd.c Message-ID: <20190301165908.GA130541@arrakis.emea.arm.com> References: <8343cd77ca301df15839796f3b446b75ce5ffbbf.1550839937.git.andreyknvl@google.com> <73f2f3fe-9a66-22a1-5aae-c282779a75f5@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-arch-owner@vger.kernel.org List-ID: To: Andrey Konovalov Cc: Dave Hansen , Will Deacon , Mark Rutland , Robin Murphy , Kees Cook , Kate Stewart , Greg Kroah-Hartman , Andrew Morton , Ingo Molnar , "Kirill A . Shutemov" , Shuah Khan , Vincenzo Frascino , Linux ARM , "open list:DOCUMENTATION" , Linux Memory Management List , linux-arch , "open list:KERNEL SELFTEST FRAMEWORK" , LKML , Dmitry Vyukov , Kostya Serebryany , Evgeniy Stepanov , Lee Smith , Ramana Radhakrishnan , Jacob Bramley , Ruben Ayrapetyan , Chintan Pandya , Luc Van Oostenryck , Dave Martin , Kevin Brodsky , Szabolcs Nagy Message-ID: <20190301165908.14GT-ERRN_tC5LYIk3zTudAh3Y4qSmqpWLD7e2eT-Eg@z> On Tue, Feb 26, 2019 at 03:39:08PM +0100, Andrey Konovalov wrote: > On Sat, Feb 23, 2019 at 12:06 AM Dave Hansen wrote: > > > > On 2/22/19 4:53 AM, Andrey Konovalov wrote: > > > userfaultfd_register() and userfaultfd_unregister() use provided user > > > pointers for vma lookups, which can only by done with untagged pointers. > > > > So, we have to patch all these sites before the tagged values get to the > > point of hitting the vma lookup functions. Dumb question: Why don't we > > just patch the vma lookup functions themselves instead of all of these > > callers? > > That might be a working approach as well. We'll still need to fix up > places where the vma fields are accessed directly. Catalin, what do > you think? Most callers of find_vma*() always follow it by a check of vma->vma_start against some tagged address ('end' in the userfaultfd_(un)register()) case. So it's not sufficient to untag it in find_vma(). -- Catalin