]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
powerpc/mm/hash64: Zero PGD pages on allocation
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Tue, 13 Feb 2018 11:09:33 +0000 (16:39 +0530)
committerMichael Ellerman <mpe@ellerman.id.au>
Tue, 13 Feb 2018 11:37:48 +0000 (22:37 +1100)
commitfc5c2f4a55a2c258e12013cdf287cf266dbcd2a7
treee731a8d68592ba682bad8e43b074410f124354c1
parentff31e105464d8c8c973019646827020aed9c2d9f
powerpc/mm/hash64: Zero PGD pages on allocation

On powerpc we allocate page table pages from slab caches of different
sizes. Currently we have a constructor that zeroes out the objects when
we allocate them for the first time.

We expect the objects to be zeroed out when we free the the object
back to slab cache. This happens in the unmap path. For hugetlb pages
we call huge_pte_get_and_clear() to do that.

With the current configuration of page table size, both PUD and PGD
level tables are allocated from the same slab cache. At the PUD level,
we use the second half of the table to store the slot information. But
we never clear that when unmapping.

When such a freed object is then allocated for a PGD page, the second
half of the page table page will not be zeroed as expected. This
results in a kernel crash.

Fix it by always clearing PGD pages when they're allocated.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
[mpe: Change log wording and formatting, add whitespace]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/include/asm/book3s/64/pgalloc.h