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.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable 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 746D8C433ED for ; Thu, 8 Apr 2021 11:43:00 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 07A8C61139 for ; Thu, 8 Apr 2021 11:43:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 07A8C61139 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:Subject: From:References:To:Reply-To:Cc:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=UoFk2i9mbUfXyevDwxcMxN0nV0598kSSmApxM11nq2U=; b=VbL/abuIpkDlVNudxdHeY0tC5 OkAZNmXVnSKUB8izjvMBWahm71a3QXcfd2hsBt8CQ4rspVxMrrkRuMljRehbuG9qWXKVRc10ZU9LZ 0rmypCYWgaZlyF+Zt10MO3088q+rKD3UJxLQsJXbohQqd1s9TppVqE8kp+Kqgsc3e+WiBgiTWdoxK anXF/nXrSrOXzo8Rp4OsO63gNclEoMe0c2qHHNqUkmIfb07cxDFt4szG/Id9grs6vcqpJN8uBppte af0K1KkIB7J/1sfuG5x0JiPBSpyga0oSFnAUvTBw3k6lOlZ672WAmbahV4pInutRP/sTt2EZzSA+O KBnR7cFbA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lUT2G-007s7v-I7; Thu, 08 Apr 2021 11:41:20 +0000 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lUT24-007s40-Gt for linux-arm-kernel@lists.infradead.org; Thu, 08 Apr 2021 11:41:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617882065; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=s9XSwEEi1zJXTpbPUBOMu9HhV0dFlRjs6EwHYbE6+e4=; b=iUZ1fzyD/9JtmUQF2tDt3fQPioZ/XZoUMP4Zc7GlRpWEP0zcpVHCX658CroFFlybrgHB44 3yceAsIUsG5TK54+ct8Ml8PNz3sgj0nUJp6eP1H6RSF37uWeRcFEftjpGxRZ66XWFBvgvm P2TsrWV1fnk8S3Hjf5bm5u0aG/ZU7Yk= Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-261-sizhutC7OW-YhO9ay5Cr1w-1; Thu, 08 Apr 2021 07:41:02 -0400 X-MC-Unique: sizhutC7OW-YhO9ay5Cr1w-1 Received: by mail-ej1-f69.google.com with SMTP id n21so721235ejl.11 for ; Thu, 08 Apr 2021 04:41:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:references:from:subject:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=s9XSwEEi1zJXTpbPUBOMu9HhV0dFlRjs6EwHYbE6+e4=; b=N9SSTGGVcOuRRn/azjTQZtTJpgYzSTG64K/quMDrWifZjY08j+hjRnuVGMAa2VJBzX sJN0nBONYyLN4P1KcE2W13nImOW/sZ2ihKJ8JCM1XPfWqKYvdjHgzFT3LzvSanCccycX ykEAYj+GIHo94GF56ANIUINwvfBChTRHAa5Ln3ot/2mhjEHQ7mO1jKADifl4QJVulVcr +pofo365jLRQeTdcujbHsGzhyFpiIQ0mRvIYYgPWbADu9xWPzWdimV02c3d/hvRohk6t ou40pT+guJpjMyiULfGFmCrTMHmeloXVfxEJk0gkwYqGobmkYCFOHt4uSyTMDLPKxIGg YaGA== X-Gm-Message-State: AOAM530C5M808Jj4cb+3q/Rx74EtpJYndSVHYbAI56kLGU02xhSErT6k 5eEKmNRnwQKlkDcPrSXvRf4ZJqpOXAlPOBj1wSKlMRgzYnvafduqthThlEWbLhb4goFmoz+H4Hg VzUa2xT+5Lzg9vF8OEPWKUt3x8EYw8I3gQWY= X-Received: by 2002:aa7:cf90:: with SMTP id z16mr10682025edx.273.1617882060783; Thu, 08 Apr 2021 04:41:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzUNwVjPU6LZkoTiJz3z03af3SU7UKs6cSUJv0KPBteAvMvZy2H6osTmzxUIJoPNr0/d/3eYQ== X-Received: by 2002:aa7:cf90:: with SMTP id z16mr10682002edx.273.1617882060615; Thu, 08 Apr 2021 04:41:00 -0700 (PDT) Received: from ?IPv6:2001:b07:6468:f312:c8dd:75d4:99ab:290a? ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id t1sm4680038eds.53.2021.04.08.04.40.59 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 08 Apr 2021 04:41:00 -0700 (PDT) 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 , Cornelia Huck , Peter Xu , Alex Williamson , Daniel Vetter References: <20210316153303.3216674-1-daniel.vetter@ffwll.ch> <20210316153303.3216674-4-daniel.vetter@ffwll.ch> <20210329133101.GA1168973@nvidia.com> From: Paolo Bonzini Subject: Re: [PATCH 3/3] mm: unexport follow_pfn Message-ID: <5f956a46-da38-e72a-edaa-3b746a275f1e@redhat.com> Date: Thu, 8 Apr 2021 13:40:59 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 MIME-Version: 1.0 In-Reply-To: Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210408_124109_111735_53FF6812 X-CRM114-Status: GOOD ( 17.91 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 08/04/21 12:05, Daniel Vetter wrote: > On Mon, Mar 29, 2021 at 10:31:01AM -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 >> >> vfio and kvm > > Hm I thought kvm is non-racy due to the mmu notifier catch races? No, but the plan is indeed to have some struct for each page that uses follow_pfn and update it from the MMU notifiers. Paolo >> >>> 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(-) >> >> Reviewed-by: Jason Gunthorpe > > Thanks for your r-b tags, I'll add them. > -Daniel > >> >> Jason > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel