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=-3.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 21525C00A89 for ; Mon, 2 Nov 2020 13:01:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A79E2223B0 for ; Mon, 2 Nov 2020 13:01:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="ir3GR39Y" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728746AbgKBNBS (ORCPT ); Mon, 2 Nov 2020 08:01:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728253AbgKBNBR (ORCPT ); Mon, 2 Nov 2020 08:01:17 -0500 Received: from mail-qk1-x743.google.com (mail-qk1-x743.google.com [IPv6:2607:f8b0:4864:20::743]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4CF6C061A04 for ; Mon, 2 Nov 2020 05:01:17 -0800 (PST) Received: by mail-qk1-x743.google.com with SMTP id a64so7957828qkc.5 for ; Mon, 02 Nov 2020 05:01:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=ywfiDbg6XCEWmoBx9eC29OtR/MyEWOW93XTelnAXaBk=; b=ir3GR39YhTRDVVIubqbd2b6fYJQqoYzGlGzQhJGPgx/IpIwERjn3x6j0FKgwPju8tJ K346RwtLd1HrF6IYofhsCSTJj3QK+10oMg2YllJh/KpA3n62CbFQnKL6ivWZ5KZSOniq QwLvLlA6x1j/aJc2hKzXChvGjpbbw6GWq/KNk/8R9NhESFTt0yrJ0KQKjkdmTuloLwW/ Zwps2gbtqPniuVum2Pfu8S68SKxWxd0HMyfFBAbv4qCeVCCuOZxQnUab9RNI4DYrsJao v2N/I2zDZif6Md4+OJsi4IvpXjI5tOvsKPLa0IKjhrcIMk4ZoUB68GDdMIbIvaBwF1NM /xmg== 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=ywfiDbg6XCEWmoBx9eC29OtR/MyEWOW93XTelnAXaBk=; b=JIVx8NUFJecuqCZC4hwQF4d4TWE0uMocrcI8RQWKvJziZqcItTTPg+P9CfprqfINKW AP9QsGrbUK5//bYzyDxYNl8RcfUb4oNJydbOtbBaR4nBNqkTD5vylxEOwOv2zvHavWnR ftuuwXriwh5ueOilpj1UBJ1VB6Pa7RI4rQEIGvt4cx6IuTiT7fFXvyikjR+NoF0i+JH/ KLF1JeIZlv+l6PFIUClaV7V0mVY/8mpK3LUejeE/6Uz64NTdM8jyW1P91YQ1RlsfbAF5 kJr4O7C8CPDGdEivBCG1otoX6trmKzYXgHGOTaOhBic30ksJWmQqhGNDF+I7161hfRUr /qSw== X-Gm-Message-State: AOAM532rglcp8hk+8cnLwBjGSAI75/T7Ssu8VU3MxZ1LZ2ja9/cog2yY tKcU0WgoPqrS2dqgk/kpYseZzw== X-Google-Smtp-Source: ABdhPJzRrsH3Zfgny2Ycg3bBy2Q+SuhdpwI09cYL0ZnBVzwrgv7GmXDFxfx3kiLU2YMRfbo6u8i3PQ== X-Received: by 2002:a37:8c41:: with SMTP id o62mr13561782qkd.240.1604322076971; Mon, 02 Nov 2020 05:01:16 -0800 (PST) Received: from ziepe.ca (hlfxns017vw-156-34-48-30.dhcp-dynamic.fibreop.ns.bellaliant.net. [156.34.48.30]) by smtp.gmail.com with ESMTPSA id b8sm7742829qkn.133.2020.11.02.05.01.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Nov 2020 05:01:16 -0800 (PST) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1kZZSV-00EvRo-QJ; Mon, 02 Nov 2020 09:01:15 -0400 Date: Mon, 2 Nov 2020 09:01:15 -0400 From: Jason Gunthorpe To: Daniel Vetter Cc: Christoph Hellwig , DRI Development , LKML , KVM list , Linux MM , Linux ARM , linux-samsung-soc , "open list:DMA BUFFER SHARING FRAMEWORK" , Daniel Vetter , Kees Cook , Dan Williams , Andrew Morton , John Hubbard , J??r??me Glisse , Jan Kara Subject: Re: [PATCH v5 08/15] mm: Add unsafe_follow_pfn Message-ID: <20201102130115.GC36674@ziepe.ca> References: <20201030100815.2269-1-daniel.vetter@ffwll.ch> <20201030100815.2269-9-daniel.vetter@ffwll.ch> <20201102072931.GA16419@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 02, 2020 at 01:56:10PM +0100, Daniel Vetter wrote: > On Mon, Nov 2, 2020 at 8:29 AM Christoph Hellwig wrote: > > > > On Fri, Oct 30, 2020 at 11:08:08AM +0100, Daniel Vetter wrote: > > > Also mark up follow_pfn as EXPORT_SYMBOL_GPL. The only safe way to use > > > that by drivers/modules is together with an mmu_notifier, and that's > > > all _GPL stuff. > > > > I also think it also needs to be renamed to explicitly break any existing > > users out of tree or int the submission queue. > > Ok I looked at the mmu notifier locking again and noticed that > mm->subscriptions has its own spinlock. Since there usually shouldn't > be a huge pile of these I think it's feasible to check for the mmu > notifier in follow_pfn. And that would stuff this gap for good. I'll > throw that on top as a final patch and see what people think. Probably the simplest is to just check mm_has_notifiers() when in lockdep or something very simple like that Jason 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=-3.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 8C026C55178 for ; Mon, 2 Nov 2020 13:01:20 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E1A48223BF for ; Mon, 2 Nov 2020 13:01:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="ir3GR39Y" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E1A48223BF Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 3F0B16B006E; Mon, 2 Nov 2020 08:01:19 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 37C1F6B0070; Mon, 2 Nov 2020 08:01:19 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 267456B0071; Mon, 2 Nov 2020 08:01:19 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0119.hostedemail.com [216.40.44.119]) by kanga.kvack.org (Postfix) with ESMTP id E47BB6B006E for ; Mon, 2 Nov 2020 08:01:18 -0500 (EST) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 7B26E1EF1 for ; Mon, 2 Nov 2020 13:01:18 +0000 (UTC) X-FDA: 77439489036.30.sack73_1b18488272b0 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin30.hostedemail.com (Postfix) with ESMTP id 3466C180B3C95 for ; Mon, 2 Nov 2020 13:01:18 +0000 (UTC) X-HE-Tag: sack73_1b18488272b0 X-Filterd-Recvd-Size: 4803 Received: from mail-qk1-f193.google.com (mail-qk1-f193.google.com [209.85.222.193]) by imf48.hostedemail.com (Postfix) with ESMTP for ; Mon, 2 Nov 2020 13:01:17 +0000 (UTC) Received: by mail-qk1-f193.google.com with SMTP id x20so11346977qkn.1 for ; Mon, 02 Nov 2020 05:01:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=ywfiDbg6XCEWmoBx9eC29OtR/MyEWOW93XTelnAXaBk=; b=ir3GR39YhTRDVVIubqbd2b6fYJQqoYzGlGzQhJGPgx/IpIwERjn3x6j0FKgwPju8tJ K346RwtLd1HrF6IYofhsCSTJj3QK+10oMg2YllJh/KpA3n62CbFQnKL6ivWZ5KZSOniq QwLvLlA6x1j/aJc2hKzXChvGjpbbw6GWq/KNk/8R9NhESFTt0yrJ0KQKjkdmTuloLwW/ Zwps2gbtqPniuVum2Pfu8S68SKxWxd0HMyfFBAbv4qCeVCCuOZxQnUab9RNI4DYrsJao v2N/I2zDZif6Md4+OJsi4IvpXjI5tOvsKPLa0IKjhrcIMk4ZoUB68GDdMIbIvaBwF1NM /xmg== 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=ywfiDbg6XCEWmoBx9eC29OtR/MyEWOW93XTelnAXaBk=; b=MOpUI32aL1NITGb8z1sz/985XDzqqI3Xx6e/wmYTZA9EDKv1JHxCrNMgJxdnpcXcoe qEv1H9AF49wtK2kR9mjQh9y9OyuxBOL6jkQByjjlsV3ikkX4hHesvo59UC5+WVblwT0B KOV/UIzXJ4Fw9QRXdTql/mJMZUcpY/vL1kVtUhiV2+IL78a+0gNnRGGwqri40IFnpv/b YnY5JZL0bVmQKzltGZWeTc29nfQOJg7ojHF8l9KrNU8aLRWR8q+Cs01jSGBk7jdVdMvf 1Xdk5u1Wi5z8piz2MlWuY4ei6CNIFYMhVvUDuDeGq2I+U+cEGp0VLThHTJdxgPAjhFvI ZBHg== X-Gm-Message-State: AOAM532lccVk79JZTjSEyRtsFaFV5coW5fnvQWrNLo7VruL0aj/vh8Kb kzhFBOCKB2tFVv77TdDbkfzXaA== X-Google-Smtp-Source: ABdhPJzRrsH3Zfgny2Ycg3bBy2Q+SuhdpwI09cYL0ZnBVzwrgv7GmXDFxfx3kiLU2YMRfbo6u8i3PQ== X-Received: by 2002:a37:8c41:: with SMTP id o62mr13561782qkd.240.1604322076971; Mon, 02 Nov 2020 05:01:16 -0800 (PST) Received: from ziepe.ca (hlfxns017vw-156-34-48-30.dhcp-dynamic.fibreop.ns.bellaliant.net. [156.34.48.30]) by smtp.gmail.com with ESMTPSA id b8sm7742829qkn.133.2020.11.02.05.01.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Nov 2020 05:01:16 -0800 (PST) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1kZZSV-00EvRo-QJ; Mon, 02 Nov 2020 09:01:15 -0400 Date: Mon, 2 Nov 2020 09:01:15 -0400 From: Jason Gunthorpe To: Daniel Vetter Cc: Christoph Hellwig , DRI Development , LKML , KVM list , Linux MM , Linux ARM , linux-samsung-soc , "open list:DMA BUFFER SHARING FRAMEWORK" , Daniel Vetter , Kees Cook , Dan Williams , Andrew Morton , John Hubbard , J??r??me Glisse , Jan Kara Subject: Re: [PATCH v5 08/15] mm: Add unsafe_follow_pfn Message-ID: <20201102130115.GC36674@ziepe.ca> References: <20201030100815.2269-1-daniel.vetter@ffwll.ch> <20201030100815.2269-9-daniel.vetter@ffwll.ch> <20201102072931.GA16419@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 Mon, Nov 02, 2020 at 01:56:10PM +0100, Daniel Vetter wrote: > On Mon, Nov 2, 2020 at 8:29 AM Christoph Hellwig wrote: > > > > On Fri, Oct 30, 2020 at 11:08:08AM +0100, Daniel Vetter wrote: > > > Also mark up follow_pfn as EXPORT_SYMBOL_GPL. The only safe way to use > > > that by drivers/modules is together with an mmu_notifier, and that's > > > all _GPL stuff. > > > > I also think it also needs to be renamed to explicitly break any existing > > users out of tree or int the submission queue. > > Ok I looked at the mmu notifier locking again and noticed that > mm->subscriptions has its own spinlock. Since there usually shouldn't > be a huge pile of these I think it's feasible to check for the mmu > notifier in follow_pfn. And that would stuff this gap for good. I'll > throw that on top as a final patch and see what people think. Probably the simplest is to just check mm_has_notifiers() when in lockdep or something very simple like that Jason 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=-3.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS 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 9C91FC388F2 for ; Mon, 2 Nov 2020 13:01:58 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 2BAF3223B0 for ; Mon, 2 Nov 2020 13:01:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="BN17ba/s"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="ir3GR39Y" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2BAF3223B0 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca 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=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=FJG7y8vssrTlnLoztec80+pmtNyVtKz/54/F/xV5HkU=; b=BN17ba/sFpAxRk5xE6JhI/qgN 809r6Y9XhH6nLCFNZRrE0B4z2vdubCbbza8XmqYM5HsvIrdY4KRqSq/ESvmGfdE7lqSo9wIXn+n0s PMsyBVxTLuwUHGvECPmRGkC114uHsKni3ijP2wJHyvnsv6hj9QJQ6YZigk3FkDKFJFzm0Jbm/j/yW eN3rujB6JRFX+u95QoJZHTc5NDL7OwmFC+CqAI1uwaEzpPAuT09HeGQPVmd75Zs9rz5T+6lrPT97J sEbNYUrq03iCApf1ksQYt1cEdjxekjdShyZlPy0pHgD2oqHmIMxJuJ1z3EPmnQvW6eDUtfydI1lFD byAFHocTg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kZZSd-0005Mh-6R; Mon, 02 Nov 2020 13:01:23 +0000 Received: from mail-qk1-x742.google.com ([2607:f8b0:4864:20::742]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kZZSa-0005LD-8s for linux-arm-kernel@lists.infradead.org; Mon, 02 Nov 2020 13:01:21 +0000 Received: by mail-qk1-x742.google.com with SMTP id o205so4531212qke.10 for ; Mon, 02 Nov 2020 05:01:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=ywfiDbg6XCEWmoBx9eC29OtR/MyEWOW93XTelnAXaBk=; b=ir3GR39YhTRDVVIubqbd2b6fYJQqoYzGlGzQhJGPgx/IpIwERjn3x6j0FKgwPju8tJ K346RwtLd1HrF6IYofhsCSTJj3QK+10oMg2YllJh/KpA3n62CbFQnKL6ivWZ5KZSOniq QwLvLlA6x1j/aJc2hKzXChvGjpbbw6GWq/KNk/8R9NhESFTt0yrJ0KQKjkdmTuloLwW/ Zwps2gbtqPniuVum2Pfu8S68SKxWxd0HMyfFBAbv4qCeVCCuOZxQnUab9RNI4DYrsJao v2N/I2zDZif6Md4+OJsi4IvpXjI5tOvsKPLa0IKjhrcIMk4ZoUB68GDdMIbIvaBwF1NM /xmg== 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=ywfiDbg6XCEWmoBx9eC29OtR/MyEWOW93XTelnAXaBk=; b=OoNqoGmUnL7HelsZqejnbFB3yEH4J37RYQUmboQ5bAr6kka5Sz0g5I8If7B6Ag/wUw K/NgHxvpuxlgtA9LfGSvdKWWG4zIYL5t3XYeGQZC4n1jqjn61VAzG6pDLtJ/y6wDuPJG WybfkeYVMFnSqwc5q7CZNZn0z64wffy+9NlBS+a2Vr0dwpPrniX0iVo/SG9o3QioZifk KaJ7ngdJNtcIOe7QocvkrWvwGk/1zXZp7jvlokp+BkDfO6c68uxawF/IMuHv61W9Mcc/ 78vSSq8op6m4/QCZLZjICfAGM3oPv3BixnlHkS8617DBbdExuHsTXr3tWGHgnnS4dbLX eZyA== X-Gm-Message-State: AOAM532nrL4YwTeNE0+TcUfuIbarlyK6u7AdkcUvH3vj4WIJga6b/gxv RsWe4VooEenCSOjyJchmKZsuEQ== X-Google-Smtp-Source: ABdhPJzRrsH3Zfgny2Ycg3bBy2Q+SuhdpwI09cYL0ZnBVzwrgv7GmXDFxfx3kiLU2YMRfbo6u8i3PQ== X-Received: by 2002:a37:8c41:: with SMTP id o62mr13561782qkd.240.1604322076971; Mon, 02 Nov 2020 05:01:16 -0800 (PST) Received: from ziepe.ca (hlfxns017vw-156-34-48-30.dhcp-dynamic.fibreop.ns.bellaliant.net. [156.34.48.30]) by smtp.gmail.com with ESMTPSA id b8sm7742829qkn.133.2020.11.02.05.01.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Nov 2020 05:01:16 -0800 (PST) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1kZZSV-00EvRo-QJ; Mon, 02 Nov 2020 09:01:15 -0400 Date: Mon, 2 Nov 2020 09:01:15 -0400 From: Jason Gunthorpe To: Daniel Vetter Subject: Re: [PATCH v5 08/15] mm: Add unsafe_follow_pfn Message-ID: <20201102130115.GC36674@ziepe.ca> References: <20201030100815.2269-1-daniel.vetter@ffwll.ch> <20201030100815.2269-9-daniel.vetter@ffwll.ch> <20201102072931.GA16419@infradead.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201102_080120_341052_778BE5B1 X-CRM114-Status: GOOD ( 19.70 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-samsung-soc , Jan Kara , Kees Cook , KVM list , John Hubbard , LKML , DRI Development , Christoph Hellwig , Linux MM , J??r??me Glisse , Daniel Vetter , Dan Williams , Andrew Morton , Linux ARM , "open list:DMA BUFFER SHARING FRAMEWORK" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Nov 02, 2020 at 01:56:10PM +0100, Daniel Vetter wrote: > On Mon, Nov 2, 2020 at 8:29 AM Christoph Hellwig wrote: > > > > On Fri, Oct 30, 2020 at 11:08:08AM +0100, Daniel Vetter wrote: > > > Also mark up follow_pfn as EXPORT_SYMBOL_GPL. The only safe way to use > > > that by drivers/modules is together with an mmu_notifier, and that's > > > all _GPL stuff. > > > > I also think it also needs to be renamed to explicitly break any existing > > users out of tree or int the submission queue. > > Ok I looked at the mmu notifier locking again and noticed that > mm->subscriptions has its own spinlock. Since there usually shouldn't > be a huge pile of these I think it's feasible to check for the mmu > notifier in follow_pfn. And that would stuff this gap for good. I'll > throw that on top as a final patch and see what people think. Probably the simplest is to just check mm_has_notifiers() when in lockdep or something very simple like that Jason _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 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=-3.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED 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 7948DC388F2 for ; Mon, 2 Nov 2020 13:43:42 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 12CB12074F for ; Mon, 2 Nov 2020 13:43:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="ir3GR39Y" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 12CB12074F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BDCEB6EB78; Mon, 2 Nov 2020 13:43:23 +0000 (UTC) Received: from mail-qk1-x743.google.com (mail-qk1-x743.google.com [IPv6:2607:f8b0:4864:20::743]) by gabe.freedesktop.org (Postfix) with ESMTPS id CF8686E4F9 for ; Mon, 2 Nov 2020 13:01:17 +0000 (UTC) Received: by mail-qk1-x743.google.com with SMTP id r7so11352895qkf.3 for ; Mon, 02 Nov 2020 05:01:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=ywfiDbg6XCEWmoBx9eC29OtR/MyEWOW93XTelnAXaBk=; b=ir3GR39YhTRDVVIubqbd2b6fYJQqoYzGlGzQhJGPgx/IpIwERjn3x6j0FKgwPju8tJ K346RwtLd1HrF6IYofhsCSTJj3QK+10oMg2YllJh/KpA3n62CbFQnKL6ivWZ5KZSOniq QwLvLlA6x1j/aJc2hKzXChvGjpbbw6GWq/KNk/8R9NhESFTt0yrJ0KQKjkdmTuloLwW/ Zwps2gbtqPniuVum2Pfu8S68SKxWxd0HMyfFBAbv4qCeVCCuOZxQnUab9RNI4DYrsJao v2N/I2zDZif6Md4+OJsi4IvpXjI5tOvsKPLa0IKjhrcIMk4ZoUB68GDdMIbIvaBwF1NM /xmg== 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=ywfiDbg6XCEWmoBx9eC29OtR/MyEWOW93XTelnAXaBk=; b=a0tguKZJT3a5XxvpKHvasCJzUxR3uBaD5JOa9vinB9RwCaAg2kiJTEkbs8/dynBJ9y 4/GFhUg5sf8Z7dUv++r71lv9jtlFqv6aImdULl6WBRELrXwqQlCNoV0kCmVIRuZcM/T2 +aFlmrsVrOS28/F7mXz9CQctEnrFry+viugEz6SpnpaE+RmKptUJyAIrYNLTORBeQqAQ 7Vf2Swbyzf4T+JzjdRX56sP2i18eExobwV7Z1AegTfr9m7op5NNjvh3LbA4+1umNA5E3 2ez+eNUwoQ93UrQ2/cv+xEaLsSO2+qY0NcGmxWHdiGI1W2w7Pe+9zmcXfcSGPXwhuX1M 3VFA== X-Gm-Message-State: AOAM530jjuy5KYUZaYy+kHSxC9mf1y47Hw6XjqRELsEOoWQVwIdL54iP Ga5Gw1efzTsd+L6c35SGalkKvQ== X-Google-Smtp-Source: ABdhPJzRrsH3Zfgny2Ycg3bBy2Q+SuhdpwI09cYL0ZnBVzwrgv7GmXDFxfx3kiLU2YMRfbo6u8i3PQ== X-Received: by 2002:a37:8c41:: with SMTP id o62mr13561782qkd.240.1604322076971; Mon, 02 Nov 2020 05:01:16 -0800 (PST) Received: from ziepe.ca (hlfxns017vw-156-34-48-30.dhcp-dynamic.fibreop.ns.bellaliant.net. [156.34.48.30]) by smtp.gmail.com with ESMTPSA id b8sm7742829qkn.133.2020.11.02.05.01.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Nov 2020 05:01:16 -0800 (PST) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1kZZSV-00EvRo-QJ; Mon, 02 Nov 2020 09:01:15 -0400 Date: Mon, 2 Nov 2020 09:01:15 -0400 From: Jason Gunthorpe To: Daniel Vetter Subject: Re: [PATCH v5 08/15] mm: Add unsafe_follow_pfn Message-ID: <20201102130115.GC36674@ziepe.ca> References: <20201030100815.2269-1-daniel.vetter@ffwll.ch> <20201030100815.2269-9-daniel.vetter@ffwll.ch> <20201102072931.GA16419@infradead.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailman-Approved-At: Mon, 02 Nov 2020 13:43:21 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-samsung-soc , Jan Kara , Kees Cook , KVM list , John Hubbard , LKML , DRI Development , Christoph Hellwig , Linux MM , J??r??me Glisse , Daniel Vetter , Dan Williams , Andrew Morton , Linux ARM , "open list:DMA BUFFER SHARING FRAMEWORK" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Mon, Nov 02, 2020 at 01:56:10PM +0100, Daniel Vetter wrote: > On Mon, Nov 2, 2020 at 8:29 AM Christoph Hellwig wrote: > > > > On Fri, Oct 30, 2020 at 11:08:08AM +0100, Daniel Vetter wrote: > > > Also mark up follow_pfn as EXPORT_SYMBOL_GPL. The only safe way to use > > > that by drivers/modules is together with an mmu_notifier, and that's > > > all _GPL stuff. > > > > I also think it also needs to be renamed to explicitly break any existing > > users out of tree or int the submission queue. > > Ok I looked at the mmu notifier locking again and noticed that > mm->subscriptions has its own spinlock. Since there usually shouldn't > be a huge pile of these I think it's feasible to check for the mmu > notifier in follow_pfn. And that would stuff this gap for good. I'll > throw that on top as a final patch and see what people think. Probably the simplest is to just check mm_has_notifiers() when in lockdep or something very simple like that Jason _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel