[PATCH] mm: relax ptrace mode in process_vm_readv(2)

From: Alexey Dobriyan
Date: Sat Mar 03 2018 - 15:11:29 EST


It is more natural to check for read-from-memory permissions in case of
process_vm_readv() as PTRACE_MODE_ATTACH is equivalent to write
permissions.

Signed-off-by: Alexey Dobriyan <adobriyan@xxxxxxxxx>
---

mm/process_vm_access.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- a/mm/process_vm_access.c
+++ b/mm/process_vm_access.c
@@ -204,7 +204,7 @@ static ssize_t process_vm_rw_core(pid_t pid, struct iov_iter *iter,
goto free_proc_pages;
}

- mm = mm_access(task, PTRACE_MODE_ATTACH_REALCREDS);
+ mm = mm_access(task, vm_write ? PTRACE_MODE_ATTACH_REALCREDS : PTRACE_MODE_READ_REALCREDS);
if (!mm || IS_ERR(mm)) {
rc = IS_ERR(mm) ? PTR_ERR(mm) : -ESRCH;
/*