]> www.infradead.org Git - users/jedix/linux-maple.git/commit
xen/pte: Fix crashes when trying to see non-existent PGD/PMD/PUD/PTEs
authorKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Thu, 3 May 2012 20:14:14 +0000 (16:14 -0400)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Mon, 7 May 2012 14:01:41 +0000 (10:01 -0400)
commite12676ff205b12743d84199eec0d45fa84eaf4cc
tree253ff6f8656d75caebbd2a8f42660ea1515e93db
parent6a46e7cf2869c50bb87a30a6ac2fa358d9aa1af4
xen/pte: Fix crashes when trying to see non-existent PGD/PMD/PUD/PTEs

If I try to do "cat /sys/kernel/debug/kernel_page_tables"
I end up with:

BUG: unable to handle kernel paging request at ffffc7fffffff000
IP: [<ffffffff8106aa51>] ptdump_show+0x221/0x480
PGD 0
Oops: 0000 [#1] SMP
CPU 0
.. snip..
RAX: 0000000000000000 RBX: ffffc00000000fff RCX: 0000000000000000
RDX: 0000800000000000 RSI: 0000000000000000 RDI: ffffc7fffffff000

which is due to the fact we are trying to access a PFN that is not
accessible to us. The reason (at least in this case) was that
PGD[256] is set to __HYPERVISOR_VIRT_START which setup (by the
hypervisor) to point to a read-only linear map of the MFN->PFN array.
During our parsing we would get the MFN (a valid one), try to look
it up in the MFN->PFN tree and find it invalid and return ~0 as PFN.
Then pte_mfn_to_pfn would happilly feed that in, attach the flags
and return it back to the caller. In this case the ptdump_show
bitshifts it and we get this invalid value.

Instead of doing all of that, we detect the ~0 case and just return
!_PAGE_PRESENT.

CC: stable@kernel.org
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
arch/x86/xen/mmu.c