linux/arch/powerpc
Aneesh Kumar K.V 6cf5f631ba powerpc/hugetlb: Handle mmap_min_addr correctly in get_unmapped_area callback
[ Upstream commit 5330367fa3 ]

After we ALIGN up the address we need to make sure we didn't overflow
and resulted in zero address. In that case, we need to make sure that
the returned address is greater than mmap_min_addr.

This fixes selftest va_128TBswitch --run-hugetlb reporting failures when
run as non root user for

mmap(-1, MAP_HUGETLB)

The bug is that a non-root user requesting address -1 will be given address 0
which will then fail, whereas they should have been given something else that
would have succeeded.

We also avoid the first mmap(-1, MAP_HUGETLB) returning NULL address as mmap address
with this change. So we think this is not a security issue, because it only affects
whether we choose an address below mmap_min_addr, not whether we
actually allow that address to be mapped. ie. there are existing capability
checks to prevent a user mapping below mmap_min_addr and those will still be
honoured even without this fix.

Fixes: 484837601d ("powerpc/mm: Add radix support for hugetlb")
Reviewed-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-04-05 22:33:02 +02:00
..
boot powerpc/boot: Set target when cross-compiling for clang 2019-01-13 09:51:05 +01:00
configs powerpc updates for 4.19 2018-08-17 11:32:50 -07:00
crypto powerpc updates for 4.19 2018-08-17 11:32:50 -07:00
include powerpc: bpf: Fix generation of load/store DW instructions 2019-04-03 06:26:21 +02:00
kernel powerpc/security: Fix spectre_v2 reporting 2019-04-03 06:26:20 +02:00
kvm powerpc/fsl: Flush branch predictor when entering KVM 2019-04-03 06:26:20 +02:00
lib powerpc/64: Fix memcmp reading past the end of src/dest 2019-04-03 06:26:29 +02:00
math-emu
mm powerpc/hugetlb: Handle mmap_min_addr correctly in get_unmapped_area callback 2019-04-05 22:33:02 +02:00
net powerpc: bpf: Fix generation of load/store DW instructions 2019-04-03 06:26:21 +02:00
oprofile treewide: kzalloc() -> kcalloc() 2018-06-12 16:19:22 -07:00
perf powerpc/perf: Fix thresholding counter data for unknown type 2019-02-12 19:47:14 +01:00
platforms powerpc/powernv/ioda: Fix locked_vm counting for memory used by IOMMU tables 2019-04-05 22:33:01 +02:00
purgatory powerpc updates for 4.19 2018-08-17 11:32:50 -07:00
sysdev treewide: correct "differenciate" and "instanciate" typos 2018-08-23 18:48:43 -07:00
tools powerpc: Add a checkpatch wrapper with our preferred settings 2018-08-07 21:49:25 +10:00
xmon powerpc/xmon: Fix opcode being uninitialized in print_insn_powerpc 2019-04-05 22:33:01 +02:00
Kconfig powerpc: disable support for relative ksymtab references 2018-08-29 16:12:07 -07:00
Kconfig.debug Kconfig: consolidate the "Kernel hacking" menu 2018-08-02 08:06:48 +09:00
Makefile powerpc: avoid -mno-sched-epilog on GCC 4.9 and newer 2019-01-13 09:51:05 +01:00
Makefile.postlink