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=-2.2 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 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 859F3C0650F for ; Tue, 30 Jul 2019 15:01:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5CABC206B8 for ; Tue, 30 Jul 2019 15:01:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="lW+W2m09" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732018AbfG3PB3 (ORCPT ); Tue, 30 Jul 2019 11:01:29 -0400 Received: from new3-smtp.messagingengine.com ([66.111.4.229]:52093 "EHLO new3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730274AbfG3PB1 (ORCPT ); Tue, 30 Jul 2019 11:01:27 -0400 Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailnew.nyi.internal (Postfix) with ESMTP id AEE3A1247; Tue, 30 Jul 2019 11:01:26 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Tue, 30 Jul 2019 11:01:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=zvdSC+ ++bOixa8/Ggn3YSFdCsBfxtdhmukIIZhQQVgs=; b=lW+W2m09RjTW3IqalZ8nAn FSD+/aAr7gAdc5pa7CPKW3L82lWY7dJn+6/Gr23FPNxuMJnI/xrjPU0IIP7/zb3p 5k+VsJg2pmEKJz3azrNAGRmDONjC5kl2dyEwteYcz551n+KY+LnCKI6WFEgUYZKb RDblacx4JKeUWRzwShHITV1aMT5+W47beGTgZD6F3ue6a8uuhd9MRyCR7s20ZeKq kpA/PCcwus1ILYsOfUoAszNv0SRJdzrcnoEKaerpuRPRcGA7SfRuryzp27xAl4vp bZWmnZLD3LkHbMmMw3g5A6aCMdynN7tjF2buSgh3CTxBul395PTJqOtTE9DnBciQ == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduvddrleefgdekudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvuffkfhggtggujggfsehgtderredtreejnecuhfhrohhmpeforghrvghk ucforghrtgiihihkohifshhkihdqifpkrhgvtghkihcuoehmrghrmhgrrhgvkhesihhnvh hishhisghlvghthhhinhhgshhlrggsrdgtohhmqeenucfkphepledurdeihedrfeegrdef feenucfrrghrrghmpehmrghilhhfrhhomhepmhgrrhhmrghrvghksehinhhvihhsihgslh gvthhhihhnghhslhgrsgdrtghomhenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from mail-itl (ip5b412221.dynamic.kabel-deutschland.de [91.65.34.33]) by mail.messagingengine.com (Postfix) with ESMTPA id 937328005A; Tue, 30 Jul 2019 11:01:23 -0400 (EDT) Date: Tue, 30 Jul 2019 17:01:19 +0200 From: Marek =?utf-8?Q?Marczykowski-G=C3=B3recki?= To: Souptick Joarder Cc: Boris Ostrovsky , Andrew Morton , Matthew Wilcox , Michal Hocko , Juergen Gross , Russell King - ARM Linux , robin.murphy@arm.com, xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, Linux-MM , stable@vger.kernel.org, Greg KH Subject: Re: [Xen-devel] [PATCH v4 8/9] xen/gntdev.c: Convert to use vm_map_pages() Message-ID: <20190730150119.GS1250@mail-itl> References: <20190215024830.GA26477@jordon-HP-15-Notebook-PC> <20190728180611.GA20589@mail-itl> <20190729133642.GQ1250@mail-itl> <20190730142233.GR1250@mail-itl> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="KI6XeYrntNhU1GwB" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12+29 (a621eaed) (2019-06-14) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --KI6XeYrntNhU1GwB Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jul 30, 2019 at 08:22:02PM +0530, Souptick Joarder wrote: > On Tue, Jul 30, 2019 at 7:52 PM Marek Marczykowski-G=C3=B3recki > wrote: > > > > On Tue, Jul 30, 2019 at 10:05:42AM -0400, Boris Ostrovsky wrote: > > > On 7/30/19 2:03 AM, Souptick Joarder wrote: > > > > On Mon, Jul 29, 2019 at 7:06 PM Marek Marczykowski-G=C3=B3recki > > > > wrote: > > > >> On Mon, Jul 29, 2019 at 02:02:54PM +0530, Souptick Joarder wrote: > > > >>> On Mon, Jul 29, 2019 at 1:35 PM Souptick Joarder wrote: > > > >>>> On Sun, Jul 28, 2019 at 11:36 PM Marek Marczykowski-G=C3=B3recki > > > >>>> wrote: > > > >>>>> On Fri, Feb 15, 2019 at 08:18:31AM +0530, Souptick Joarder wrot= e: > > > >>>>>> Convert to use vm_map_pages() to map range of kernel > > > >>>>>> memory to user vma. > > > >>>>>> > > > >>>>>> map->count is passed to vm_map_pages() and internal API > > > >>>>>> verify map->count against count ( count =3D vma_pages(vma)) > > > >>>>>> for page array boundary overrun condition. > > > >>>>> This commit breaks gntdev driver. If vma->vm_pgoff > 0, vm_map_= pages > > > >>>>> will: > > > >>>>> - use map->pages starting at vma->vm_pgoff instead of 0 > > > >>>> The actual code ignores vma->vm_pgoff > 0 scenario and mapped > > > >>>> the entire map->pages[i]. Why the entire map->pages[i] needs to = be mapped > > > >>>> if vma->vm_pgoff > 0 (in original code) ? > > > >> vma->vm_pgoff is used as index passed to gntdev_find_map_index. It= 's > > > >> basically (ab)using this parameter for "which grant reference to m= ap". > > > >> > > > >>>> are you referring to set vma->vm_pgoff =3D 0 irrespective of val= ue passed > > > >>>> from user space ? If yes, using vm_map_pages_zero() is an altern= ate > > > >>>> option. > > > >> Yes, that should work. > > > > I prefer to use vm_map_pages_zero() to resolve both the issues. Alt= ernatively > > > > the patch can be reverted as you suggested. Let me know you opinion= and wait > > > > for feedback from others. > > > > > > > > Boris, would you like to give any feedback ? > > > > > > vm_map_pages_zero() looks good to me. Marek, does it work for you? > > > > Yes, replacing vm_map_pages() with vm_map_pages_zero() fixes the > > problem for me. >=20 > Marek, I can send a patch for the same if you are ok. > We need to cc stable as this changes are available in 5.2.4. Sounds good, thanks! --=20 Best Regards, Marek Marczykowski-G=C3=B3recki Invisible Things Lab A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? --KI6XeYrntNhU1GwB Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEhrpukzGPukRmQqkK24/THMrX1ywFAl1AW78ACgkQ24/THMrX 1yzCXgf/RBo3QvtbZfVV9r4EG7nQccY0lAa6q3J2HQnpO7yS80HMzp40ccWa+5io c7QEt7/NsgEzzv7Aergzv6QivV7yH18RFG+RGWN/nEMOX2qNuSHIB6UVhVFtasWU +4MfnwFyd6qMogaOXYSQ+n9Um2IPUdhc5hqZiMLufY2As7d3ccNYvccpR/ydE7oc LdYvyAjOwPwFlketiZ5j73iL0J4aPNqjox00ZoVAtEijnAyTzf3RB+fIUc0WtPUW +UrEDqTkVDwbCg0NfQtsR7UI3FZmv7x5gbmXlGZkdDGFlpKSbFhZwXLpmfv5cHKt 0lP4AtlbS/Pw0vrNR4Vb3Ex6oU/+NQ== =afZC -----END PGP SIGNATURE----- --KI6XeYrntNhU1GwB--