OSDN Git Service

powerpc/64s/hash: Fix fork() with 512TB process address space
authorNicholas Piggin <npiggin@gmail.com>
Thu, 9 Nov 2017 17:27:37 +0000 (04:27 +1100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 30 Nov 2017 08:40:57 +0000 (08:40 +0000)
commit34c8d3ffb64883b9279c03e79c1b08c9a1931940
tree8159d688ef91561d4f3bab89c8294368ed31c773
parent2279e9c895778cc8942b82e6e9fa153d5024acc2
powerpc/64s/hash: Fix fork() with 512TB process address space

commit effc1b25088502fbd30305c79773de2d1f7470a6 upstream.

Hash unconditionally resets the addr_limit to default (128TB) when the
mm context is initialised. If a process has > 128TB mappings when it
forks, the child will not get the 512TB addr_limit, so accesses to
valid > 128TB mappings will fail in the child.

Fix this by only resetting the addr_limit to default if it was 0. Non
zero indicates it was duplicated from the parent (0 means exec()).

Fixes: f4ea6dcb08ea ("powerpc/mm: Enable mappings above 128TB")
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/powerpc/mm/mmu_context_book3s64.c