Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6: deal with races in /proc/*/{syscall,stack,personality} proc: enable writing to /proc/pid/mem proc: make check_mem_permission() return an mm_struct on success proc: hold cred_guard_mutex in check_mem_permission() proc: disable mem_write after exec mm: implement access_remote_vm mm: factor out main logic of access_process_vm mm: use mm_struct to resolve gate vma's in __get_user_pages mm: arch: rename in_gate_area_no_task to in_gate_area_no_mm mm: arch: make in_gate_area take an mm_struct instead of a task_struct mm: arch: make get_gate_vma take an mm_struct instead of a task_struct x86: mark associated mm when running a task in 32 bit compatibility mode x86: add context tag to mark mm when running a task in 32-bit compatibility mode auxv: require the target to be tracable (or yourself) close race in /proc/*/environ report errors in /proc/*/*map* sanely pagemap: close races with suid execve make sessionid permissions in /proc/*/task/* match those in /proc/* fix leaks in path_lookupat() Fix up trivial conflicts in fs/proc/base.c
This commit is contained in:
@ -121,14 +121,14 @@ static void *m_start(struct seq_file *m, loff_t *pos)
|
||||
|
||||
priv->task = get_pid_task(priv->pid, PIDTYPE_PID);
|
||||
if (!priv->task)
|
||||
return NULL;
|
||||
return ERR_PTR(-ESRCH);
|
||||
|
||||
mm = mm_for_maps(priv->task);
|
||||
if (!mm)
|
||||
return NULL;
|
||||
if (!mm || IS_ERR(mm))
|
||||
return mm;
|
||||
down_read(&mm->mmap_sem);
|
||||
|
||||
tail_vma = get_gate_vma(priv->task);
|
||||
tail_vma = get_gate_vma(priv->task->mm);
|
||||
priv->tail_vma = tail_vma;
|
||||
|
||||
/* Start with last addr hint */
|
||||
@ -279,7 +279,8 @@ static int show_map(struct seq_file *m, void *v)
|
||||
show_map_vma(m, vma);
|
||||
|
||||
if (m->count < m->size) /* vma is copied successfully */
|
||||
m->version = (vma != get_gate_vma(task))? vma->vm_start: 0;
|
||||
m->version = (vma != get_gate_vma(task->mm))
|
||||
? vma->vm_start : 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -468,7 +469,8 @@ static int show_smap(struct seq_file *m, void *v)
|
||||
(unsigned long)(mss.pss >> (10 + PSS_SHIFT)) : 0);
|
||||
|
||||
if (m->count < m->size) /* vma is copied successfully */
|
||||
m->version = (vma != get_gate_vma(task)) ? vma->vm_start : 0;
|
||||
m->version = (vma != get_gate_vma(task->mm))
|
||||
? vma->vm_start : 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -764,8 +766,9 @@ static ssize_t pagemap_read(struct file *file, char __user *buf,
|
||||
if (!task)
|
||||
goto out;
|
||||
|
||||
ret = -EACCES;
|
||||
if (!ptrace_may_access(task, PTRACE_MODE_READ))
|
||||
mm = mm_for_maps(task);
|
||||
ret = PTR_ERR(mm);
|
||||
if (!mm || IS_ERR(mm))
|
||||
goto out_task;
|
||||
|
||||
ret = -EINVAL;
|
||||
@ -778,10 +781,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