From 68eb94f16227336a5773b83ecfa8290f1d6b78ce Mon Sep 17 00:00:00 2001 From: "Eric W. Biederman" Date: Tue, 3 Jan 2017 10:23:11 +1300 Subject: proc: Better ownership of files for non-dumpable tasks in user namespaces Instead of making the files owned by the GLOBAL_ROOT_USER. Make non-dumpable files whose mm has always lived in a user namespace owned by the user namespace root. This allows the container root to have things work as expected in a container. Signed-off-by: "Eric W. Biederman" --- fs/proc/internal.h | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) (limited to 'fs/proc/internal.h') diff --git a/fs/proc/internal.h b/fs/proc/internal.h index 2de5194ba378..e2c3c461fa20 100644 --- a/fs/proc/internal.h +++ b/fs/proc/internal.h @@ -97,20 +97,8 @@ static inline struct task_struct *get_proc_task(struct inode *inode) return get_pid_task(proc_pid(inode), PIDTYPE_PID); } -static inline int task_dumpable(struct task_struct *task) -{ - int dumpable = 0; - struct mm_struct *mm; - - task_lock(task); - mm = task->mm; - if (mm) - dumpable = get_dumpable(mm); - task_unlock(task); - if (dumpable == SUID_DUMP_USER) - return 1; - return 0; -} +void task_dump_owner(struct task_struct *task, mode_t mode, + kuid_t *ruid, kgid_t *rgid); static inline unsigned name_to_int(const struct qstr *qstr) { -- cgit v1.2.3