From: Manfred Spraul <manfred@colorfullife.com>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Pavel Emelyanov <xemul@openvz.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Serge Hallyn <serue@us.ibm.com>,
Sukadev Bhattiprolu <sukadev@us.ibm.com>
Subject: Re: [RFC, PATCH] fix SEM_UNDO with namespaces
Date: Thu, 03 Apr 2008 21:40:11 +0200 [thread overview]
Message-ID: <47F5329B.8080305@colorfullife.com> (raw)
In-Reply-To: <m1od8tiom7.fsf@ebiederm.dsl.xmission.com>
Eric W. Biederman wrote:
> Pavel Emelyanov <xemul@openvz.org> writes:
>
>>>> I agree, that we should probably destroy this one when the task calls
>>>> unshare, but trying to keep this list relevant is useless.
>>>>
>>>>
>>> A very tricky question: Let's assume we have a process with two threads.
>>> The undo structure is shared, as per opengroup standard.
>>> Now one thread calls unshare(CLONE_NEWIPC). What should happen? We
>>> cannot destroy the undo structure, the other thread might be still
>>> interested in it.
>>> If we allow sys_unshare() for multithreaded processes with CLONE_NEWIPC
>>> and without CLONE_SYSVSEM, then we must handle this case.
>>>
>> Hm... I'd simply disable creating any new namespaces for threads.
>> I think other namespaces developers agree with me. Serge, Suka, Eric
>> what do you think?
>>
>
> I almost agree. sys_unshare() in a multithreaded process breaks
> all kinds of user space libs. So you can only reasonably look at
> the problem as what we do with linux tasks that share some things
> and not others. The posix/opengroup notion of processes and threads
> are a distraction.
>
> In this case requiring it appears that to require unsharing both
> CLONE_SYSVSEM and CLONE_NEWIPC at the same time. (i.e. unshare
> of CLONE_SYSVSEM should fail if CLONE_NEWIPC is not also specified).
> Then to make it work we make unshare of SYSVSEM succeed when it is not shared.
>
> This looks like about a 5 line patch or two.
>
>
Probably something like this in copy_ipcs:
if (current->sysvsem.undo_list != NULL &&
atomic_read(current->sysvsem.undo_list->refcount) > 1)
return -EINVAL;
I'll think about it and write a patch over the weekend.
> The effect is because we don't support unsharing of SYSVSEM currently
> we don't support a threaded process unsharing the ipc namespace.
>
I agree.
Btw: The manpage of unshare() is IMHO a bit misleading:
> NAME
> unshare - disassociate parts of the process execution context
unshare() only operates on a single thread, shouldn't the description be
"disassociate parts of the thread execution context"?
--
Manfred
next prev parent reply other threads:[~2008-04-03 19:45 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-30 20:50 [RFC, PATCH] fix SEM_UNDO with namespaces Manfred Spraul
2008-03-31 7:12 ` Pavel Emelyanov
2008-03-31 16:14 ` Manfred Spraul
2008-04-01 9:44 ` Pavel Emelyanov
2008-04-01 14:15 ` Serge E. Hallyn
2008-04-03 19:04 ` Andrew Morton
2008-04-03 19:31 ` Manfred Spraul
2008-04-01 15:25 ` Eric W. Biederman
2008-04-03 19:40 ` Manfred Spraul [this message]
2008-04-03 19:44 ` Serge E. Hallyn
2008-04-04 4:39 ` Serge E. Hallyn
2008-04-06 15:11 ` Manfred Spraul
2008-04-06 16:26 ` [PATCH] fix SEM_UNDO with namespaces, take 2 Manfred Spraul
2008-04-07 7:21 ` Pavel Emelyanov
2008-04-07 17:03 ` Manfred Spraul
2008-04-08 8:09 ` Pavel Emelyanov
2008-04-14 21:10 ` [RFC, PATCH] fix SEM_UNDO with namespaces Serge E. Hallyn
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=47F5329B.8080305@colorfullife.com \
--to=manfred@colorfullife.com \
--cc=akpm@linux-foundation.org \
--cc=ebiederm@xmission.com \
--cc=linux-kernel@vger.kernel.org \
--cc=serue@us.ibm.com \
--cc=sukadev@us.ibm.com \
--cc=xemul@openvz.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.