Skip to content

Commit

Permalink
Revert "x86/mm: Limit mmap() of /dev/mem to valid physical addresses"
Browse files Browse the repository at this point in the history
This reverts commit ce56a86.

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 <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
Acked-by: Craig Bergstrom <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: Andy Lutomirski <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: Brian Gerst <[email protected]>
Cc: Denys Vlasenko <[email protected]>
Cc: H. Peter Anvin <[email protected]>
Cc: Josh Poimboeuf <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Luis R. Rodriguez <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Toshi Kani <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Ingo Molnar <[email protected]>
  • Loading branch information
Ingo Molnar committed Oct 27, 2017
1 parent 58c3862 commit 90edaac
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 16 deletions.
4 changes: 0 additions & 4 deletions arch/x86/include/asm/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 0 additions & 12 deletions arch/x86/mm/mmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

0 comments on commit 90edaac

Please sign in to comment.