Permission to access /proc/<pid>/numa_vamaps file should be governed by PTRACE_READ_REALCREADS check to restrict getting specific VA range to numa node mapping information. Signed-off-by: Prakash Sangappa <prakash.sangappa@xxxxxxxxxx> Reviewed-by: Steve Sistare <steven.sistare@xxxxxxxxxx> --- fs/proc/base.c | 4 +++- fs/proc/task_mmu.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/proc/base.c b/fs/proc/base.c index 1af99ae..3c19a55 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -745,7 +745,9 @@ struct mm_struct *proc_mem_open(struct inode *inode, unsigned int mode) struct mm_struct *mm = ERR_PTR(-ESRCH); if (task) { - mm = mm_access(task, mode | PTRACE_MODE_FSCREDS); + if (!(mode & PTRACE_MODE_REALCREDS)) + mode |= PTRACE_MODE_FSCREDS; + mm = mm_access(task, mode); put_task_struct(task); if (!IS_ERR_OR_NULL(mm)) { diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 93dce46..30b29d2 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -2043,7 +2043,7 @@ static int numa_vamaps_open(struct inode *inode, struct file *file) if (!nvm) return -ENOMEM; - mm = proc_mem_open(inode, PTRACE_MODE_READ); + mm = proc_mem_open(inode, PTRACE_MODE_READ | PTRACE_MODE_REALCREDS); if (IS_ERR(mm)) { kfree(nvm); return PTR_ERR(mm); -- 2.7.4