From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1423247AbcBQR6V (ORCPT ); Wed, 17 Feb 2016 12:58:21 -0500 Received: from mail-yw0-f170.google.com ([209.85.161.170]:32983 "EHLO mail-yw0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1423166AbcBQR6T (ORCPT ); Wed, 17 Feb 2016 12:58:19 -0500 MIME-Version: 1.0 In-Reply-To: <1455069975-14291-1-git-send-email-toshi.kani@hpe.com> References: <1455069975-14291-1-git-send-email-toshi.kani@hpe.com> Date: Wed, 17 Feb 2016 09:58:17 -0800 Message-ID: Subject: Re: [PATCH] x86/mm: Add x86 valid_phys_addr_range() for /dev/mem From: Dan Williams To: Toshi Kani Cc: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Borislav Petkov , "linux-nvdimm@lists.01.org" , X86 ML , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 9, 2016 at 6:06 PM, Toshi Kani wrote: > x86 does not define ARCH_HAS_VALID_PHYS_ADDR_RANGE, which > leads /dev/mem to use the default valid_phys_addr_range() > and valid_mmap_phys_addr_range() in drivers/char/mem.c. > > The default valid_phys_addr_range() allows any range lower > than __pa(high_memory), which is the end of system RAM, and > disallows any range higher than it. > > Persistent memory may be located at lower and/or higher > address of __pa(high_memory) depending on their memory slots. > When using crash(8) via /dev/mem for analyzing data in > persistent memory, it can only access to the one lower than > __pa(high_memory). > > Add x86 valid_phys_addr_range() and valid_mmap_phys_addr_range() > to provide better checking: > - Physical address range is valid when it is fully backed by > IORESOURCE_MEM, regardless of __pa(high_memory). > - Other ranges, including holes, are invalid. > > This also allows crash(8) to access persistent memory ranges > via /dev/mem (with a minor change to remove high_memory check > from crash itself). If we're modifying crash(8) can't we also teach it to mmap /dev/pmemX directly? With commit 90a545e98126 "restrict /dev/mem to idle io memory ranges" /dev/mem should not have access to active pmem ranges.