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