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 6b034fb7b5b1..bad4b5da5b38 100644 --- a/mm/mprotect.c +++ b/mm/mprotect.c @@ -760,6 +760,8 @@ static int do_mprotect_pkey(user_uintptr_t usrptr, size_t len, #endif if (!capability_owns_range(usrptr, start, len)) return -EINVAL; + if (!capability_may_set_prot(usrptr, prot)) + return -EINVAL; if (!arch_validate_prot(prot, start)) return -EINVAL;