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.9 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 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 EA102C4727E for ; Wed, 7 Oct 2020 23:21:22 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3B02C20872 for ; Wed, 7 Oct 2020 23:21:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="eonGoy0X" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3B02C20872 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 50E5D6B005C; Wed, 7 Oct 2020 19:21:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 498D56B005D; Wed, 7 Oct 2020 19:21:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 35FFA6B0062; Wed, 7 Oct 2020 19:21:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0068.hostedemail.com [216.40.44.68]) by kanga.kvack.org (Postfix) with ESMTP id 06B826B005C for ; Wed, 7 Oct 2020 19:21:20 -0400 (EDT) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 7EB2F8249980 for ; Wed, 7 Oct 2020 23:21:20 +0000 (UTC) X-FDA: 77346702720.19.sign97_4c180ec271d3 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin19.hostedemail.com (Postfix) with ESMTP id 5BCBB1AD1B5 for ; Wed, 7 Oct 2020 23:21:20 +0000 (UTC) X-HE-Tag: sign97_4c180ec271d3 X-Filterd-Recvd-Size: 4953 Received: from mail-qt1-f193.google.com (mail-qt1-f193.google.com [209.85.160.193]) by imf22.hostedemail.com (Postfix) with ESMTP for ; Wed, 7 Oct 2020 23:21:19 +0000 (UTC) Received: by mail-qt1-f193.google.com with SMTP id s47so3578544qth.4 for ; Wed, 07 Oct 2020 16:21:19 -0700 (PDT) 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=wKVq0v36o1OseOTfSiRENpilMLoRQr0K5VZe4J2K3Kc=; b=eonGoy0XmwUCVUGspJnsew+Xt7VaOYXBvCVLNfKebMnycQvmW3AnbQjz9lSZk+oJTt dhvuV/v/cnVlxITNMU9OjuXLMypWJUZ21uT0gYOxQ8d5Ns6agyhkSgI250TcvBKPkqcq eDXVSqeP187Kj7hX9ZW21soQCHyKtnnpRD86xF4iV4vIsAEXErr5M7nS61S+a1iD/LIb LoT/Oje5p+16A0FP2LPQqK7+AMDx5byuewUWnk+LOvBmW6M8aHFUXTPUZju1RP8UOXu8 sLtKGSyXFXzBShaXLdlI6xM43DeuV6UnkYTmZJGaAH/xG5nThTf8qdvy8p02SSq+yIph +DKQ== 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=wKVq0v36o1OseOTfSiRENpilMLoRQr0K5VZe4J2K3Kc=; b=NmS8b4hj143qiy3bRiVAe1ESo8z9iKhpisQ0BDI5uqgaL+EduPWyp2zYJhO+4kTm0G 8sorLtsoxiUuDNTkKjMgEu2QbPS2oJ4RJuD6eU2neL30vqAMR7L0Zwp9rA0cFtRPOeDL AdMXMB5d4FEzzdYkPneHbevlg2Zq4xqlvD32p0ajzfWlqoH33SS0Z6md72+TTX+feKV+ X6KHvRDXtfDwwcci/GNHOSDhEiv5rZFbG9g+G1orkyvMVZcL+tqgVBX3sqzCOyKup2O+ ciL67WawKmbKSf8dZDpewKfdXiC0KQtn0iPX9A3y8KFe3R10Xa0hFwjD5mVWa1tb16yY KDXQ== X-Gm-Message-State: AOAM533kG9BYKyrF7qBOKkUn50yyOJMBbvN2KSKLdJOHwgHc3TMXZUO9 hdlbOLvrGlpRaUu2JeXecG1iJQ== X-Google-Smtp-Source: ABdhPJyQZRi/LW8n5yhULmf0Fru5TIwyRzoLwr2XtdSWRnkxdnVhvqGusX2Dk2zCuTvGMQkdks5bXg== X-Received: by 2002:ac8:5bd0:: with SMTP id b16mr5601331qtb.296.1602112879011; Wed, 07 Oct 2020 16:21:19 -0700 (PDT) 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 z26sm1881713qki.40.2020.10.07.16.21.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Oct 2020 16:21:18 -0700 (PDT) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1kQIkH-001IkZ-3z; Wed, 07 Oct 2020 20:21:17 -0300 Date: Wed, 7 Oct 2020 20:21:17 -0300 From: Jason Gunthorpe To: Daniel Vetter Cc: DRI Development , LKML , kvm@vger.kernel.org, Linux MM , Linux ARM , linux-samsung-soc , "open list:DMA BUFFER SHARING FRAMEWORK" , linux-s390@vger.kernel.org, Dan Williams , Kees Cook , Rik van Riel , Benjamin Herrensmidt , Dave Airlie , Hugh Dickins , Andrew Morton , John Hubbard , =?utf-8?B?SsOpcsO0bWU=?= Glisse , Jan Kara , Daniel Vetter Subject: Re: [PATCH 07/13] mm: close race in generic_access_phys Message-ID: <20201007232117.GB5177@ziepe.ca> References: <20201007164426.1812530-1-daniel.vetter@ffwll.ch> <20201007164426.1812530-8-daniel.vetter@ffwll.ch> <20201007172746.GU5177@ziepe.ca> 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 Wed, Oct 07, 2020 at 08:01:42PM +0200, Daniel Vetter wrote: > I think it'd fix the bug, until someone wires ->access up for > drivers/gpu, or the next subsystem. This is also just for ptrace, so > we really don't care when we stall the vm badly and other silly > things. So I figured the somewhat ugly, but full generic solution is > the better one, so that people who want to be able to ptrace > read/write their iomem mmaps can just sprinkle this wherever they feel > like. > > But yeah if we go with most minimal fix, i.e. only trying to fix the > current users, then your thing should work and is simpler. But it > leaves the door open for future problems. The only other idea I had was to fully make the 'vma of __iomem memory' some generic utility, completely take over the vm_ops. We did something like this in RDMA, what I found was even just implementing mmap() using the kernel helpers turned out to be pretty tricky, many drivers did it wrong in small ways. Jason