Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp5338408ybv; Mon, 17 Feb 2020 17:51:17 -0800 (PST) X-Google-Smtp-Source: APXvYqzoBav4BAj4G0jZRWLz7XQpKkTctUHOPp9lppRnDG2fxS2VoqkJv+8Zj7V8oBAuAcXAuNUN X-Received: by 2002:a9d:58cb:: with SMTP id s11mr14614106oth.55.1581990677130; Mon, 17 Feb 2020 17:51:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581990677; cv=none; d=google.com; s=arc-20160816; b=izfM1jgFe1ozdi3sfc9LaYJKM//aIY3YmwTwOLJhVucDoYXOtMqgmLkiGMEGKBTf0+ UJM8LMnxiu10LerR8akn2uGwGNTpsyEyM2WSlVOKXI4++9dB5LRE1Vs0EIGWpKu7vhPO ODnjPwPm9JhsiVzVnUZd91K6DXa2JBgsJSaaWkSuQP6FUvXBxs15/QtgcHLEyA+/jZ3L h2CPPNBe1Ke/6+hQv23edi8aT1PJ3M2HPlySmx43PwGvtAL7mc3C280akMP8qnxnjNvF ZJNhN3Mfj6cLXlr5WnhqX112qbqkNQi2irNU7scvhpMS/3PTNsQKx//LtnDWP9O5jnJm G0rA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=zPJTmL7M/KQjilpjiQvSnCs28pkECQ3GbYH85X9jLmk=; b=r/MMrQCyOu8sj3JtCwKCeTjwZmIRL3li1ni9br+phlLm2Qu7bsEOolFRvm9TQmC40T yf3hbdR1AVs6cWMCjc0Bkr22myNBjUazN5x7x1j6zAQ3BdlGDRLZEjxow/R+LPoJ2l3w ojmBO4KS8MPxdeYcImEG8qwkQ/fSOophbiJk0cauabvovjPRftDSyRme8MbbCfae1sIM OsMm6+lY2TtAFnJ3SlMUGHGbDOkYklv7UcCUtH1nXp7Yp50DKMqiPmznqel+/nrU81ua KNgfwhWewNnmVv/PgbODEiP0XjL9e32NJbGwwL/VoH0OINV3/+e5BGuHXAmVqSCIeHFT wHfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="s9+lDh/5"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d83si7179856oib.166.2020.02.17.17.51.02; Mon, 17 Feb 2020 17:51:17 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="s9+lDh/5"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726190AbgBRBux (ORCPT + 99 others); Mon, 17 Feb 2020 20:50:53 -0500 Received: from mail-ed1-f65.google.com ([209.85.208.65]:37760 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726107AbgBRBux (ORCPT ); Mon, 17 Feb 2020 20:50:53 -0500 Received: by mail-ed1-f65.google.com with SMTP id t7so11252573edr.4 for ; Mon, 17 Feb 2020 17:50:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=zPJTmL7M/KQjilpjiQvSnCs28pkECQ3GbYH85X9jLmk=; b=s9+lDh/5BUI0pym1FldGomHkvz5qiNZwA0r+zHjhzGda5b6rbhrwtE4krO8GkFdagq /WCOcB6Q65T98y4ejsfeXNuYEz+0Jx2qQBEcFEcwzZJenBdwzDoInleNQd/PgTGIb9Sa ETrxr2ZZbvjfUfjitId2ryCuUY0sRGIkiLsnFBYpm8SfH7aBn0aeBxEBv6jYpxlff9MI SzkJBof+bYUhjhZBV6dVmBiR5aKCxb4q6oa34g0J9daoSU775oqGpoliOuZoCB73Xaa0 jtz3FfzTFyNFAhlN+bjGfteTf01Tgutbx3mETKFzMMHcxWBsGz3UIE3REFomgYn6obji emgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=zPJTmL7M/KQjilpjiQvSnCs28pkECQ3GbYH85X9jLmk=; b=svCktUOxWroE43EUMgT9Ino9hqKAPc2q+vhTyjkSGp6B2xJLuxZoEhUZTBsCUr5onW cbhRypKkohJElM/6ET7w0Yo6J8XQdcGKnvWD8IARN3h6KNxCvMS73nXzyIJIUgwyb8ND 2fEzzVUMl5o9Wo94IHK8Ti+ybM8miTtc6GfaexjLQ53UUV2SROM2lHODWi0vGAmIvUhv xbLXLYg+8ODIExYM/Lm9JPtKH391GdqN33b9HnQvFxc2YDfbchpTjf/RIIRSGNbJTQeB ODL7NBPQAkzmZ1Oz5Uy/BH6vFgwC/lme+gQct2ZDLB4Ru4xnUBmLo9qmVVb62cX7shf7 KrNA== X-Gm-Message-State: APjAAAUg5TbP8ceBOv47aUMvslEeY7IlsToyPpmcnd1UaJd8uL/HXsFl S8asOs8mMQP0NJEmW1M5vm5gAlNg2NukvsKCyWFo8A== X-Received: by 2002:a17:906:4e01:: with SMTP id z1mr17520009eju.46.1581990651117; Mon, 17 Feb 2020 17:50:51 -0800 (PST) MIME-Version: 1.0 References: <20200214225849.108108-1-bgeffon@google.com> <20200214231954.GA29849@redhat.com> <20200217160739.GB1309280@xz-x1> In-Reply-To: <20200217160739.GB1309280@xz-x1> From: Brian Geffon Date: Mon, 17 Feb 2020 19:50:19 -0600 Message-ID: Subject: Re: [RFC PATCH] userfaultfd: Address race after fault. To: Peter Xu Cc: Andrea Arcangeli , Andrew Morton , linux-mm , LKML , Mike Rapoport , Sonny Rao , "Kirill A . Shutemov" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Peter, I'll try helping out by giving the entire patchset a try. But in the meantime, if the plan of record will be to always allow retrying then shouldn't the block I mailed a patch on be removed regardless because do_user_addr_fault always starts with FAULT_FLAG_ALLOW_RETRY and we shouldn't ever land there without it in the future and allows userfaultfd to retry? Thanks, Brian On Mon, Feb 17, 2020 at 10:07 AM Peter Xu wrote: > > On Sat, Feb 15, 2020 at 09:29:46AM -0500, Brian Geffon wrote: > > Hi Andrea, > > Thanks for the quick reply. That's great to hear that Peter has been > > working on those improvements. I didn't try the entire patchset but I > > did confirm that patch 13, not surprisingly, also resolves that issue > > on at least on x86: > > https://lkml.org/lkml/2019/9/26/179 > > > > Given that seems pretty low risk and it definitely resolves a pretty > > big issue for the non-cooperative userfaultfd case, any chance it > > could be landed ahead of the rest of the series? > > Thanks Andrea & Brian! Yes it would be great if the series (or some > of the patches) could be moved forward. Please just let me know if > there's still anything I can do from my side. > > Thanks, > > > > > Thanks, > > Brian > > > > On Fri, Feb 14, 2020 at 6:20 PM Andrea Arcangeli wrote: > > > > > > Hello, > > > > > > this and other enhancements have already implemented by Peter (CC'ed) > > > and in the right way, by altering the retry logic in the page fault > > > code. This is a requirement for other kind of usages too, notably the > > > UFFD_WRITEPROTECT ioctl after which multiple consecutive faults can > > > happen and must be handled. > > > > > > IIRC Kirill asked at last LSF-MM uffd-wp talk if there's any > > > particular reason the fault couldn't be retried currently. I had no > > > sure answer other than there's apparently no strong reason why > > > VM_FAULT_RETRY is only allowed 1 time currently, so there should be no > > > issue in lifting that artificial restriction. > > > > > > I'm running with this patchset applied in my systems since Nov with no > > > regression at all. I got sidetracked by various other issues, so > > > unfortunately I didn' post a proper reviewed-by on the last submit yet > > > (pending), but I did at least test it and it was rock solid so far. > > > > > > https://lore.kernel.org/lkml/20190926093904.5090-1-peterx@redhat.com/ > > > > > > Can you test and verify it too if it solves your use case? > > > > > > Also note the complete uffd-WP support submit also from Peter: > > > > > > https://lore.kernel.org/lkml/20190620022008.19172-1-peterx@redhat.com/ > > > > > > https://github.com/xzpeter/linux/tree/uffd-wp-merged > > > > > > Thanks, > > > Andrea > > > > > > > -- > Peter Xu >