Check that the requested permission matches the constraints of input user capability address for mprotect syscall.
Signed-off-by: Amit Daniel Kachhap amit.kachhap@arm.com --- mm/mprotect.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/mm/mprotect.c b/mm/mprotect.c index 5cefc65b5dbd..f2c06967451d 100644 --- a/mm/mprotect.c +++ b/mm/mprotect.c @@ -760,6 +760,8 @@ static int do_mprotect_pkey(user_uintptr_t user_start, size_t len, #endif if (!capability_owns_range(user_start, start, len)) return -EINVAL; + if (!capability_may_set_prot(user_start, prot)) + return -EINVAL; if (!arch_validate_prot(prot, start)) return -EINVAL;