Skip to content

Commit

Permalink
userns: Convert setting and getting uid and gid system calls to use k…
Browse files Browse the repository at this point in the history
…uid and kgid

Convert setregid, setgid, setreuid, setuid,
setresuid, getresuid, setresgid, getresgid, setfsuid, setfsgid,
getuid, geteuid, getgid, getegid,
waitpid, waitid, wait4.

Convert userspace uids and gids into kuids and kgids before
being placed on struct cred.  Convert struct cred kuids and
kgids into userspace uids and gids when returning them.

Signed-off-by: Eric W. Biederman <[email protected]>
  • Loading branch information
ebiederm committed May 3, 2012
1 parent 18815a1 commit a29c33f
Show file tree
Hide file tree
Showing 4 changed files with 178 additions and 86 deletions.
6 changes: 3 additions & 3 deletions kernel/exit.c
Original file line number Diff line number Diff line change
Expand Up @@ -1214,7 +1214,7 @@ static int wait_task_zombie(struct wait_opts *wo, struct task_struct *p)
unsigned long state;
int retval, status, traced;
pid_t pid = task_pid_vnr(p);
uid_t uid = __task_cred(p)->uid;
uid_t uid = from_kuid_munged(current_user_ns(), __task_cred(p)->uid);
struct siginfo __user *infop;

if (!likely(wo->wo_flags & WEXITED))
Expand Down Expand Up @@ -1427,7 +1427,7 @@ static int wait_task_stopped(struct wait_opts *wo,
if (!unlikely(wo->wo_flags & WNOWAIT))
*p_code = 0;

uid = task_uid(p);
uid = from_kuid_munged(current_user_ns(), __task_cred(p)->uid);
unlock_sig:
spin_unlock_irq(&p->sighand->siglock);
if (!exit_code)
Expand Down Expand Up @@ -1500,7 +1500,7 @@ static int wait_task_continued(struct wait_opts *wo, struct task_struct *p)
}
if (!unlikely(wo->wo_flags & WNOWAIT))
p->signal->flags &= ~SIGNAL_STOP_CONTINUED;
uid = task_uid(p);
uid = from_kuid_munged(current_user_ns(), __task_cred(p)->uid);
spin_unlock_irq(&p->sighand->siglock);

pid = task_pid_vnr(p);
Expand Down
Loading

0 comments on commit a29c33f

Please sign in to comment.