Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 71459
b: refs/heads/master
c: b488893
h: refs/heads/master
i:
  71457: d1c13ca
  71455: 33084fd
v: v3
  • Loading branch information
Pavel Emelyanov authored and Linus Torvalds committed Oct 19, 2007
1 parent 3fc29c7 commit 0061672
Show file tree
Hide file tree
Showing 33 changed files with 242 additions and 145 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3eb07c8c8adb6f0572baba844ba2d9e501654316
refs/heads/master: b488893a390edfe027bae7a46e9af8083e740668
4 changes: 2 additions & 2 deletions trunk/arch/ia64/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ ia64_rt_sigreturn (struct sigscratch *scr)
si.si_signo = SIGSEGV;
si.si_errno = 0;
si.si_code = SI_KERNEL;
si.si_pid = current->pid;
si.si_pid = task_pid_vnr(current);
si.si_uid = current->uid;
si.si_addr = sc;
force_sig_info(SIGSEGV, &si, current);
Expand Down Expand Up @@ -332,7 +332,7 @@ force_sigsegv_info (int sig, void __user *addr)
si.si_signo = SIGSEGV;
si.si_errno = 0;
si.si_code = SI_KERNEL;
si.si_pid = current->pid;
si.si_pid = task_pid_vnr(current);
si.si_uid = current->uid;
si.si_addr = addr;
force_sig_info(SIGSEGV, &si, current);
Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/parisc/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ sys_rt_sigreturn(struct pt_regs *regs, int in_syscall)
si.si_signo = SIGSEGV;
si.si_errno = 0;
si.si_code = SI_KERNEL;
si.si_pid = current->pid;
si.si_pid = task_pid_vnr(current);
si.si_uid = current->uid;
si.si_addr = &frame->uc;
force_sig_info(SIGSEGV, &si, current);
Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/sparc/kernel/sys_sunos.c
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,7 @@ asmlinkage int sunos_killpg(int pgrp, int sig)
rcu_read_lock();
ret = -EINVAL;
if (pgrp > 0)
ret = kill_pgrp(find_pid(pgrp), sig, 0);
ret = kill_pgrp(find_vpid(pgrp), sig, 0);
rcu_read_unlock();

return ret;
Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/sparc64/kernel/sys_sunos32.c
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,7 @@ asmlinkage int sunos_killpg(int pgrp, int sig)
rcu_read_lock();
ret = -EINVAL;
if (pgrp > 0)
ret = kill_pgrp(find_pid(pgrp), sig, 0);
ret = kill_pgrp(find_vpid(pgrp), sig, 0);
rcu_read_unlock();

return ret;
Expand Down
7 changes: 4 additions & 3 deletions trunk/drivers/char/tty_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
#include <linux/selection.h>

#include <linux/kmod.h>
#include <linux/nsproxy.h>

#undef TTY_DEBUG_HANGUP

Expand Down Expand Up @@ -3107,7 +3108,7 @@ static int tiocgpgrp(struct tty_struct *tty, struct tty_struct *real_tty, pid_t
*/
if (tty == real_tty && current->signal->tty != real_tty)
return -ENOTTY;
return put_user(pid_nr(real_tty->pgrp), p);
return put_user(pid_vnr(real_tty->pgrp), p);
}

