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 8D738C56201 for ; Thu, 22 Oct 2020 13:04:30 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 019F522267 for ; Thu, 22 Oct 2020 13:04:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="hFupg462" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 019F522267 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 72FF86B0072; Thu, 22 Oct 2020 09:04:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 699F06B0073; Thu, 22 Oct 2020 09:04:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 509EC6B0074; Thu, 22 Oct 2020 09:04:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0104.hostedemail.com [216.40.44.104]) by kanga.kvack.org (Postfix) with ESMTP id 1BEF26B0072 for ; Thu, 22 Oct 2020 09:04:28 -0400 (EDT) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 9EC59362A for ; Thu, 22 Oct 2020 13:04:27 +0000 (UTC) X-FDA: 77399580174.04.beef25_05130c627251 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin04.hostedemail.com (Postfix) with ESMTP id 7A302800AD10 for ; Thu, 22 Oct 2020 13:04:27 +0000 (UTC) X-HE-Tag: beef25_05130c627251 X-Filterd-Recvd-Size: 4936 Received: from mail-ot1-f67.google.com (mail-ot1-f67.google.com [209.85.210.67]) by imf49.hostedemail.com (Postfix) with ESMTP for ; Thu, 22 Oct 2020 13:04:26 +0000 (UTC) Received: by mail-ot1-f67.google.com with SMTP id c5so995524otr.1 for ; Thu, 22 Oct 2020 06:04:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ZyNrxU7+apn6xOGNK6avkKI1+/ers9vOGia4XvYK0qo=; b=hFupg462AQWF/3SYEGt7TdCBz7vmVV24cGf5H3PsZJ3NHOF7ARTtk1Xj9pQ6xHZuZX osgTY+1RlCMoExun5CEMIKW0/Q22JFrGKszrr35SoM6z+n1XQ4DOZb0ztKWF8FqsQ0rj YYO9Ror43OTX+8WLAdJnTsM4HmBRXtLFYIBBA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ZyNrxU7+apn6xOGNK6avkKI1+/ers9vOGia4XvYK0qo=; b=XGkj78qzNwWVr6Nu1y92Vglefpo/RoHsgR5RMUKlPyYcnhtwYR6KDNuWFOhzTbZpcl uhitKlIX8phcqRvzED6PT53FXtq+s9l6kRQsUNrOPvhE+IhjDvkTfQjRbAQG54pctFKH EjSHgx6zGZ0ICo5Gm7NeOWCxnGARcj5zdJT3nkVduAO+q3CnxmxG4TGWvqDXsnB8RoMl NMvgIXAYTEME7seUbEwy7IjL/jTG6rd41K4ATrb9qhQay6wBgpHOhV6P4NWgpYZjx+Ep obf7omaRlb3aeof1G6ixqf0pXCy5qeoWwxdwtJKCL6I36zFOjYDvFxjobkJDdtpXlxAv Z2OQ== X-Gm-Message-State: AOAM5339onetBR31leILvQPmutzZHIGnVh4ehsgrKOjKlOAtpY3dpEfV TT1RFiJgtCAUp/FF/BRdX/csf2vS7GnNHM/B7I53mA== X-Google-Smtp-Source: ABdhPJx8bjchuHtk5X5j8AOy5uSsJ+M716njPCO+bint+3P1gD9xIsXgxoepgb7cnqWbI4FroPmfqz6vrX/g4fdQHsY= X-Received: by 2002:a05:6830:1647:: with SMTP id h7mr1916643otr.281.1603371865933; Thu, 22 Oct 2020 06:04:25 -0700 (PDT) MIME-Version: 1.0 References: <20201021085655.1192025-1-daniel.vetter@ffwll.ch> <20201021085655.1192025-13-daniel.vetter@ffwll.ch> <20201021125030.GK36674@ziepe.ca> <20201021151352.GL36674@ziepe.ca> <20201021163702.GM36674@ziepe.ca> <20201021232022.GN36674@ziepe.ca> <20201022114345.GO36674@ziepe.ca> In-Reply-To: <20201022114345.GO36674@ziepe.ca> From: Daniel Vetter Date: Thu, 22 Oct 2020 15:04:14 +0200 Message-ID: Subject: Re: [PATCH v3 12/16] PCI: Obey iomem restrictions for procfs mmap To: Jason Gunthorpe Cc: DRI Development , LKML , KVM list , Linux MM , Linux ARM , linux-samsung-soc , "open list:DMA BUFFER SHARING FRAMEWORK" , linux-s390 , Daniel Vetter , Kees Cook , Dan Williams , Andrew Morton , John Hubbard , =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= , Jan Kara , Bjorn Helgaas , Linux PCI , Daniel Vetter Content-Type: text/plain; charset="UTF-8" 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 Thu, Oct 22, 2020 at 1:43 PM Jason Gunthorpe wrote: > > On Thu, Oct 22, 2020 at 09:00:44AM +0200, Daniel Vetter wrote: > > On Thu, Oct 22, 2020 at 1:20 AM Jason Gunthorpe wrote: > > > > > > On Wed, Oct 21, 2020 at 09:24:08PM +0200, Daniel Vetter wrote: > > > > On Wed, Oct 21, 2020 at 6:37 PM Jason Gunthorpe wrote: > > > > > > > > > > On Wed, Oct 21, 2020 at 05:54:54PM +0200, Daniel Vetter wrote: > > > > > > > > > > > The trouble is that io_remap_pfn adjust vma->pgoff, so we'd need to > > > > > > split that. So ideally ->mmap would never set up any ptes. > > > > > > > > > > /dev/mem makes pgoff == pfn so it doesn't get changed by remap. > > > > > > > > > > pgoff doesn't get touched for MAP_SHARED either, so there are other > > > > > users that could work like this - eg anyone mmaping IO memory is > > > > > probably OK. > > > > > > > > I was more generally thinking for io_remap_pfn_users because of the > > > > mkwrite use-case we might have in fbdev emulation in drm. > > > > > > You have a use case for MAP_PRIVATE and io_remap_pfn_range()?? > > > > Uh no :-) > > So it is fine, the pgoff mangling only happens for MAP_PRIVATE Ah right I got confused, thanks for clarifying. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch