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 | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/mm/mmap.c b/mm/mmap.c index 95d16e306559..6b66e94f0dfb 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -1473,6 +1473,15 @@ user_uintptr_t ksys_mmap_pgoff(user_uintptr_t usrptr, unsigned long len, #ifdef CONFIG_CHERI_PURECAP_UABI if (!test_bit(MMF_PCUABI_RESERVE, ¤t->mm->flags)) goto skip_pcuabi_checks; + /* + * Introduce checks for PCuABI: + * - MAP_GROWSDOWN flag do not have fixed bounds and hence not + * supported in PCuABI reservation model. + */ + if (flags & MAP_GROWSDOWN) { + retval = -EOPNOTSUPP; + goto out_fput; + } if (cheri_tag_get(usrptr)) { if (!(flags & MAP_FIXED) || !capability_owns_range(usrptr, addr, len)) goto out_fput;