[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <47F9CB64.8040009@openvz.org>
Date: Mon, 07 Apr 2008 11:21:08 +0400
From: Pavel Emelyanov <xemul@...nvz.org>
To: Manfred Spraul <manfred@...orfullife.com>
CC: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
"Serge E. Hallyn" <serue@...ibm.com>,
"Eric W. Biederman" <ebiederm@...ssion.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Sukadev Bhattiprolu <sukadev@...ibm.com>
Subject: Re: [PATCH] fix SEM_UNDO with namespaces, take 2
Manfred Spraul wrote:
> Hi,
>
> below is the second attempt to fix SEM_UNDO + unshare():
> lookup_undo (in ipc/sem.c) is not namespace-aware, thus all entries in
> sysvsem.undo_list must be from the same namespace.
> The patch enforces that by detaching the current thread from
> sysvsem.undo_list in switch_task_namespaces() if the ipc namespace is
> changed.
>
> The patch boots and passes simple sysvsem+unshare tests.
>
> Signed-Off-By: Manfred Spraul <manfred@...orfullife.com>
>
> @@ -211,6 +211,18 @@ void switch_task_namespaces(struct task_struct *p, struct nsproxy *new)
>
> might_sleep();
>
> + if ((p->nsproxy == NULL && new != NULL) ||
> + (p->nsproxy != NULL && new == NULL) ||
> + (p->nsproxy != NULL && new != NULL && p->nsproxy->ipc_ns != new->ipc_ns)) {
> + /* switching the IPC namespace is considered equivalent to sys_exit() wrt.
> + * to outstanding SEM_UNDO undos: After switching to the new IPC namespace,
> + * the semaphore arrays from the old namespace are not accessible anymore.
> + *
> + * Additionally, an implicit sys_unshare(CLONE_SYSVSEM) is performed.
> + */
> + exit_sem(p);
> + }
> +
No, switch_task_namespaces is the wrong place to do this. It is to be
done in copy_ipc_ns. If you need a task for which a new namespace is
being prepared, then pass one into it.
> ns = p->nsproxy;
>
> rcu_assign_pointer(p->nsproxy, new);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists