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=-10.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 9D10FC4363C for ; Wed, 7 Oct 2020 18:48:11 +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 204262176B for ; Wed, 7 Oct 2020 18:48:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="EwK7v7uu"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="yGYWT03m" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 204262176B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org 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: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:References:List-Owner; bh=yy7SgaV0ojyy1zEAMXgDilMRqPAS9muZX9fEn+wCajw=; b=EwK7v7uuR84M/ksyKoPUtsEEP /GGRyyO3KCUieIkr+aGUgJWQUXaQ9aP5Bx/VgQbapkLwdDR6SPdX0wZkfeAIq1PjOCgS7AetK9jki iV1mvJMKLmetiXS6wIxmy7sfls9MeWieMz9A/pL+wSMyEaGLeLyscIq7KvDr3mffO9WKoVWqEB0iM le0b+JQit84P9oWj81tSWqUv1f2PccP5r+HAjIqriUy6RRRE1yQUdwzudOTSsX3FGiflPal63n0I9 jkXLP3zwP+jxDzNz4y0i2yDxpxOoaC9ZZiOpnAsWxFQHV0E+0KDqjW4eceY4u10ODv9C2TCfgystb vd9tgh4Ww==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kQESX-0007eD-7a; Wed, 07 Oct 2020 18:46:41 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kQEST-0007dO-Qr for linux-arm-kernel@lists.infradead.org; Wed, 07 Oct 2020 18:46:38 +0000 Received: from localhost (170.sub-72-107-125.myvzw.com [72.107.125.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 302572173E; Wed, 7 Oct 2020 18:46:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602096396; bh=ku8/7a2SrweIxThK5zG5QJDipURplqu8mO6h2koIIVc=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=yGYWT03mT20e+akOD8V3aUmT+NyGjr7bgLmgu9ySTSASz+Md94zSiKtM93/z0+0sL I3c3vVZGcJsLXlm+ZoUqyLsz8Cd5moqzmTGlgBtkwCaTbh8SP5WyTjiZ42UF86RDsd vY1hTupOSF5ue42FE0IOxR9jnpK4Wp1Jv+Hagbrk= Date: Wed, 7 Oct 2020 13:46:34 -0500 From: Bjorn Helgaas To: Daniel Vetter Subject: Re: [PATCH 09/13] PCI: obey iomem restrictions for procfs mmap Message-ID: <20201007184634.GA3259641@bjorn-Precision-5520> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20201007164426.1812530-10-daniel.vetter@ffwll.ch> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201007_144637_968321_C35D7335 X-CRM114-Status: GOOD ( 20.24 ) 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-s390@vger.kernel.org, linux-samsung-soc@vger.kernel.org, Jan Kara , Kees Cook , kvm@vger.kernel.org, Jason Gunthorpe , John Hubbard , LKML , DRI Development , linux-mm@kvack.org, =?iso-8859-1?B?Suly9G1l?= Glisse , linux-pci@vger.kernel.org, Bjorn Helgaas , Daniel Vetter , Dan Williams , Andrew Morton , linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Oct 07, 2020 at 06:44:22PM +0200, Daniel Vetter wrote: > There's three ways to access pci bars from userspace: /dev/mem, sysfs > files, and the old proc interface. Two check against > iomem_is_exclusive, proc never did. And with CONFIG_IO_STRICT_DEVMEM, > this starts to matter, since we don't want random userspace having > access to pci bars while a driver is loaded and using it. > = > Fix this. Please mention *how* you're fixing this. I know you can sort of deduce it from the first paragraph, but it's easy to save readers the trouble. s/pci/PCI/ s/bars/BARs/ Capitalize subject to match other patches. > References: 90a545e98126 ("restrict /dev/mem to idle io memory ranges") > Signed-off-by: Daniel Vetter > Cc: Jason Gunthorpe > Cc: Kees Cook > Cc: Dan Williams > Cc: Andrew Morton > Cc: John Hubbard > Cc: J=E9r=F4me Glisse > Cc: Jan Kara > Cc: Dan Williams > 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: Bjorn Helgaas > Cc: linux-pci@vger.kernel.org > --- > drivers/pci/proc.c | 5 +++++ > 1 file changed, 5 insertions(+) > = > diff --git a/drivers/pci/proc.c b/drivers/pci/proc.c > index d35186b01d98..3a2f90beb4cb 100644 > --- a/drivers/pci/proc.c > +++ b/drivers/pci/proc.c > @@ -274,6 +274,11 @@ static int proc_bus_pci_mmap(struct file *file, stru= ct vm_area_struct *vma) > else > return -EINVAL; > } > + > + if (dev->resource[i].flags & IORESOURCE_MEM && > + iomem_is_exclusive(dev->resource[i].start)) > + return -EINVAL; > + > ret =3D pci_mmap_page_range(dev, i, vma, > fpriv->mmap_state, write_combine); > if (ret < 0) > -- = > 2.28.0 > = _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel