Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4094664ybi; Fri, 19 Jul 2019 14:54:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqzP/SrGPXNoXxZnO22niq8LvxG9216YojE/xphpwcbaZoFXWanW13Ss69TN2cfdB2ij1a0z X-Received: by 2002:a63:bf01:: with SMTP id v1mr55190897pgf.278.1563573251319; Fri, 19 Jul 2019 14:54:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563573251; cv=none; d=google.com; s=arc-20160816; b=i6dFMdSapEFwZHpuuIUwTT/zsaYDKzhNkCCjJ/dmQCJj4UIvVN0RBMKccrPJRkXcFm vDLI4dW/rG9fOfOV8yKipHOEuPbIX4sZplr9/f1H+pdFQoGrRw+PWLvGUaSI+ejl5r/U swfMbAcyGLajRMbxX3+y/FabZT/91g0qY63P6cP0zF94xw1vnlbBaiXe0Xn1Rw+fU0rH ErHZ6o3w9pIcPyHHYaW9/Lfy5roaksJvwlampPFbLiDkEK//R3hRuripSmfTbwT824O0 TimZjVsXCXTrvecB/JD94P3JlN6NWrTcdPgn48xKOliZMvgUEXV9i8QnbxnAiLs9bOkv XLAA== 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 :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=U0IXy/zKKcejMP4DQKHZ57GJs0lTlzQ4MYtXzCim3fk=; b=JsgzlCcctCfq7U3HxVF+OS2ohscgutZ3PoXkyFjkx3Xug0L66fMrrXkf+TIfyMIa/r /BI0n4iSpsyUgCzcTNcrFiXMDdZ/c5v84E73daU7XGSIl75Sla1b5e0DlxYEsvdSw7s1 jCnvz+BQR4jT7FwQNt0PN8L5M8gXwsr3T3xi8nVMBxnFI0u5e45WOoF9zXotkdyR6W2N PKqjIF9DfUUEhPr6A2+yMFo4zS3dzj0EtWrNcCGDq895nxsFGKdKuuNuFBENcrDBizM5 KYTkm8AbFbLrxmbj8r2MDCR5IcnFN7vC78rkoZlo2lJF6iozkCzIcT/6cFS5omTwesuD O57g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=o+RBABok; 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 y12si884299pgr.329.2019.07.19.14.53.56; Fri, 19 Jul 2019 14:54:11 -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=o+RBABok; 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 S1732508AbfGSTHM (ORCPT + 99 others); Fri, 19 Jul 2019 15:07:12 -0400 Received: from hqemgate14.nvidia.com ([216.228.121.143]:11182 "EHLO hqemgate14.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732480AbfGSTHK (ORCPT ); Fri, 19 Jul 2019 15:07:10 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate14.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Fri, 19 Jul 2019 12:07:09 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Fri, 19 Jul 2019 12:07:09 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Fri, 19 Jul 2019 12:07:09 -0700 Received: from HQMAIL104.nvidia.com (172.18.146.11) by HQMAIL106.nvidia.com (172.18.146.12) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Fri, 19 Jul 2019 19:07:04 +0000 Received: from hqnvemgw01.nvidia.com (172.20.150.20) by HQMAIL104.nvidia.com (172.18.146.11) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Fri, 19 Jul 2019 19:07:05 +0000 Received: from rcampbell-dev.nvidia.com (Not Verified[10.110.48.66]) by hqnvemgw01.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Fri, 19 Jul 2019 12:07:04 -0700 From: Ralph Campbell To: CC: , Ralph Campbell , =?UTF-8?q?J=C3=A9r=C3=B4me=20Glisse?= , "Kirill A. Shutemov" , Mike Kravetz , Christoph Hellwig , Jason Gunthorpe , John Hubbard , , Andrew Morton Subject: [PATCH 3/3] mm/hmm: Fix bad subpage pointer in try_to_unmap_one Date: Fri, 19 Jul 2019 12:06:49 -0700 Message-ID: <20190719190649.30096-4-rcampbell@nvidia.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190719190649.30096-1-rcampbell@nvidia.com> References: <20190719190649.30096-1-rcampbell@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1563563229; bh=U0IXy/zKKcejMP4DQKHZ57GJs0lTlzQ4MYtXzCim3fk=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:X-NVConfidentiality: Content-Type:Content-Transfer-Encoding; b=o+RBABok9q175TIaACbH78zORn0X6HKDRIaL7qVbx6i1lTfFIvWnzJW+4vNL6sV6b ZKgT8U/FylXyFeAAKUtwBA/FkfEIAamghIZKdkVrDQ5M71n4NK6qlF4EKNxv4IL4eG +muFf+zUoAUwJ+7LK/tHizAsQdE0USzc+yeNNAo+BhVqKHOsE2Pc3X9dhUdgl61mgH F95OPZNtDZ+Hw34YccLNzh4c/8BUxt3ybbT6oi2KcaW8mcQG/dCe872irjZnjQI/eM pN1XUWI2MkJJS0eZpCAGD73t9t7AvrexWZ6dujBLVTspyk/N1JQL1I0qnp79R8szhm 24nbXQtuN0hkw== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When migrating an anonymous private page to a ZONE_DEVICE private page, the source page->mapping and page->index fields are copied to the destination ZONE_DEVICE struct page and the page_mapcount() is increased. This is so rmap_walk() can be used to unmap and migrate the page back to system memory. However, try_to_unmap_one() computes the subpage pointer from a swap pte which computes an invalid page pointer and a kernel panic results such as: BUG: unable to handle page fault for address: ffffea1fffffffc8 Currently, only single pages can be migrated to device private memory so no subpage computation is needed and it can be set to "page". Fixes: a5430dda8a3a1c ("mm/migrate: support un-addressable ZONE_DEVICE page= in migration") Signed-off-by: Ralph Campbell Cc: "J=C3=A9r=C3=B4me Glisse" Cc: "Kirill A. Shutemov" Cc: Mike Kravetz Cc: Christoph Hellwig Cc: Jason Gunthorpe Cc: John Hubbard Cc: Signed-off-by: Andrew Morton --- mm/rmap.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mm/rmap.c b/mm/rmap.c index e5dfe2ae6b0d..ec1af8b60423 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -1476,6 +1476,7 @@ static bool try_to_unmap_one(struct page *page, struc= t vm_area_struct *vma, * No need to invalidate here it will synchronize on * against the special swap migration pte. */ + subpage =3D page; goto discard; } =20 --=20 2.20.1