powerpc/64s/hash: Fix 128TB-512TB virtual address boundary case allocation
authorNicholas Piggin <npiggin@gmail.com>
Thu, 9 Nov 2017 17:27:36 +0000 (04:27 +1100)
committerMichael Ellerman <mpe@ellerman.id.au>
Mon, 13 Nov 2017 12:34:19 +0000 (23:34 +1100)
commit6a72dc038b615229a1b285829d6c8378d15c2347
tree3258a738aae36b3dc5aab119ead8e11706191751
parent7ece370996b694ae263025e056ad785afc1be5ab
powerpc/64s/hash: Fix 128TB-512TB virtual address boundary case allocation

When allocating VA space with a hint that crosses 128TB, the SLB
addr_limit variable is not expanded if addr is not > 128TB, but the
slice allocation looks at task_size, which is 512TB. This results in
slice_check_fit() incorrectly succeeding because the slice_count
truncates off bit 128 of the requested mask, so the comparison to the
available mask succeeds.

Fix this by using mm->context.addr_limit instead of mm->task_size for
testing allocation limits. This causes such allocations to fail.

Fixes: f4ea6dcb08ea ("powerpc/mm: Enable mappings above 128TB")
Cc: stable@vger.kernel.org # v4.12+
Reported-by: Florian Weimer <fweimer@redhat.com>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/mm/slice.c