提交 26947f8c 编写于 作者: S Stephen Wilson 提交者: Al Viro

proc: disable mem_write after exec

This change makes mem_write() observe the same constraints as mem_read().  This
is particularly important for mem_write as an accidental leak of the fd across
an exec could result in arbitrary modification of the target process' memory.
IOW, /proc/pid/mem is implicitly close-on-exec.
Signed-off-by: NStephen Wilson <wilsons@start.ca>
Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
上级 5ddd36b9
......@@ -850,6 +850,10 @@ static ssize_t mem_write(struct file * file, const char __user *buf,
if (check_mem_permission(task))
goto out;
copied = -EIO;
if (file->private_data != (void *)((long)current->self_exec_id))
goto out;
copied = -ENOMEM;
page = (char *)__get_free_page(GFP_TEMPORARY);
if (!page)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册