x86/mm: Check if PUD is large when validating a kernel address
A user reported the following oops when a backup process reads
BUG: unable to handle kernel paging request at ffffbb00ff33b000
IP: [<ffffffff8103157e>] kern_addr_valid+0xbe/0x110
Investigation determined that the bug triggered when reading
system RAM at the 4G mark. On this system, that was the first
address using 1G pages for the virt->phys direct mapping so the
PUD is pointing to a physical address, not a PMD page.
The problem is that the page table walker in kern_addr_valid() is
not checking pud_large() and treats the physical address as if
it was a PMD. If it happens to look like pmd_none then it'll
silently fail, probably returning zeros instead of real data. If
the data happens to look like a present PMD though, it will be
walked resulting in the oops above.
This patch adds the necessary pud_large() check.
Unfortunately the problem was not readily reproducible and now
they are running the backup program without accessing
/proc/kcore so the patch has not been validated but I think it
Signed-off-by: Mel Gorman <firstname.lastname@example.org>
Reviewed-by: Rik van Riel <email@example.comM>
Reviewed-by: Michal Hocko <firstname.lastname@example.org>
Acked-by: Johannes Weiner <email@example.com>
Signed-off-by: Ingo Molnar <firstname.lastname@example.org>
2 files changed