Check that the requested permission matches the constraints of input user capability address for mprotect syscall.
Signed-off-by: Amit Daniel Kachhap amitdaniel.kachhap@arm.com --- mm/mprotect.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/mm/mprotect.c b/mm/mprotect.c index c99f795b51b8..1e9a6b5442e8 100644 --- a/mm/mprotect.c +++ b/mm/mprotect.c @@ -706,6 +706,8 @@ static int do_mprotect_pkey(user_uintptr_t user_ptr, size_t len,
if (!check_user_ptr_owning(user_ptr, start, len)) return -EINVAL; + if (!user_ptr_may_set_prot(user_ptr, prot)) + return -EINVAL; if (!arch_validate_prot(prot, start)) return -EINVAL;