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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 1D875C433DB for ; Thu, 25 Mar 2021 21:34:00 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 80036619F8 for ; Thu, 25 Mar 2021 21:33:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 80036619F8 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 00D806B006C; Thu, 25 Mar 2021 17:33:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EFDF86B006E; Thu, 25 Mar 2021 17:33:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D9F666B0070; Thu, 25 Mar 2021 17:33:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0190.hostedemail.com [216.40.44.190]) by kanga.kvack.org (Postfix) with ESMTP id BDE656B006C for ; Thu, 25 Mar 2021 17:33:58 -0400 (EDT) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 7CE988E70 for ; Thu, 25 Mar 2021 21:33:58 +0000 (UTC) X-FDA: 77959699356.22.2CEACD0 Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) by imf09.hostedemail.com (Postfix) with ESMTP id B38426000104 for ; Thu, 25 Mar 2021 21:33:56 +0000 (UTC) Received: by mail-wr1-f43.google.com with SMTP id v11so3711909wro.7 for ; Thu, 25 Mar 2021 14:33:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=date:from:to:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to; bh=TXHI1OxX+D4iSzKCuoMMss3yjiQz/+KLKVrP99q3G2I=; b=frvH/QuNUnODqvtDdusaUFppblhOygLUWsC1ixB43GNG2Cc+yxM2WFbRWpgjN4Ju8Y 95PeIsuDNMn98oqagJ3ef1Nu2yOkiL1vvMi/6inWwQyeTtLH5DD3GrBLCXNufjRYGMCK r/gFSHALeS9GIhicmr/nrrhcB3MijIi/RQZtU= 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:subject:message-id:mail-followup-to :references:mime-version:content-disposition:in-reply-to; bh=TXHI1OxX+D4iSzKCuoMMss3yjiQz/+KLKVrP99q3G2I=; b=XC6DmFqdzgsUrvwFd7xsETqYpbNM1NCv8apUOtEPpEQer7FJYsqn2Z7ou15R0QvlHg DH0ItymkliHJUGJKCJGGBcfvY8l7k0RZ34z6LbmdzKTpEuzVXttYGRiiESC8ZvO6tz3t pxHlpeYPUT6WAAhL8hjDhC7cnuIAGO6DL/b4URk+GhsXnmIPptX6scGNoLMLdRq5Xxhi coUHMyM4wBrp4juXaQNwp7ITlcbxA71iqAJZ79d1ES1N6f/P0HqyJFsfv5qtpsIKLGC0 ck2hK/pLyZHFkHk/Gvr/zoXY8a/vSiDQKPes7r0HswxPOiZNUbb1e2n/axGTlzWZliNC CF0g== X-Gm-Message-State: AOAM530gKzbjxeTRSY5dHpLBhSe5Sd0ZAMQZMgKk1THQTFhqqHJmmU6l /sr3TyOYwVlYvuDew8oA5ElC2g== X-Google-Smtp-Source: ABdhPJwn8UAApYENGs0EsRiOl6kaa4IOv1NsIwYwvHs5ZhbA+T+EIOa3Ak0sCs/YbuNvp+I4gerYDg== X-Received: by 2002:adf:e8c9:: with SMTP id k9mr10992298wrn.315.1616708036367; Thu, 25 Mar 2021 14:33:56 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id x13sm1115693wmp.39.2021.03.25.14.33.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Mar 2021 14:33:55 -0700 (PDT) Date: Thu, 25 Mar 2021 22:33:53 +0100 From: Daniel Vetter To: Jason Gunthorpe , DRI Development , LKML , kvm@vger.kernel.org, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-media@vger.kernel.org, 3pvd@google.com, Jann Horn , Paolo Bonzini , Cornelia Huck , Peter Xu , Alex Williamson , Daniel Vetter Subject: Re: [PATCH 3/3] mm: unexport follow_pfn Message-ID: Mail-Followup-To: Jason Gunthorpe , DRI Development , LKML , kvm@vger.kernel.org, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-media@vger.kernel.org, 3pvd@google.com, Jann Horn , Paolo Bonzini , Cornelia Huck , Peter Xu , Alex Williamson , Daniel Vetter References: <20210316153303.3216674-1-daniel.vetter@ffwll.ch> <20210316153303.3216674-4-daniel.vetter@ffwll.ch> <20210324125211.GA2356281@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: Linux phenom 5.7.0-1-amd64 X-Stat-Signature: z98ffj99ydz19nhnwrqjyrnd1kignqu9 X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: B38426000104 Received-SPF: none (ffwll.ch>: No applicable sender policy available) receiver=imf09; identity=mailfrom; envelope-from=""; helo=mail-wr1-f43.google.com; client-ip=209.85.221.43 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1616708036-827161 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 Wed, Mar 24, 2021 at 08:17:10PM +0100, Daniel Vetter wrote: > On Wed, Mar 24, 2021 at 09:52:11AM -0300, Jason Gunthorpe wrote: > > On Tue, Mar 16, 2021 at 04:33:03PM +0100, Daniel Vetter wrote: > > > Both kvm (in bd2fae8da794 ("KVM: do not assume PTE is writable after > > > follow_pfn")) and vfio (in 07956b6269d3 ("vfio/type1: Use > > > follow_pte()")) have lost their callsites of follow_pfn(). All the > > > other ones have been switched over to unsafe_follow_pfn because they > > > cannot be fixed without breaking userspace api. > > > > > > Argueably the vfio code is still racy, but that's kinda a bigger > > > picture. But since it does leak the pte beyond where it drops the pt > > > lock, without anything else like an mmu notifier guaranteeing > > > coherence, the problem is at least clearly visible in the vfio code. > > > So good enough with me. > > > > > > I've decided to keep the explanation that after dropping the pt lock > > > you must have an mmu notifier if you keep using the pte somehow by > > > adjusting it and moving it into the kerneldoc for the new follow_pte() > > > function. > > > > > > Cc: 3pvd@google.com > > > Cc: Jann Horn > > > Cc: Paolo Bonzini > > > Cc: Jason Gunthorpe > > > Cc: Cornelia Huck > > > Cc: Peter Xu > > > Cc: Alex Williamson > > > Cc: linux-mm@kvack.org > > > Cc: linux-arm-kernel@lists.infradead.org > > > Cc: linux-samsung-soc@vger.kernel.org > > > Cc: linux-media@vger.kernel.org > > > Cc: kvm@vger.kernel.org > > > Signed-off-by: Daniel Vetter > > > --- > > > include/linux/mm.h | 2 -- > > > mm/memory.c | 26 +++++--------------------- > > > mm/nommu.c | 13 +------------ > > > 3 files changed, 6 insertions(+), 35 deletions(-) > > > > I think this is the right thing to do. > > Was just about to smash this into the topic branch for testing in > linux-next. Feel like an ack on the series, or at least the two mm > patches? Pushed them to my topic branch for a bit of testing in linux-next, hopefully goes all fine for a pull for 5.13. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch