From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C8421C433E0 for ; Sun, 17 Jan 2021 04:41:32 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3FA5C22D75 for ; Sun, 17 Jan 2021 04:41:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3FA5C22D75 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 53F318D0215; Sat, 16 Jan 2021 23:41:31 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4EE8C8D01D5; Sat, 16 Jan 2021 23:41:31 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 38E708D0215; Sat, 16 Jan 2021 23:41:31 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0102.hostedemail.com [216.40.44.102]) by kanga.kvack.org (Postfix) with ESMTP id 24C058D01D5 for ; Sat, 16 Jan 2021 23:41:31 -0500 (EST) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id D36FF1DF2 for ; Sun, 17 Jan 2021 04:41:30 +0000 (UTC) X-FDA: 77714018340.08.ear02_1e0292f2753d Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin08.hostedemail.com (Postfix) with ESMTP id BBBE91819E623 for ; Sun, 17 Jan 2021 04:41:30 +0000 (UTC) X-HE-Tag: ear02_1e0292f2753d X-Filterd-Recvd-Size: 5593 Received: from mail-io1-f44.google.com (mail-io1-f44.google.com [209.85.166.44]) by imf14.hostedemail.com (Postfix) with ESMTP for ; Sun, 17 Jan 2021 04:41:30 +0000 (UTC) Received: by mail-io1-f44.google.com with SMTP id d13so23172091ioy.4 for ; Sat, 16 Jan 2021 20:41:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=B1u3O83tTrsiNvPrp3hP0q70ExIGdl4r796ZiGkVvug=; b=N1aT2fBkHInlcB+SZ3y3jFU0B3PlXy6oQ9UoC2DV3e03WGOj7kquOGyhUCZfwmUThV xWBXH42AWotId0uCXKh9KXFy5i9GGKv1JznVVFqEiG6mh83/qbPvFlxRIbrWI2qH92E4 2R8i+dDmCkDFRQUeC0C7eArExk7aWwcROV1/a4cWml3fwCdLHZr/w+jcLL0ZdXazxJ7j O/MdslR1uPPl2rQcbKtEqnq0GSiujKsPS7nbbJkpR0HLzazeto7sWAWJmqT30oaK2yXA cHJLEmL8juw/8Bf+enLx/6pausdfE3zFhPX/IZ49Xu8ZEphPLfyLAAQr9+xHIikMTWS7 RO6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=B1u3O83tTrsiNvPrp3hP0q70ExIGdl4r796ZiGkVvug=; b=sXvkk2TwXwZPyUJC9PjB5U9iJnJ4zeYpwRQDaXrjlOqwH4PwVZ+bWryDcEcOYZkcx3 NcWLis/70UfMIPYRKuLmN9FVF4G4BEpvbDkqSqlAfiMJ1JOyu90gd9FeeXAMdgG5/ST1 MFOjcShJPW4GjgWddOc2RWR5X+P1mwRdJBSzyQuuhFP7i8So27fClMF4+t/YbubwY1JC DII8S4apRAXOOQ5R3xyaBnoXl4sfzAHbtEW6SaEyibUD0NfQrTZBEoSEXaY0Dv8J8cw1 k506MtUv0HX2uWRGMXmsJ4EnY8DFQ8dKoTpURzSuMEX8A0fbUPEwmvhiYyX7Z/+TjSVV ppCw== X-Gm-Message-State: AOAM530yw7EfEpMTEr5000J7+ua1796w8sSYhW1Ies/GpznQyve88qAg DrP5X7Gu6ly/giZoNFpW7xUblQ== X-Google-Smtp-Source: ABdhPJy4FEFzTg0+fTXRvhWE6yGrciQw/nHrFSaBGjcKyTDZSaYbHcFMnMulKYfs8iaV+B3jf9pSAg== X-Received: by 2002:a92:d4c4:: with SMTP id o4mr17061597ilm.15.1610858489666; Sat, 16 Jan 2021 20:41:29 -0800 (PST) Received: from google.com ([2620:15c:183:200:7d62:41db:b863:bc92]) by smtp.gmail.com with ESMTPSA id g13sm7969402iln.12.2021.01.16.20.41.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Jan 2021 20:41:28 -0800 (PST) Date: Sat, 16 Jan 2021 21:41:25 -0700 From: Yu Zhao To: Will Deacon Cc: Nadav Amit , 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: 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: <20210112214337.GA10434@willie-the-truck> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, Jan 12, 2021 at 09:43:38PM +0000, 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. I noticed arm/arm64 don't support ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH. Would it be something worth pursuing? Arm has been using mm_cpumask, so it might not be too difficult I guess?