Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp59983ybi; Mon, 15 Jul 2019 16:37:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqxoWRk9BcP3WT1lRhxQBB9uHUzTB7t1amiXVBxU0QWuU2Iu10R86U+cnr/mROTFosWw0tFs X-Received: by 2002:a17:902:ba8b:: with SMTP id k11mr31207540pls.107.1563233823139; Mon, 15 Jul 2019 16:37:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563233823; cv=none; d=google.com; s=arc-20160816; b=KKFvnI2hh5lq480FoIQUXx20p9KSjIvQ8BNx0R6Fy0BdAzNY/ren/n61KH/xrSBnh6 JEY7r1pCuXjWMNh/h4uZVl2jrzpO//NeEHEH6cU0TqKtAfF16K3kBDcsOirIC4dOpVA4 suC7Ox8iZeFBGlo/WDj87d5lOZ2copgRsY+Q7rPjjhbnePD8x5IvPycBOKpKw1P5MfEh /RLj2CIZUtD9OSAHDerr2bovivnHIauj9Q1j7jc2d8Y3dFtObhU2yIpSXKJ0wdnem2lb lRwXg5aS36SooXJRlpS+0PfFwPybh5VHwtUkSmvYUBH2S53e4XpzmVRdsYHzaDCDqDIV m4Ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=h+BRneuTpawGqNjEBZFefMsMDl5kO4JZEpBOUwB1zsI=; b=dxAM2XURjVBRhI7FcFqce6fx+jqsMtOtMA9K2uB4iK7pt44kL72Oj035wYCXAWAWin t5NgxplE/3GpdNeLmYtyauvSyubcAb7KTycYig5rRSiCDcGaBQkl/kWAG32A/7aijZuF vBuadPad5AWKFVw99seniRmujnpAKtMj/BtN95DHAqYeGsfb6bhZV4Rk2R7CyvP6q8Ja 1QypSSA+tXwNgO9ZV+BcKii6SqOG5+fJGES2D0L2svZbnHkEvma+OXfL2J48SexiTwHg SfK6/ZQH02DbGElpolujWqduInxwXsSeEMH16871FNz/8VhjdeFiNPUU4mFk+j5AobNX rOuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=OgRxe+A5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y10si15869681plp.117.2019.07.15.16.36.45; Mon, 15 Jul 2019 16:37:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=OgRxe+A5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732574AbfGOXe3 (ORCPT + 99 others); Mon, 15 Jul 2019 19:34:29 -0400 Received: from hqemgate15.nvidia.com ([216.228.121.64]:11791 "EHLO hqemgate15.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727379AbfGOXe3 (ORCPT ); Mon, 15 Jul 2019 19:34:29 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate15.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Mon, 15 Jul 2019 16:34:34 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Mon, 15 Jul 2019 16:34:28 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Mon, 15 Jul 2019 16:34:28 -0700 Received: from [10.110.48.28] (10.124.1.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Mon, 15 Jul 2019 23:34:22 +0000 Subject: Re: [PATCH] mm/hmm: Fix bad subpage pointer in try_to_unmap_one To: Andrew Morton , Ralph Campbell CC: , , =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= , "Kirill A. Shutemov" , Mike Kravetz , Jason Gunthorpe References: <20190709223556.28908-1-rcampbell@nvidia.com> <20190709172823.9413bb2333363f7e33a471a0@linux-foundation.org> <05fffcad-cf5e-8f0c-f0c7-6ffbd2b10c2e@nvidia.com> <20190715150031.49c2846f4617f30bca5f043f@linux-foundation.org> X-Nvconfidentiality: public From: John Hubbard Message-ID: <0ee5166a-26cd-a504-b9db-cffd082ecd38@nvidia.com> Date: Mon, 15 Jul 2019 16:34:22 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <20190715150031.49c2846f4617f30bca5f043f@linux-foundation.org> X-Originating-IP: [10.124.1.5] X-ClientProxiedBy: HQMAIL104.nvidia.com (172.18.146.11) To HQMAIL107.nvidia.com (172.20.187.13) Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1563233674; bh=h+BRneuTpawGqNjEBZFefMsMDl5kO4JZEpBOUwB1zsI=; h=X-PGP-Universal:Subject:To:CC:References:X-Nvconfidentiality:From: Message-ID:Date:User-Agent:MIME-Version:In-Reply-To: X-Originating-IP:X-ClientProxiedBy:Content-Type:Content-Language: Content-Transfer-Encoding; b=OgRxe+A50xtVuH+HsQIV6/bprmeVGbsbaB9lBSbyHuzVUuWGvBTurzo+o5F6zORfN N/3R1l9mp4EACbf8HPX+47skIoVrJDcI2f30c9obXLSGBxMmch4ZlQ/RkpNmGq1uHq yd5NXiTOUdDT50Y2cxZQItGpRtiMe4zSUBt8EpplppDt7ZNEztv0cgDHU8YSludWXJ 3oHds8mnWZb7IDJCV7pvnbquGQcWz/xxH8GZUVa0tLGarj4n8r/vjY4EoIjCUwVDhC JCTAhWe1S8S9/da9QISXzHS4rr+wJFRUhZ6iuuPD/J5SFnrQxE6TWtKYYX/EaP5S4H ZFOYnotJa/3zg== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/15/19 3:00 PM, Andrew Morton wrote: > On Tue, 9 Jul 2019 18:24:57 -0700 Ralph Campbell w= rote: >=20 >> >> On 7/9/19 5:28 PM, Andrew Morton wrote: >>> On Tue, 9 Jul 2019 15:35:56 -0700 Ralph Campbell = wrote: >>> >>>> When migrating a ZONE device private page from device memory to system >>>> memory, the subpage pointer is initialized from a swap pte which compu= tes >>>> an invalid page pointer. A kernel panic results such as: >>>> >>>> BUG: unable to handle page fault for address: ffffea1fffffffc8 >>>> >>>> Initialize subpage correctly before calling page_remove_rmap(). >>> >>> I think this is >>> >>> Fixes: a5430dda8a3a1c ("mm/migrate: support un-addressable ZONE_DEVICE= page in migration") >>> Cc: stable >>> >>> yes? >>> >> >> Yes. Can you add this or should I send a v2? >=20 > I updated the patch. Could we please have some review input? >=20 >=20 > From: Ralph Campbell > Subject: mm/hmm: fix bad subpage pointer in try_to_unmap_one >=20 > When migrating a ZONE device private page from device memory to system > memory, the subpage pointer is initialized from a swap pte which computes > an invalid page pointer. A kernel panic results such as: >=20 > BUG: unable to handle page fault for address: ffffea1fffffffc8 >=20 > Initialize subpage correctly before calling page_remove_rmap(). >=20 > Link: http://lkml.kernel.org/r/20190709223556.28908-1-rcampbell@nvidia.co= m > Fixes: a5430dda8a3a1c ("mm/migrate: support un-addressable ZONE_DEVICE pa= ge in migration") > Signed-off-by: Ralph Campbell > Cc: "J=C3=A9r=C3=B4me Glisse" > Cc: "Kirill A. Shutemov" > Cc: Mike Kravetz > Cc: Jason Gunthorpe > Cc: > Signed-off-by: Andrew Morton > --- >=20 > mm/rmap.c | 1 + > 1 file changed, 1 insertion(+) >=20 > --- a/mm/rmap.c~mm-hmm-fix-bad-subpage-pointer-in-try_to_unmap_one > +++ a/mm/rmap.c > @@ -1476,6 +1476,7 @@ static bool try_to_unmap_one(struct page > * No need to invalidate here it will synchronize on > * against the special swap migration pte. > */ > + subpage =3D page; > goto discard; > } > =20 Hi Ralph and everyone, While the above prevents a crash, I'm concerned that it is still not an accurate fix. This fix leads to repeatedly removing the rmap, against th= e same struct page, which is odd, and also doesn't directly address the root cause, which I understand to be: this routine can't handle migrating the zero page properly--over and back, anyway. (We should also mention more= =20 about how this is triggered, in the commit description.) I'll take a closer look at possible fixes (I have to step out for a bit) so= on,=20 but any more experienced help is also appreciated here. thanks, --=20 John Hubbard NVIDIA