pagemap: close races with suid execve
just use mm_for_maps() Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
@@ -729,7 +729,8 @@ static ssize_t pagemap_read(struct file *file, char __user *buf,
|
||||
goto out;
|
||||
|
||||
ret = -EACCES;
|
||||
if (!ptrace_may_access(task, PTRACE_MODE_READ))
|
||||
mm = mm_for_maps(task);
|
||||
if (!mm)
|
||||
goto out_task;
|
||||
|
||||
ret = -EINVAL;
|
||||
@@ -742,10 +743,6 @@ static ssize_t pagemap_read(struct file *file, char __user *buf,
|
||||
if (!count)
|
||||
goto out_task;
|
||||
|
||||
mm = get_task_mm(task);
|
||||
if (!mm)
|
||||
goto out_task;
|
||||
|
||||
pm.len = PM_ENTRY_BYTES * (PAGEMAP_WALK_SIZE >> PAGE_SHIFT);
|
||||
pm.buffer = kmalloc(pm.len, GFP_TEMPORARY);
|
||||
ret = -ENOMEM;
|
||||
|
Reference in New Issue
Block a user