mm/pagewalk.c: walk_page_range should avoid VM_PFNMAP areas
A panic can be caused by simply cat'ing /proc/<pid>/smaps while an
application has a VM_PFNMAP range. It happened in-house when a
benchmarker was trying to decipher the memory layout of his program.
/proc/<pid>/smaps and similar walks through a user page table should not
be looking at VM_PFNMAP areas.
Certain tests in walk_page_range() (specifically split_huge_page_pmd())
assume that all the mapped PFN's are backed with page structures. And
this is not usually true for VM_PFNMAP areas. This can result in panics
on kernel page faults when attempting to address those page structures.
There are a half dozen callers of walk_page_range() that walk through a
task's entire page table (as N. Horiguchi pointed out). So rather than
change all of them, this patch changes just walk_page_range() to ignore
The logic of hugetlb_vma() is moved back into walk_page_range(), as we
want to test any vma in the range.
VM_PFNMAP areas are used by:
- graphics memory manager gpu/drm/drm_gem.c
- global reference unit sgi-gru/grufile.c
- sgi special memory char/mspec.c
- and probably several out-of-tree modules
[email@example.com: remove now-unused hugetlb_vma() stub]
Signed-off-by: Cliff Wickman <firstname.lastname@example.org>
Reviewed-by: Naoya Horiguchi <email@example.com>
Cc: Mel Gorman <firstname.lastname@example.org>
Cc: Andrea Arcangeli <email@example.com>
Cc: Dave Hansen <firstname.lastname@example.org>
Cc: David Sterba <email@example.com>
Cc: Johannes Weiner <firstname.lastname@example.org>
Cc: KOSAKI Motohiro <email@example.com>
Cc: "Kirill A. Shutemov" <firstname.lastname@example.org>
Signed-off-by: Andrew Morton <email@example.com>
Signed-off-by: Linus Torvalds <firstname.lastname@example.org>
1 file changed