Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4788270ybi; Mon, 15 Jul 2019 15:01:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqzdlsvQnEVqOR7B86SRjHolBE/fZ2NivzRfCFzmPl4BUcgKC8fH6WyUAWiZaPijjz6r4yn0 X-Received: by 2002:a17:90a:21ac:: with SMTP id q41mr32252122pjc.31.1563228079553; Mon, 15 Jul 2019 15:01:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563228079; cv=none; d=google.com; s=arc-20160816; b=eUzzGGm535X8u5Fg+87AwT/O5t547JzKxEIm1uXpm+RnZXzJQp8BIkBk7nYkLNckoC hinGKNthFOuJ6ng9CFDE5m4mCeVkDjrPF1HG+QnlJCm7L8PDjB5/oumLXtGrkswinO+r 11ATRUdmSjMtcBg1un7GlSCufKfRmJSN7TyGOchmTdLG/K9+EY2aGjMLNket67smY9OL 3uXIJBANDoSoWfCM4nahH8mZMenQQW2uX0mFBowC68bcizLts6dlom49cQvNY9Yl3Z5n kLefsHWRT63yG1SU/Ns8SIZvtoKrFfZgcJzeoI/l8W2dnkF8HzTAqc73CJumzZnq1Nmb LkWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=X/oUKNxDTp84H2JqM60txAgcpY2XdRwedM+r2XD9v/4=; b=qBy/kRP6jDhabY4w2ZMFLyyGEpSZFRd0ahmkoPajty86Ptmfxf8BhbgYQWGR2rkhWc ptHJUvO2Tt/Io7r1yhk1u2rrb7xSk21bYZ5lqlIbBPZV7KA5l5DKMaMcAQgVmVECCYQm ORJdDOnp+0XY3SAoFmgDgrDky22htxhL5OzBgx/SsmVRwfpFIK7ef9uNATPZtwTCKh2L UpOUutGYf+onI9b0Wcx3CAxughGg1VqwpsIJuA+BsiQPMoeYovaWEIj1D1c5kpO+PRRD DVKnAXB53bLoWPk1ZYlQeQZJ/BtSksd6Zv+/LKuVaVeLsXCWIxwl7uen1u/C8J4MubJE X/Nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=EC6fKVCh; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v32si16567825plg.3.2019.07.15.15.00.54; Mon, 15 Jul 2019 15:01:19 -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=@kernel.org header.s=default header.b=EC6fKVCh; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731109AbfGOWAd (ORCPT + 99 others); Mon, 15 Jul 2019 18:00:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:60920 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727862AbfGOWAd (ORCPT ); Mon, 15 Jul 2019 18:00:33 -0400 Received: from localhost.localdomain (c-73-223-200-170.hsd1.ca.comcast.net [73.223.200.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 1DD472171F; Mon, 15 Jul 2019 22:00:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563228032; bh=opj85GkhTsX799kvL6zjC53Z5Nb4q3yDICVYRU7YfS0=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=EC6fKVCh7fcp4L3S+xIIzlJ041+FzYRiPqD+o/00VyfrmwI78fMb8glbcLyVutXZN SjI9PDYmbGBy8XjyzzJKqlCvHtOzhWif4oCIPemh5CMm+eEiCheYoK9L12l/K117EG Lki6SkcXAH/ihaC/jxXzsC9IORAdtALY1dvq1V2M= Date: Mon, 15 Jul 2019 15:00:31 -0700 From: Andrew Morton To: Ralph Campbell Cc: , , =?ISO-8859-1?Q?J?= =?ISO-8859-1?Q?=E9r=F4me?= Glisse , "Kirill A. Shutemov" , Mike Kravetz , Jason Gunthorpe Subject: Re: [PATCH] mm/hmm: Fix bad subpage pointer in try_to_unmap_one Message-Id: <20190715150031.49c2846f4617f30bca5f043f@linux-foundation.org> In-Reply-To: <05fffcad-cf5e-8f0c-f0c7-6ffbd2b10c2e@nvidia.com> References: <20190709223556.28908-1-rcampbell@nvidia.com> <20190709172823.9413bb2333363f7e33a471a0@linux-foundation.org> <05fffcad-cf5e-8f0c-f0c7-6ffbd2b10c2e@nvidia.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 9 Jul 2019 18:24:57 -0700 Ralph Campbell wro= te: >=20 > On 7/9/19 5:28 PM, Andrew Morton wrote: > > On Tue, 9 Jul 2019 15:35:56 -0700 Ralph Campbell = wrote: > >=20 > >> 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(). > >=20 > > I think this is > >=20 > > Fixes: a5430dda8a3a1c ("mm/migrate: support un-addressable ZONE_DEVICE= page in migration") > > Cc: stable > >=20 > > yes? > >=20 >=20 > Yes. Can you add this or should I send a v2? I updated the patch. Could we please have some review input? From: Ralph Campbell Subject: mm/hmm: fix bad subpage pointer in try_to_unmap_one 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: BUG: unable to handle page fault for address: ffffea1fffffffc8 Initialize subpage correctly before calling page_remove_rmap(). Link: http://lkml.kernel.org/r/20190709223556.28908-1-rcampbell@nvidia.com Fixes: a5430dda8a3a1c ("mm/migrate: support un-addressable ZONE_DEVICE page= in migration") Signed-off-by: Ralph Campbell Cc: "J=E9r=F4me Glisse" Cc: "Kirill A. Shutemov" Cc: Mike Kravetz Cc: Jason Gunthorpe Cc: Signed-off-by: Andrew Morton --- mm/rmap.c | 1 + 1 file changed, 1 insertion(+) --- 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 _