From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753073AbcHXBi2 (ORCPT ); Tue, 23 Aug 2016 21:38:28 -0400 Received: from mail-bl2nam02on0105.outbound.protection.outlook.com ([104.47.38.105]:31872 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751861AbcHXBi1 (ORCPT ); Tue, 23 Aug 2016 21:38:27 -0400 From: "Kani, Toshimitsu" To: Dan Williams CC: "Mulumudi, Abhilash Kumar" , "linux-nvdimm@lists.01.org" , "ard.biesheuvel@linaro.org" , "linux-kernel@vger.kernel.org" , "akpm@linux-foundation.org" , "brian.starkey@arm.com" Subject: RE: [PATCH] memremap: Fix NULL pointer BUG in get_zone_device_page() Thread-Topic: [PATCH] memremap: Fix NULL pointer BUG in get_zone_device_page() Thread-Index: AQHR/W5ZePHh0bI7qkGTM3px2vEum6BXIayAgAAUw4CAABSFAIAACbhw Date: Wed, 24 Aug 2016 01:38:22 +0000 Message-ID: References: <1471977800-12688-1-git-send-email-toshi.kani@hpe.com> <1471996023.1532.6.camel@hpe.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=toshi.kani@hpe.com; x-originating-ip: [174.51.38.138] x-ms-office365-filtering-correlation-id: ef2156fa-dde6-4d90-3659-08d3cbbf55cf x-microsoft-exchange-diagnostics: 1;CS1PR84MB0006;6:rMg2MbD+0EDgdeLOKRB78wsA2Y7U00GIBQv5jU5FQ5+0I/4+i0s7tZ5iKNel7tZHC/6jKO+mDJkCTscQha0F6NqZE6/OHF5xFDGtnxNEMkF02A3ACFFh2SlmPdPmXsK4nOxkyfGAPi5hRj68xK5Nmtgd02s18YYoCKXdKSsmyuYrf4yIvF4D2TeDCSkiQrkBfxo0v5glBDn8AgJTlYLd8da7pytXbI/pr49ecXtqm2YC3bf63GWs7xbHVevGxYFnsmtXlG25qbgzL9CImcfBSf2dmZp9p7J6F6C51BnH09OLDNPHvo2AUL5BwGk0pZ+u1PGcCtLqu9zBIdEIXosH5g==;5:6njJyKoJzO/QEIJ+Qtee/Ks1bpzlkkrVv3L7bmy9tfZn2fMtd9yGmQhuMwzLqj4LRls3I/LJqUVhra24zDTsQq6dg5iHXc+nnpJwOqNf6t/ZwYAvbNBIR2LPP02gTNpvyCIEBJaJ4tbEOtbKg692qw==;24:eYa3Mn2kWZ1Zq0pr4Mw3Zkx3GOgvOCL58c9DpzA3yLU3Bjfnjtj7mxVGowuuEt7S0LXaAmMY93FjNatv2QzZtq+SmIurkU8sWZOr3tM8udE=;7:TBGxgi2wqLn02YADjlAmHrPveExD+KsJbQ2vRvaAJk9gq5cDqnQSe5KX6KgpanF19xzplIJT7m/bZQbcMM1HqFWqC3WTsfmuA8hsOXEtIXZVGVGJbiSAqfO1A/enlipazgsRohBR5zsnC24cKDb71o8sr1jy6rDN/ML/RidTUvcqozZFPBHuzmoT5B4Jwn5EtIj5EYu2RQ1DTvm3SxjqBUvkLf++CbF+E3qK1YuI2P+JUuBx8s7r5alkfN3EBFcQ x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CS1PR84MB0006; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(227479698468861); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040176)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6055026);SRVR:CS1PR84MB0006;BCL:0;PCL:0;RULEID:;SRVR:CS1PR84MB0006; x-forefront-prvs: 0044C17179 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(7916002)(199003)(189002)(377424004)(377454003)(24454002)(106356001)(19580395003)(93886004)(10400500002)(110136002)(76176999)(6116002)(3660700001)(8676002)(305945005)(7696003)(8936002)(81166006)(7846002)(54356999)(81156014)(5660300001)(5002640100001)(50986999)(4326007)(7736002)(86362001)(3280700002)(87936001)(105586002)(33656002)(122556002)(106116001)(2950100001)(9686002)(2900100001)(66066001)(586003)(99286002)(101416001)(68736007)(19580405001)(77096005)(102836003)(74316002)(97736004)(189998001)(2906002)(3846002)(92566002);DIR:OUT;SFP:1102;SCL:1;SRVR:CS1PR84MB0006;H:CS1PR84MB0005.NAMPRD84.PROD.OUTLOOK.COM;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 X-OriginatorOrg: hpe.com X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Aug 2016 01:38:22.6675 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 105b2061-b669-4b31-92ac-24d304d195dc X-MS-Exchange-Transport-CrossTenantHeadersStamped: CS1PR84MB0006 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id u7O1cWDY026986 > On Tue, Aug 23, 2016 at 4:47 PM, Kani, Toshimitsu > wrote: > > On Tue, 2016-08-23 at 15:32 -0700, Dan Williams wrote: > >> On Tue, Aug 23, 2016 at 11:43 AM, Toshi Kani > >> wrote: > > : > >> I'm not sure about this fix. The point of honoring > >> vmem_altmap_offset() is because a portion of the resource that is > >> passed to devm_memremap_pages() also contains the metadata info > block > >> for the device. The offset says "use everything past this point for > >> pages". This may work for avoiding a crash, but it may corrupt info > >> block metadata in the process. Can you provide more information > >> about the failing scenario to be sure that we are not triggering a > >> fault on an address that is not meant to have a page mapping? I.e. > >> what is the host physical address of the page that caused this fault, > >> and is it valid? > > > > The fault address in question was the 2nd page of an NVDIMM range. I > > assumed this fault address was valid and needed to be handled. Here is > > some info about the base and patched cases. Let me know if you need > > more info. > > > > Base > > ==== > > > > The following NVDIMM range was set to /dev/dax. > > > > /proc/iomem > > 480000000-87fffffff : Persistent Memory > > > > devm_memremap_pages() initialized struct page from 0x490200-0x87ffff. > > This seems like the start of the trouble. What happened to the first > 1GB of the address range? I'm assuming the 'align' attribute is set > to 2MB because we start at a pfn offset of 0x200, but this should be > starting at 0x480200. pfn_first() adds an offset from vmem_altmap_offset(), which is altmap->reserve + altmap->free. You can see why it ended up with this offset from the dumps in my previous email. Thanks -Toshi