Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp806181pxf; Thu, 25 Mar 2021 14:35:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzXOGRK2UX18YBwA9lnEewer93KrU1WKfL6qxf4AvL7VE8pR5M5r7g6ejjAEDBRP2TE60gi X-Received: by 2002:a17:906:4cd6:: with SMTP id q22mr11721179ejt.469.1616708152008; Thu, 25 Mar 2021 14:35:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616708152; cv=none; d=google.com; s=arc-20160816; b=LYP7LsBduovE7yUjbaGGcDNChEb7s/fLOrhFdOY+6/0sE2arDsX2vBfiTNG01c2XX4 TuQqHEOeADy/sasIkDQjGWHB+qcqFkydP7OIRWh9YjRljTApJm43E9UoekwGHV9kvFD4 sbPb+03bb/6r0yJEDvO3nPtrrNHUF3NXG+g6rZ60a6EwmUksFOeyNwNMlbOUbqiKRohs HsEfXBPAayM13ZPA9QIP9d6VbEvv65j2LPr5Ki1/EEAHlWSPc2QpxIanmMy3wJ1MmpRn tl3/Ef3uNJUC+mQIoKsevb3m+7pNaQTYWKhKellaTYp0i8uhacMkGbb4FWmLDVTB6xnG 1khQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:mail-followup-to:message-id:subject:to:from:date :dkim-signature; bh=TXHI1OxX+D4iSzKCuoMMss3yjiQz/+KLKVrP99q3G2I=; b=UJije/Qd0iFnlDdBGJKMAcyZMhEUxtsMPs4n2VvaL7qFLR43/dH6/1VyIFNaB3bF84 eqDTCSRTelc/Il9nic2qCglIy6qMFUfzb24I0+y9FtYU+7hsXiNrFQ5MkO/NiTJVkOFT SvxdhrhppqspZR6n4czZyD7ZSVBtkMUPi6aokbKiJjtg6yfAXDy4oNBk5oYeQOyjCPVI veC4NuXuvqlC3laF7EsRpXqo8XmnpPzSQmvpSg/HXgpogaiHA3wwGaqftEW34VgElzF2 BtxxhWuFYv6B8t7OTtsMFxtEl9Sl72yvKw6KGzsTcQtGPsNtsu1nEmxuVdOJtFW1e22U YE5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b="frvH/QuN"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e16si5104110edq.338.2021.03.25.14.35.29; Thu, 25 Mar 2021 14:35:51 -0700 (PDT) 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=@ffwll.ch header.s=google header.b="frvH/QuN"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230474AbhCYVeA (ORCPT + 99 others); Thu, 25 Mar 2021 17:34:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230496AbhCYVd6 (ORCPT ); Thu, 25 Mar 2021 17:33:58 -0400 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8FF52C06174A for ; Thu, 25 Mar 2021 14:33:57 -0700 (PDT) Received: by mail-wr1-x42f.google.com with SMTP id j18so3745577wra.2 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=f4+MbSbrB7uZKyoV/Wdt8ITCKgM3jhYPD8Ez1KvKCwEk2u4WgD2ZMAg0msI9Vqr9ja KnX6J1F3QYK0giP5JM2iqORIIyvwLU8id0uv3iEpFMM3lZRT3ZH2Ij2yqJocj3BsyV6w Vyy9l5nMMx2uBGPfqV4ruSEThoyjNTST67tAs1GdjPov8tXQq79hdsRARwmEeoToqsHI i6hXuBxS1kBvp1/Pe1ceED/R2kkqy/BDlGJ3kj1uMzw4ZlVsvUIUuc8f1b0UotcrIsaC aJLR2WExpPrWmXOc38cg89EOtYcbC2wpQWEKi5wWY5h2QcnKuGxVmLoKruTX27SwDP0j VH5A== X-Gm-Message-State: AOAM5339TNKeBK5JlNgnGrUgKd++WOVNK3TCGJdE5rW4VUniPI3o5EqW YqjCnBOwHcRqYOtI0Nuvld30Sg== 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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