From: Amit Daniel Kachhap amitdaniel.kachhap@arm.com
The MAP_GROWSDOWN flag is not supported by PCuABI specification. Hence, reject such requests with -EOPNOTSUPP error.
Signed-off-by: Amit Daniel Kachhap amitdaniel.kachhap@arm.com --- mm/mmap.c | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/mm/mmap.c b/mm/mmap.c index 1b8534de40fb..c1da5b13ec3c 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -1468,11 +1468,17 @@ user_uintptr_t ksys_mmap_pgoff(user_uintptr_t user_ptr, unsigned long len, * - The PCuABI reservation model introduces the concept of maximum * protection mappings can have. Add a check to make sure the * requested protection does not exceed the maximum protection. + * - MAP_GROWSDOWN mappings have no fixed bounds and hence are not + * supported in the PCuABI reservation model. */ if (reserv_is_supported(current->mm)) { if ((PROT_MAX_EXTRACT(prot) != 0) && ((PROT_EXTRACT(prot) & PROT_MAX_EXTRACT(prot)) != PROT_EXTRACT(prot))) goto out_fput; + if (flags & MAP_GROWSDOWN) { + retval = -EOPNOTSUPP; + goto out_fput; + } } retval = check_pcuabi_map_ptr_arg(user_ptr, len, flags & MAP_FIXED, false); if (retval)