/**
Expand Down Expand Up @@ -3141,7 +3142,7 @@ static int tiocspgrp(struct tty_struct *tty, struct tty_struct *real_tty, pid_t
if (pgrp_nr < 0)
return -EINVAL;
rcu_read_lock();
pgrp = find_pid(pgrp_nr);
pgrp = find_vpid(pgrp_nr);
retval = -ESRCH;
if (!pgrp)
goto out_unlock;
Expand Down Expand Up @@ -3178,7 +3179,7 @@ static int tiocgsid(struct tty_struct *tty, struct tty_struct *real_tty, pid_t _
return -ENOTTY;
if (!real_tty->session)
return -ENOTTY;
return put_user(pid_nr(real_tty->session), p);
return put_user(pid_vnr(real_tty->session), p);
}

/**
Expand Down
16 changes: 8 additions & 8 deletions trunk/fs/binfmt_elf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1383,10 +1383,10 @@ static void fill_prstatus(struct elf_prstatus *prstatus,
prstatus->pr_info.si_signo = prstatus->pr_cursig = signr;
prstatus->pr_sigpend = p->pending.signal.sig[0];
prstatus->pr_sighold = p->blocked.sig[0];
prstatus->pr_pid = p->pid;
prstatus->pr_ppid = p->parent->pid;
prstatus->pr_pgrp = task_pgrp_nr(p);
prstatus->pr_sid = task_session_nr(p);
prstatus->pr_pid = task_pid_vnr(p);
prstatus->pr_ppid = task_pid_vnr(p->parent);
prstatus->pr_pgrp = task_pgrp_vnr(p);
prstatus->pr_sid = task_session_vnr(p);
if (thread_group_leader(p)) {
/*
* This is the record for the group leader. Add in the
Expand Down Expand Up @@ -1429,10 +1429,10 @@ static int fill_psinfo(struct elf_prpsinfo *psinfo, struct task_struct *p,
psinfo->pr_psargs[i] = ' ';
psinfo->pr_psargs[len] = 0;

psinfo->pr_pid = p->pid;
psinfo->pr_ppid = p->parent->pid;
psinfo->pr_pgrp = task_pgrp_nr(p);
psinfo->pr_sid = task_session_nr(p);
psinfo->pr_pid = task_pid_vnr(p);
psinfo->pr_ppid = task_pid_vnr(p->parent);
psinfo->pr_pgrp = task_pgrp_vnr(p);
psinfo->pr_sid = task_session_vnr(p);

i = p->state ? ffz(~p->state) + 1 : 0;
psinfo->pr_state = i;
Expand Down
16 changes: 8 additions & 8 deletions trunk/fs/binfmt_elf_fdpic.c
Original file line number Diff line number Diff line change
Expand Up @@ -1342,10 +1342,10 @@ static void fill_prstatus(struct elf_prstatus *prstatus,
prstatus->pr_info.si_signo = prstatus->pr_cursig = signr;
prstatus->pr_sigpend = p->pending.signal.sig[0];
prstatus->pr_sighold = p->blocked.sig[0];
prstatus->pr_pid = p->pid;
prstatus->pr_ppid = p->parent->pid;
prstatus->pr_pgrp = task_pgrp_nr(p);
prstatus->pr_sid = task_session_nr(p);
prstatus->pr_pid = task_pid_vnr(p);
prstatus->pr_ppid = task_pid_vnr(p->parent);
prstatus->pr_pgrp = task_pgrp_vnr(p);
prstatus->pr_sid = task_session_vnr(p);
if (thread_group_leader(p)) {
/*
* This is the record for the group leader. Add in the
Expand Down Expand Up @@ -1391,10 +1391,10 @@ static int fill_psinfo(struct elf_prpsinfo *psinfo, struct task_struct *p,
psinfo->pr_psargs[i] = ' ';
psinfo->pr_psargs[len] = 0;

psinfo->pr_pid = p->pid;
psinfo->pr_ppid = p->parent->pid;
psinfo->pr_pgrp = task_pgrp_nr(p);
psinfo->pr_sid = task_session_nr(p);
psinfo->pr_pid = task_pid_vnr(p);
psinfo->pr_ppid = task_pid_vnr(p->parent);
psinfo->pr_pgrp = task_pgrp_vnr(p);
psinfo->pr_sid = task_session_vnr(p);

i = p->state ? ffz(~p->state) + 1 : 0;
psinfo->pr_state = i;
Expand Down
4 changes: 2 additions & 2 deletions trunk/fs/exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -1433,7 +1433,7 @@ static int format_corename(char *corename, const char *pattern, long signr)
case 'p':
pid_in_pattern = 1;
rc = snprintf(out_ptr, out_end - out_ptr,
"%d", current->tgid);
"%d", task_tgid_vnr(current));
if (rc > out_end - out_ptr)
goto out;
out_ptr += rc;
Expand Down Expand Up @@ -1513,7 +1513,7 @@ static int format_corename(char *corename, const char *pattern, long signr)
if (!ispipe && !pid_in_pattern
&& (core_uses_pid || atomic_read(&current->mm->mm_users) != 1)) {
rc = snprintf(out_ptr, out_end - out_ptr,
".%d", current->tgid);
".%d", task_tgid_vnr(current));
if (rc > out_end - out_ptr)
goto out;
out_ptr += rc;
Expand Down
5 changes: 3 additions & 2 deletions trunk/fs/fcntl.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <linux/ptrace.h>
#include <linux/signal.h>
#include <linux/rcupdate.h>
#include <linux/pid_namespace.h>

#include <asm/poll.h>
#include <asm/siginfo.h>
Expand Down Expand Up @@ -292,7 +293,7 @@ int f_setown(struct file *filp, unsigned long arg, int force)
who = -who;
}
rcu_read_lock();
pid = find_pid(who);
pid = find_vpid(who);
result = __f_setown(filp, pid, type, force);
rcu_read_unlock();
return result;
Expand All @@ -308,7 +309,7 @@ pid_t f_getown(struct file *filp)
{
pid_t pid;
read_lock(&filp->f_owner.lock);
pid = pid_nr(filp->f_owner.pid);
pid = pid_nr_ns(filp->f_owner.pid, current->nsproxy->pid_ns);
if (filp->f_owner.pid_type == PIDTYPE_PGID)
pid = -pid;
read_unlock(&filp->f_owner.lock);
Expand Down
11 changes: 7 additions & 4 deletions trunk/fs/ioprio.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <linux/capability.h>
#include <linux/syscalls.h>
#include <linux/security.h>
#include <linux/pid_namespace.h>

static int set_task_ioprio(struct task_struct *task, int ioprio)
{
Expand Down Expand Up @@ -93,15 +94,16 @@ asmlinkage long sys_ioprio_set(int which, int who, int ioprio)
if (!who)
p = current;
else
p = find_task_by_pid(who);
p = find_task_by_pid_ns(who,
current->nsproxy->pid_ns);
if (p)
ret = set_task_ioprio(p, ioprio);
break;
case IOPRIO_WHO_PGRP:
if (!who)
pgrp = task_pgrp(current);
else
pgrp = find_pid(who);
pgrp = find_vpid(who);
do_each_pid_task(pgrp, PIDTYPE_PGID, p) {
ret = set_task_ioprio(p, ioprio);
if (ret)
Expand Down Expand Up @@ -180,15 +182,16 @@ asmlinkage long sys_ioprio_get(int which, int who)
if (!who)
p = current;
else
p = find_task_by_pid(who);
p = find_task_by_pid_ns(who,
current->nsproxy->pid_ns);
if (p)
ret = get_task_ioprio(p);
break;
case IOPRIO_WHO_PGRP:
if (!who)
pgrp = task_pgrp(current);
else
pgrp = find_pid(who);
pgrp = find_vpid(who);
do_each_pid_task(pgrp, PIDTYPE_PGID, p) {
tmpio = get_task_ioprio(p);
if (tmpio < 0)
Expand Down
27 changes: 19 additions & 8 deletions trunk/fs/proc/array.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
#include <linux/cpuset.h>
#include <linux/rcupdate.h>
#include <linux/delayacct.h>
#include <linux/pid_namespace.h>

#include <asm/pgtable.h>
#include <asm/processor.h>
Expand Down Expand Up @@ -161,8 +162,15 @@ static inline char *task_state(struct task_struct *p, char *buffer)
struct group_info *group_info;
int g;
struct fdtable *fdt = NULL;
struct pid_namespace *ns;
pid_t ppid, tpid;

ns = current->nsproxy->pid_ns;
rcu_read_lock();
ppid = pid_alive(p) ?
task_tgid_nr_ns(rcu_dereference(p->real_parent), ns) : 0;
tpid = pid_alive(p) && p->ptrace ?
task_ppid_nr_ns(rcu_dereference(p->parent), ns) : 0;
buffer += sprintf(buffer,
"State:\t%s\n"
"Tgid:\t%d\n"
Expand All @@ -172,9 +180,9 @@ static inline char *task_state(struct task_struct *p, char *buffer)
"Uid:\t%d\t%d\t%d\t%d\n"
"Gid:\t%d\t%d\t%d\t%d\n",
get_task_state(p),
p->tgid, p->pid,
pid_alive(p) ? rcu_dereference(p->real_parent)->tgid : 0,
pid_alive(p) && p->ptrace ? rcu_dereference(p->parent)->pid : 0,
task_tgid_nr_ns(p, ns),
task_pid_nr_ns(p, ns),
ppid, tpid,
p->uid, p->euid, p->suid, p->fsuid,
p->gid, p->egid, p->sgid, p->fsgid);

Expand Down Expand Up @@ -394,6 +402,9 @@ static int do_task_stat(struct task_struct *task, char *buffer, int whole)
unsigned long rsslim = 0;
char tcomm[sizeof(task->comm)];
unsigned long flags;
struct pid_namespace *ns;

ns = current->nsproxy->pid_ns;

state = *get_task_state(task);
vsize = eip = esp = 0;
Expand All @@ -416,7 +427,7 @@ static int do_task_stat(struct task_struct *task, char *buffer, int whole)
struct signal_struct *sig = task->signal;

if (sig->tty) {
tty_pgrp = pid_nr(sig->tty->pgrp);
tty_pgrp = pid_nr_ns(sig->tty->pgrp, ns);
tty_nr = new_encode_dev(tty_devnum(sig->tty));
}

Expand Down Expand Up @@ -449,9 +460,9 @@ static int do_task_stat(struct task_struct *task, char *buffer, int whole)
gtime += cputime_add(gtime, sig->gtime);
}

sid = task_session_nr(task);
pgid = task_pgrp_nr(task);
ppid = rcu_dereference(task->real_parent)->tgid;
sid = task_session_nr_ns(task, ns);
pgid = task_pgrp_nr_ns(task, ns);
ppid = task_ppid_nr_ns(task, ns);

unlock_task_sighand(task, &flags);
}
Expand Down Expand Up @@ -483,7 +494,7 @@ static int do_task_stat(struct task_struct *task, char *buffer, int whole)
res = sprintf(buffer, "%d (%s) %c %d %d %d %d %d %u %lu \
%lu %lu %lu %lu %lu %ld %ld %ld %ld %d 0 %llu %lu %ld %lu %lu %lu %lu %lu \
%lu %lu %lu %lu %lu %lu %lu %lu %d %d %u %u %llu %lu %ld\n",
task->pid,
task_pid_nr_ns(task, ns),
tcomm,
state,
ppid,
Expand Down
Loading

0 comments on commit 0061672

Please sign in to comment.