From: Kirill Korotaev <dev@sw.ru>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: linux-kernel@vger.kernel.org, vserver@list.linux-vserver.org,
Herbert Poetzl <herbert@13thfloor.at>,
"Serge E. Hallyn" <serue@us.ibm.com>,
Alan Cox <alan@lxorguk.ukuu.org.uk>,
Dave Hansen <haveblue@us.ibm.com>,
Arjan van de Ven <arjan@infradead.org>,
Suleiman Souhlal <ssouhlal@FreeBSD.org>,
Hubertus Franke <frankeh@watson.ibm.com>,
Cedric Le Goater <clg@fr.ibm.com>,
Kyle Moffett <mrmacman_g4@mac.com>, Greg <gkurz@fr.ibm.com>,
Linus Torvalds <torvalds@osdl.org>, Andrew Morton <akpm@osdl.org>,
Greg KH <greg@kroah.com>, Rik van Riel <riel@redhat.com>,
Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>,
Andrey Savochkin <saw@sawoct.com>,
Kirill Korotaev <dev@openvz.org>, Andi Kleen <ak@suse.de>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Jeff Garzik <jgarzik@pobox.com>,
Trond Myklebust <trond.myklebust@fys.uio.no>,
Jes Sorensen <jes@sgi.com>
Subject: Re: [RFC][PATCH 01/20] pid: Intoduce the concept of a wid (wait id)
Date: Fri, 10 Feb 2006 21:51:23 +0300 [thread overview]
Message-ID: <43ECE0AB.1010608@sw.ru> (raw)
In-Reply-To: <m1vevsmgvz.fsf@ebiederm.dsl.xmission.com>
Eric,
1. I would rename wid to wpid :)
2. Maybe I'm missing something in the discussions, but why is it
required? if you provide fully isolated pid spaces, why do you care for wid?
And how ptrace can work at all if cldstop reports some pid, but child is
not accessiable via ptrace()? and if it doesn't work, what are your
changes for?
Kirill
> The wait id is the pid returned by wait. For tasks that span 2
> namespaces (i.e. the process leaders of the pid namespaces) their
> parent knows the task by a different PID value than the task knows
> itself. Having a child with PID == 1 would be confusing.
>
> This patch introduces the wid and walks through kernel and modifies
> the places that observe the pid from the parent processes perspective
> to use the wid instead of the pid.
>
> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
>
>
> ---
>
> include/linux/sched.h | 1 +
> kernel/exit.c | 18 +++++++++---------
> kernel/fork.c | 4 ++--
> kernel/sched.c | 2 +-
> kernel/signal.c | 6 +++---
> 5 files changed, 16 insertions(+), 15 deletions(-)
>
> 598714d79648463ab3f2cbf6f6acd3cd6c09c87a
> diff --git a/include/linux/sched.h b/include/linux/sched.h
> index f368048..e8ea561 100644
> --- a/include/linux/sched.h
> +++ b/include/linux/sched.h
> @@ -740,6 +740,7 @@ struct task_struct {
> /* ??? */
> unsigned long personality;
> unsigned did_exec:1;
> + pid_t wid;
> pid_t pid;
> pid_t tgid;
> /*
> diff --git a/kernel/exit.c b/kernel/exit.c
> index fb4c8b1..749bc8b 100644
> --- a/kernel/exit.c
> +++ b/kernel/exit.c
> @@ -941,7 +941,7 @@ asmlinkage void sys_exit_group(int error
> static int eligible_child(pid_t pid, int options, task_t *p)
> {
> if (pid > 0) {
> - if (p->pid != pid)
> + if (p->wid != pid)
> return 0;
> } else if (!pid) {
> if (process_group(p) != process_group(current))
> @@ -1018,7 +1018,7 @@ static int wait_task_zombie(task_t *p, i
> int status;
>
> if (unlikely(noreap)) {
> - pid_t pid = p->pid;
> + pid_t pid = p->wid;
> uid_t uid = p->uid;
> int exit_code = p->exit_code;
> int why, status;
> @@ -1130,7 +1130,7 @@ static int wait_task_zombie(task_t *p, i
> retval = put_user(status, &infop->si_status);
> }
> if (!retval && infop)
> - retval = put_user(p->pid, &infop->si_pid);
> + retval = put_user(p->wid, &infop->si_pid);
> if (!retval && infop)
> retval = put_user(p->uid, &infop->si_uid);
> if (retval) {
> @@ -1138,7 +1138,7 @@ static int wait_task_zombie(task_t *p, i
> p->exit_state = EXIT_ZOMBIE;
> return retval;
> }
> - retval = p->pid;
> + retval = p->wid;
> if (p->real_parent != p->parent) {
> write_lock_irq(&tasklist_lock);
> /* Double-check with lock held. */
> @@ -1198,7 +1198,7 @@ static int wait_task_stopped(task_t *p,
> read_unlock(&tasklist_lock);
>
> if (unlikely(noreap)) {
> - pid_t pid = p->pid;
> + pid_t pid = p->wid;
> uid_t uid = p->uid;
> int why = (p->ptrace & PT_PTRACED) ? CLD_TRAPPED : CLD_STOPPED;
>
> @@ -1269,11 +1269,11 @@ bail_ref:
> if (!retval && infop)
> retval = put_user(exit_code, &infop->si_status);
> if (!retval && infop)
> - retval = put_user(p->pid, &infop->si_pid);
> + retval = put_user(p->wid, &infop->si_pid);
> if (!retval && infop)
> retval = put_user(p->uid, &infop->si_uid);
> if (!retval)
> - retval = p->pid;
> + retval = p->wid;
> put_task_struct(p);
>
> BUG_ON(!retval);
> @@ -1310,7 +1310,7 @@ static int wait_task_continued(task_t *p
> p->signal->flags &= ~SIGNAL_STOP_CONTINUED;
> spin_unlock_irq(&p->sighand->siglock);
>
> - pid = p->pid;
> + pid = p->wid;
> uid = p->uid;
> get_task_struct(p);
> read_unlock(&tasklist_lock);
> @@ -1321,7 +1321,7 @@ static int wait_task_continued(task_t *p
> if (!retval && stat_addr)
> retval = put_user(0xffff, stat_addr);
> if (!retval)
> - retval = p->pid;
> + retval = pid;
> } else {
> retval = wait_noreap_copyout(p, pid, uid,
> CLD_CONTINUED, SIGCONT,
> diff --git a/kernel/fork.c b/kernel/fork.c
> index f4a7281..743d46c 100644
> --- a/kernel/fork.c
> +++ b/kernel/fork.c
> @@ -931,10 +931,10 @@ static task_t *copy_process(unsigned lon
>
> p->did_exec = 0;
> copy_flags(clone_flags, p);
> - p->pid = pid;
> + p->wid = p->pid = pid;
> retval = -EFAULT;
> if (clone_flags & CLONE_PARENT_SETTID)
> - if (put_user(p->pid, parent_tidptr))
> + if (put_user(p->wid, parent_tidptr))
> goto bad_fork_cleanup;
>
> p->proc_dentry = NULL;
> diff --git a/kernel/sched.c b/kernel/sched.c
> index f77f23f..6579d49 100644
> --- a/kernel/sched.c
> +++ b/kernel/sched.c
> @@ -1674,7 +1674,7 @@ asmlinkage void schedule_tail(task_t *pr
> preempt_enable();
> #endif
> if (current->set_child_tid)
> - put_user(current->pid, current->set_child_tid);
> + put_user(current->wid, current->set_child_tid);
> }
>
> /*
> diff --git a/kernel/signal.c b/kernel/signal.c
> index 1f54ed7..70c226c 100644
> --- a/kernel/signal.c
> +++ b/kernel/signal.c
> @@ -1564,7 +1564,7 @@ void do_notify_parent(struct task_struct
>
> info.si_signo = sig;
> info.si_errno = 0;
> - info.si_pid = tsk->pid;
> + info.si_pid = tsk->wid;
> info.si_uid = tsk->uid;
>
> /* FIXME: find out whether or not this is supposed to be c*time. */
> @@ -1629,7 +1629,7 @@ static void do_notify_parent_cldstop(str
>
> info.si_signo = SIGCHLD;
> info.si_errno = 0;
> - info.si_pid = tsk->pid;
> + info.si_pid = tsk->wid;
> info.si_uid = tsk->uid;
>
> /* FIXME: find out whether or not this is supposed to be c*time. */
> @@ -1732,7 +1732,7 @@ void ptrace_notify(int exit_code)
> memset(&info, 0, sizeof info);
> info.si_signo = SIGTRAP;
> info.si_code = exit_code;
> - info.si_pid = current->pid;
> + info.si_pid = current->wid;
> info.si_uid = current->uid;
>
> /* Let the debugger run. */
next prev parent reply other threads:[~2006-02-10 18:51 UTC|newest]
Thread overview: 78+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-02-06 19:19 [RFC][PATCH 0/20] Multiple instances of the process id namespace Eric W. Biederman
2006-02-06 19:22 ` [RFC][PATCH 01/20] pid: Intoduce the concept of a wid (wait id) Eric W. Biederman
2006-02-06 19:27 ` [RFC][PATCH 02/20] pspace: The parent process id of pid 1 is always 0 Eric W. Biederman
2006-02-06 19:29 ` [RFC][PATCH 03/20] pid: Introduce a generic helper to test for init Eric W. Biederman
2006-02-06 19:34 ` [RFC][PATCH 04/20] pspace: Allow multiple instaces of the process id namespace Eric W. Biederman
2006-02-06 19:36 ` [RFC][PATCH 05/20] sched: Fixup the scheduler syscalls to deal with pspaces Eric W. Biederman
2006-02-06 19:39 ` [RFC][PATCH 06/20] cad_pid: Fixup the cad_pid users to assume it is in the initial process id namespace Eric W. Biederman
2006-02-06 19:41 ` [RFC][PATCH 07/20] tty: Update the tty layer to work with pspaces Eric W. Biederman
2006-02-06 19:44 ` [RFC][PATCH 08/20] vt: Update the virtual console to handle pspaces Eric W. Biederman
2006-02-06 19:46 ` [RFC][PATCH 09/20] ptrace: Update ptrace " Eric W. Biederman
2006-02-06 19:49 ` [RFC][PATCH 10/20] capabilities: Update the capabilities code to " Eric W. Biederman
2006-02-06 19:51 ` [RFC][PATCH 11/20] ioprio: Update ioprio " Eric W. Biederman
2006-02-06 19:54 ` [RFC][PATCH 12/20] fcntl: Update fcntl to work with pspaces Eric W. Biederman
2006-02-06 19:57 ` [RFC][PATCH 13/20] kthread: Update kthread " Eric W. Biederman
2006-02-06 19:59 ` [RFC][PATCH 14/20] mm: Update vmscan " Eric W. Biederman
2006-02-06 20:00 ` [RFC][PATCH 15/20] posix-timers: Update posix timers " Eric W. Biederman
2006-02-06 20:02 ` [PATCH 16/20] nfs: Don't use pids to track the lockd server process Eric W. Biederman
2006-02-06 20:03 ` [RFC][PATCH 17/20] usb: Fixup usb so it works with pspaces Eric W. Biederman
2006-02-06 20:05 ` [RFC][PATCH 18/20] posix-mqueue: Make mqueues work with pspspaces Eric W. Biederman
2006-02-06 20:07 ` [RFC][PATCH 19/20] pspace: Upcate the pid_max sysctl to work in a per pspace fashion Eric W. Biederman
2006-02-06 20:12 ` [RFC][PATCH 20/20] proc: Update /proc to support multiple pid spaces Eric W. Biederman
2006-02-10 20:40 ` Kirill Korotaev
2006-02-11 10:10 ` Eric W. Biederman
2006-02-06 20:41 ` [RFC][PATCH 17/20] usb: Fixup usb so it works with pspaces Serge E. Hallyn
2006-02-06 20:53 ` Eric W. Biederman
2006-02-07 16:41 ` [RFC][PATCH 04/20] pspace: Allow multiple instaces of the process id namespace William Lee Irwin III
2006-02-07 17:05 ` Eric W. Biederman
2006-02-10 20:30 ` Kirill Korotaev
2006-02-11 9:42 ` Eric W. Biederman
2006-02-11 10:11 ` Eric W. Biederman
2006-02-11 10:43 ` Eric W. Biederman
2006-02-13 8:53 ` Kirill Korotaev
2006-02-13 16:40 ` Dave Hansen
2006-02-11 11:03 ` Eric W. Biederman
2006-02-13 9:02 ` Kirill Korotaev
2006-02-13 21:31 ` Serge E. Hallyn
2006-02-13 23:41 ` Eric W. Biederman
2006-02-11 11:57 ` Eric W. Biederman
2006-02-13 9:22 ` Kirill Korotaev
2006-02-13 17:02 ` Serge E. Hallyn
2006-02-14 5:59 ` Eric W. Biederman
2006-02-14 5:54 ` Eric W. Biederman
2006-02-14 18:45 ` Dave Hansen
2006-02-15 12:07 ` Kirill Korotaev
2006-02-15 13:31 ` Herbert Poetzl
2006-02-16 13:44 ` Serge E. Hallyn
2006-02-20 9:27 ` Kirill Korotaev
2006-02-20 17:04 ` Herbert Poetzl
2006-02-21 16:29 ` Kirill Korotaev
2006-02-21 23:23 ` Herbert Poetzl
2006-02-20 11:29 ` Kirill Korotaev
2006-02-20 12:34 ` Herbert Poetzl
2006-02-20 14:11 ` Kirill Korotaev
2006-02-20 15:08 ` Herbert Poetzl
2006-03-01 22:06 ` Cedric Le Goater
2006-02-15 18:40 ` Eric W. Biederman
2006-02-06 19:56 ` [RFC][PATCH 03/20] pid: Introduce a generic helper to test for init Dave Hansen
2006-02-06 20:22 ` Eric W. Biederman
2006-02-07 15:08 ` Geert Uytterhoeven
2006-02-07 15:17 ` Eric W. Biederman
2006-02-06 19:54 ` [RFC][PATCH 01/20] pid: Intoduce the concept of a wid (wait id) Serge E. Hallyn
2006-02-06 20:23 ` Eric W. Biederman
2006-02-07 17:39 ` Jeff Dike
2006-02-07 18:32 ` Eric W. Biederman
2006-02-10 18:51 ` Kirill Korotaev [this message]
2006-02-11 9:25 ` Eric W. Biederman
2006-02-13 8:43 ` Kirill Korotaev
2006-02-14 0:04 ` Eric W. Biederman
2006-02-06 20:40 ` [RFC][PATCH 0/20] Multiple instances of the process id namespace Hubertus Franke
2006-02-06 20:51 ` Eric W. Biederman
2006-02-06 21:07 ` Hubertus Franke
2006-02-06 21:56 ` Eric W. Biederman
2006-02-07 0:48 ` Dave Hansen
2006-02-07 5:14 ` Eric W. Biederman
2006-02-07 9:33 ` Andi Kleen
2006-02-08 4:19 ` Randy.Dunlap
2006-02-08 4:28 ` Eric W. Biederman
2006-02-08 4:51 ` Randy.Dunlap
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=43ECE0AB.1010608@sw.ru \
--to=dev@sw.ru \
--cc=ak@suse.de \
--cc=akpm@osdl.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=arjan@infradead.org \
--cc=benh@kernel.crashing.org \
--cc=clg@fr.ibm.com \
--cc=dev@openvz.org \
--cc=ebiederm@xmission.com \
--cc=frankeh@watson.ibm.com \
--cc=gkurz@fr.ibm.com \
--cc=greg@kroah.com \
--cc=haveblue@us.ibm.com \
--cc=herbert@13thfloor.at \
--cc=jes@sgi.com \
--cc=jgarzik@pobox.com \
--cc=kuznet@ms2.inr.ac.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=mrmacman_g4@mac.com \
--cc=riel@redhat.com \
--cc=saw@sawoct.com \
--cc=serue@us.ibm.com \
--cc=ssouhlal@FreeBSD.org \
--cc=torvalds@osdl.org \
--cc=trond.myklebust@fys.uio.no \
--cc=vserver@list.linux-vserver.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox