]> git.baikalelectronics.ru Git - kernel.git/commit
powerpc/mm: Fix potential access to freed pages when using hugetlbfs
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>
Mon, 15 Jun 2009 16:53:43 +0000 (16:53 +0000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Fri, 26 Jun 2009 06:55:36 +0000 (16:55 +1000)
commit948fce81c71f9c4ac0653d34b8c768c9833373c9
treec8ef820f92601b01ed5b90e840ed5123e51dfa0f
parentbf71fd7f764d01cf98a3012ee3ee9f2088172be9
powerpc/mm: Fix potential access to freed pages when using hugetlbfs

When using 64k page sizes, our PTE pages are split in two halves,
the second half containing the "extension" used to keep track of
individual 4k pages when not using HW 64k pages.

However, our page tables used for hugetlb have a slightly different
format and don't carry that "second half".

Our code that batched PTEs to be invalidated unconditionally reads
the "second half" (to put it into the batch), which means that when
called to invalidate hugetlb PTEs, it will access unrelated memory.

It breaks when CONFIG_DEBUG_PAGEALLOC is enabled.

This fixes it by only accessing the second half when the _PAGE_COMBO
bit is set in the first half, which indicates that we are dealing with
a "combo" page which represents 16x4k subpages. Anything else shouldn't
have this bit set and thus not require loading from the second half.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/include/asm/pte-hash64-64k.h