Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp39167pxb; Tue, 12 Jan 2021 19:21:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJz+pIrwosTwqLyHvgZ3pkd2PUKMqjx8Tunps18trEUrsBRrqAWiRA4HObnXOEBk5jdonDqs X-Received: by 2002:a05:6402:c4:: with SMTP id i4mr138393edu.152.1610508071847; Tue, 12 Jan 2021 19:21:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610508071; cv=none; d=google.com; s=arc-20160816; b=UsrzrTjbBgwYgI9kMIhuRq0N8o5gDF55DNhuq4+9ZNzBWItqk+dQlki6kBsBduCXTd oUj8zxMsbSVFM1Gy5B7qMNHtxnRfCkT0wuFZyyBd0Ee7IJQwiMp5QYL+5bExPTvy7QsP qZBgBp+nn/xzONjb6fCmz16ZO+cnUOd78MGnyf73U+tjyPIGgJPRlyAsO8uFqqlF/wM2 pCUN8bUNIsQBCh9kgreLsL4tl2CQlpUYnUC0OCjxSj0JHhfllvupJJTkmyiDkXOFvAhY xaxK8fxOyuCklr+TEPRZKoucaNFVCHBYQpKIYQZcI/eGGM3wcWOAK93pxvMIgSPHf6Ek pqUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=nruKmu2UUVoUSM7woP/50hX2m5ZhfS21/o6Hb3oB1RQ=; b=VNTCJ8Tkm73OQfPUzrFOyzE5ZvNfrcRlfcA4sw5QkOCYgObNmgcfwn7Yakv5CoHhzG Tb4l+1adHSW8DPh9ePIy+1MukxpB5iU5VU3Tfg3A6u2yG7BXafPtgMhSjXpnDOCfRzbM StEGQSvssXNbbqesGzsqWS5G4oLvcfGmTJ06R4aNm1VOhv011levlE3MiOGp4/8CeXAX Y1LZ+Ip3H4BzQLD6SSHBW5iS1QHgBCDCXSLEvaozcGnoDF5JNqv65qZnoVoJSE6LktaB QJm6mKegm1TLLE6wRS0OzGo2qnFrXEI3B3dd2x33Cs9PH6quo9GLULafM50q0qms4RG7 3RjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Cg8lDoFe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i23si367331ejj.531.2021.01.12.19.20.48; Tue, 12 Jan 2021 19:21:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Cg8lDoFe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438471AbhALWrE (ORCPT + 99 others); Tue, 12 Jan 2021 17:47:04 -0500 Received: from mail.kernel.org ([198.145.29.99]:33980 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2436769AbhALWrE (ORCPT ); Tue, 12 Jan 2021 17:47:04 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id A3B4A230F9; Tue, 12 Jan 2021 22:46:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1610491583; bh=Rqin12tOcaSlTV0JXx5zAMTAIc0/hFy8RZqaB/MNwdY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Cg8lDoFec4nxn4ii7SgesxmcAdK/ZNLOi6F8E53v1gyb6dhcaSQ3/EepChN1EE7ri PdHcEkZ4wmBKZVHZXlAR0Axg/WiQVXdc9BAgfZlNjb4rGDaiu4kRyocGIMv/T7wBMR MxflRnIiu+vwQRcw+whzQ6OjfrlMmmT5Oa4PGt+Mx/IwfxlQzhohMkWUbRi3u6hd1q Wba5BkCe3gusMjnr7aThGGrqpYpkTjqDM+ezRikDJbRcfCFU/zxb4n4Tt7PawBBTnr bIEh4ze/hUCI1EpS+8TP0sdQx+TIiTj/9ChoepX5Fy9MB5aenX7Gf61IBY9dTCarAp eMmy7vyDn1kNA== Date: Tue, 12 Jan 2021 22:46:17 +0000 From: Will Deacon To: Nadav Amit Cc: Yu Zhao , Laurent Dufour , Peter Zijlstra , Vinayak Menon , Linus Torvalds , Andy Lutomirski , Peter Xu , Andrea Arcangeli , linux-mm , lkml , Pavel Emelyanov , Mike Kravetz , Mike Rapoport , stable , Minchan Kim , surenb@google.com Subject: Re: [PATCH] mm/userfaultfd: fix memory corruption due to writeprotect Message-ID: <20210112224616.GA10512@willie-the-truck> References: <20210105153727.GK3040@hirez.programming.kicks-ass.net> <0201238b-e716-2a3c-e9ea-d5294ff77525@linux.vnet.ibm.com> <2C7AE23B-ACA3-4D55-A907-AF781C5608F0@gmail.com> <20210112214337.GA10434@willie-the-truck> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 12, 2021 at 02:29:51PM -0800, Nadav Amit wrote: > > On Jan 12, 2021, at 1:43 PM, Will Deacon wrote: > > > > On Tue, Jan 12, 2021 at 12:38:34PM -0800, Nadav Amit wrote: > >>> On Jan 12, 2021, at 11:56 AM, Yu Zhao wrote: > >>> On Tue, Jan 12, 2021 at 11:15:43AM -0800, Nadav Amit wrote: > >>>> I will send an RFC soon for per-table deferred TLB flushes tracking. > >>>> The basic idea is to save a generation in the page-struct that tracks > >>>> when deferred PTE change took place, and track whenever a TLB flush > >>>> completed. In addition, other users - such as mprotect - would use > >>>> the tlb_gather interface. > >>>> > >>>> Unfortunately, due to limited space in page-struct this would only > >>>> be possible for 64-bit (and my implementation is only for x86-64). > >>> > >>> I don't want to discourage you but I don't think this would end up > >>> well. PPC doesn't necessarily follow one-page-struct-per-table rule, > >>> and I've run into problems with this before while trying to do > >>> something similar. > >> > >> Discourage, discourage. Better now than later. > >> > >> It will be relatively easy to extend the scheme to be per-VMA instead of > >> per-table for architectures that prefer it this way. It does require > >> TLB-generation tracking though, which Andy only implemented for x86, so I > >> will focus on x86-64 right now. > > > > Can you remind me of what we're missing on arm64 in this area, please? I'm > > happy to help get this up and running once you have something I can build > > on. > > Let me first finish making something that we can use as a basis for a > discussion. I do not waste your time before I have something ready. Sure thing! Give me a shout when you're ready. Will