Revert "x86/mm: Limit mmap() of /dev/mem to valid physical addresses"
authorIngo Molnar <mingo@kernel.org>
Fri, 27 Oct 2017 08:03:13 +0000 (10:03 +0200)
committerIngo Molnar <mingo@kernel.org>
Fri, 27 Oct 2017 08:06:49 +0000 (10:06 +0200)
This reverts commit ce56a86e2ade45d052b3228cdfebe913a1ae7381.

There's unanticipated interaction with some boot parameters like 'mem=',
which now cause the new checks via valid_mmap_phys_addr_range() to be too
restrictive, crashing a Qemu bootup in fact, as reported by Fengguang Wu.

So while the motivation of the change is still entirely valid, we
need a few more rounds of testing to get it right - it's way too late
after -rc6, so revert it for now.

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Craig Bergstrom <craigb@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Luis R. Rodriguez <mcgrof@suse.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Toshi Kani <toshi.kani@hp.com>
Cc: dsafonov@virtuozzo.com
Cc: kirill.shutemov@linux.intel.com
Cc: mhocko@suse.com
Cc: oleg@redhat.com
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
arch/x86/include/asm/io.h
arch/x86/mm/mmap.c

index 322d25ae23ab0491ac631b859a62c569f6681615..c40a95c33bb8434c8b41641e57c38a79eeddb7ad 100644 (file)
@@ -110,10 +110,6 @@ build_mmio_write(__writeq, "q", unsigned long, "r", )
 
 #endif
 
-#define ARCH_HAS_VALID_PHYS_ADDR_RANGE
-extern int valid_phys_addr_range(phys_addr_t addr, size_t size);
-extern int valid_mmap_phys_addr_range(unsigned long pfn, size_t size);
-
 /**
  *     virt_to_phys    -       map virtual addresses to physical
  *     @address: address to remap
index 320c6237e1d1d462da274b84bba914c11a4b7b6e..a9967982684649155cfcdc921d5247c8fbfe70d6 100644 (file)
@@ -174,15 +174,3 @@ const char *arch_vma_name(struct vm_area_struct *vma)
                return "[mpx]";
        return NULL;
 }
-
-int valid_phys_addr_range(phys_addr_t addr, size_t count)
-{
-       return addr + count <= __pa(high_memory);
-}
-
-int valid_mmap_phys_addr_range(unsigned long pfn, size_t count)
-{
-       phys_addr_t addr = (phys_addr_t)pfn << PAGE_SHIFT;
-
-       return valid_phys_addr_range(addr, count);
-}