Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp37495pxb; Tue, 12 Jan 2021 19:17:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJycS/Gi6hd6YZelIXo44lqERzGH+s5iOYn8TJESi/oNueJ0TgeH5qDg5EcIagEuCWyKHswE X-Received: by 2002:a17:906:440e:: with SMTP id x14mr38587ejo.77.1610507867391; Tue, 12 Jan 2021 19:17:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610507867; cv=none; d=google.com; s=arc-20160816; b=f9fTjK51umSy1BWA/BW0gge+yyhXd4B074Trpqs/LJVT5FxhhPLft5moUA42M4qOnt +58Ku6gp5lEYwPmOUFHNeZzQ22PdQv5M0VPAAVSdPOCHGQTcBrludoEVt2N6KOd9Ysl1 aq1DAiU74ydxiW/WWSCs41jciHm7gy1Du0gbTflksqC2kD28M/+NJclXZjEX5LAkS8VZ ZQDUs7TBbfBfjeBMea18GsVukSJb0TSEjSPhLct8buz+bGSYDbAi0gzLQ3GRKQnuNi1r PfgZVF+0es1W05AvKlw2r2V+k7fX44fjBR2g+uuLUXFnS1aHzdVx8YdfKq11XtUJZahr Qi3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature; bh=Y/mkD5de8m+mpayBIjRORwwldrvzEhn8Mi4jJftRcDI=; b=PfZjyF/l9pCvS/VZGXP9rn6p/Ljbk2JYF8lrjTKGnbYPTulYJ4vWvqcN3FqzO+JYsD xhjSWK8XsuFDAvUvH3CAWueboxNW+LxwZtRyRX3UOPJwldDzYcyQkZF6yZnjtRo9FcjN OLrc/FbEujLWqCoU9msssznyJ5W+wLOwITuwwwIyUvhhWDA6FV3toWg5/6HWECRQKAkm cDOS6LDB42U5UGxzmlfG+4b2p9w+l8bWdhrH/JW6+GDs+Mcs4YYbPp5qCy0xVarWLD/4 MEvpXdmeVBVgm/8U4kqoz3HBaWByN0xlBkr01ynDPDj+KqjezU18jT4Poi7tVeAKY1AP 5o6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=oyY3aNW7; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lt6si335998ejb.133.2021.01.12.19.17.23; Tue, 12 Jan 2021 19:17:47 -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=@gmail.com header.s=20161025 header.b=oyY3aNW7; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731715AbhALWao (ORCPT + 99 others); Tue, 12 Jan 2021 17:30:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727908AbhALWaf (ORCPT ); Tue, 12 Jan 2021 17:30:35 -0500 Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4AAF6C061786; Tue, 12 Jan 2021 14:29:55 -0800 (PST) Received: by mail-pl1-x62e.google.com with SMTP id q4so2215333plr.7; Tue, 12 Jan 2021 14:29:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=Y/mkD5de8m+mpayBIjRORwwldrvzEhn8Mi4jJftRcDI=; b=oyY3aNW7Pxb69vz+utmtcU2GPYOyJ5SqNAKAGKIP+laTePuc60PlelsK58yw4wUUf0 vWjJOEysHeU7IHh/rBzXBPENyRO9f3bUhDjNmSpAYEVpCygIR53iaVWtBfeZlaPPjvqe X4vYUEQ/fMIUh4e4y6FxOmwJXrmI75HrmpiNK+mlBem0QnasUc2Nt3i2O/vaO5K71Y++ ziIXBzxFcbNLl9OIcmaNhr9zsF3zckpj4QliylL8hPGfzwyXmUcq9jehHNIkoyS2aDGS IqiUWiOhhNveeQCjbYSituV2lfZeFWnnYpFZXZA1Cn1+xlnlImCjEywAw9PGsvLi1/nj Rt7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=Y/mkD5de8m+mpayBIjRORwwldrvzEhn8Mi4jJftRcDI=; b=Igvqyio71+VuAUChmHvyX3DIQfNOpUSOp6yRuOn+Unawk07V7ybtEHEDUlRBxkfezn BZCQEW3EDBuH/k1n/7qaYZxGfPZp5dVmArQiGRvjhIpagxQ5j2PtFwf1KB+vOnYXemqH j4QiZHabpLDoHR3gxcvg/GRNKIVysgzVTsNdjZygQs4izM4SGXL9xq4LbKI5umR45MAK 5DdKRNKGtSQESGUG8HDV9NO8oLdNPd13yyInnoxhxjRVUZLcLOde+8WKU4eTphyCo8sT SXCEx6xfHKQRD+2urZBr5JYMEEz6D7tp75pVeK/yS4iV+KLjRnWg6lO6CmsVIL2m9i9+ PNYg== X-Gm-Message-State: AOAM530NG/0VWPDDjWDfVdvY5zaS5nJ3usEGW+BVa/cgcBbtj5eqMZQs 4q2JlGsoHo0QOpLF05siXcM= X-Received: by 2002:a17:902:bcc6:b029:dc:44a5:c363 with SMTP id o6-20020a170902bcc6b02900dc44a5c363mr1515847pls.5.1610490594619; Tue, 12 Jan 2021 14:29:54 -0800 (PST) Received: from [192.168.88.245] (c-24-6-216-183.hsd1.ca.comcast.net. [24.6.216.183]) by smtp.gmail.com with ESMTPSA id v10sm32697pjr.47.2021.01.12.14.29.52 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Jan 2021 14:29:53 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) Subject: Re: [PATCH] mm/userfaultfd: fix memory corruption due to writeprotect From: Nadav Amit In-Reply-To: <20210112214337.GA10434@willie-the-truck> Date: Tue, 12 Jan 2021 14:29:51 -0800 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 Content-Transfer-Encoding: 7bit Message-Id: 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> To: Will Deacon X-Mailer: Apple Mail (2.3608.120.23.2.4) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > 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.