public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: "Serge E. Hallyn" <serue@us.ibm.com>
Cc: xemul@openvz.org, manfred@colorfullife.com,
	linux-kernel@vger.kernel.org, serue@us.ibm.com,
	sukadev@us.ibm.com, ebiederm@xmission.com,
	Nadia Derbey <Nadia.Derbey@bull.net>,
	Pierre Peiffer <peifferp@gmail.com>
Subject: Re: [RFC, PATCH] fix SEM_UNDO with namespaces
Date: Thu, 3 Apr 2008 12:04:06 -0700	[thread overview]
Message-ID: <20080403120406.dbc84cbd.akpm@linux-foundation.org> (raw)
In-Reply-To: <20080401141540.GB13213@sergelap.ibm.com>

On Tue, 1 Apr 2008 09:15:41 -0500
"Serge E. Hallyn" <serue@us.ibm.com> wrote:

> Quoting Pavel Emelyanov (xemul@openvz.org):
> > Manfred Spraul wrote:
> > > Pavel Emelyanov wrote:
> > >> Manfred Spraul wrote:
> > >>   
> > >>> Hi,
> > >>>
> > >>> the attached patch should fix the combination of CLONE_NEWIPC with 
> > >>> shared sysv undo structures (the common case, just 
> > >>> sys_unshare(CLONE_NEWIPC)):
> > >>> lookup_undo() now locates the undo array based on both semid and the 
> > >>> namespace pointer.
> > >>>     
> > >> If you start using any IPC object and then call unshare with CLONE_NEWIPC,
> > >> then it's your problem, but not the kernel.
> > >>   
> > > The result is a kernel memory corruption, and kernel memory corruptions 
> > > are always the kernel's problem.
> > 
> > Agree. Must be fixed, but I'm not sure we should try handling this
> > case by trying to de-op semaphores for former task namespace. I think
> > that destroying this list or returning -EBUSY for this case is OK.
> > 
> > > The code assumed that a semaphore id is globally unique. With 
> > > namespaces,  this is not true anymore.
> > > If two semaphore arrays exist with the same id, but different sizes, 
> > > then semops will cause memory corruptions: The undo structure contains 
> > > one element for each semaphore, thus the semop will write behind the end 
> > > of the memory allocation.
> > > 
> > >> 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?
> 
> Absolutely.
> 

Guys, what's the status here?

afaict Manfred has identified an available-to-unprivileged-apps kernel
memory corrupter?  If so, we should fix it asap for 2.6.25.  And for
2.6.24.x if it's also present there.

Manfred's patch doesn't come close to applying against the 2.6.26 IPC
things which we have queued but that's OK - bugfixes come first.

  reply	other threads:[~2008-04-03 19:05 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 [this message]
2008-04-03 19:31           ` Manfred Spraul
2008-04-01 15:25       ` Eric W. Biederman
2008-04-03 19:40         ` Manfred Spraul
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=20080403120406.dbc84cbd.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=Nadia.Derbey@bull.net \
    --cc=ebiederm@xmission.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manfred@colorfullife.com \
    --cc=peifferp@gmail.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox