From: ebiederm@xmission.com (Eric W. Biederman)
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Cyrill Gorcunov <gorcunov@openvz.org>,
LKML <linux-kernel@vger.kernel.org>,
Pavel Emelyanov <xemul@parallels.com>,
Andrew Vagin <avagin@openvz.org>, Oleg Nesterov <oleg@redhat.com>,
Greg KH <greg@kroah.com>
Subject: Re: [PATCH] pidns: remove recursion from free_pid_ns() v5
Date: Wed, 10 Oct 2012 13:59:43 -0700 [thread overview]
Message-ID: <87vceiqc00.fsf@xmission.com> (raw)
In-Reply-To: <20121010135408.515c2e21.akpm@linux-foundation.org> (Andrew Morton's message of "Wed, 10 Oct 2012 13:54:08 -0700")
Andrew Morton <akpm@linux-foundation.org> writes:
> On Thu, 11 Oct 2012 00:42:56 +0400
> Cyrill Gorcunov <gorcunov@openvz.org> wrote:
>
>> The free_pid_ns function done in recursion fashion:
>>
>> free_pid_ns(parent)
>> put_pid_ns(parent)
>> kref_put(&ns->kref, free_pid_ns);
>> free_pid_ns
>>
>> thus if there was a huge nesting of namespaces the userspace
>> may trigger avalanche calling of free_pid_ns leading to
>> kernel stack exhausting and a panic eventually.
>>
>> This patch turns the recursion into iterative loop.
>>
>> v5 (from oleg@):
>> - Drop @ret variable
>> - Make put_pid_ns non-inline since it grows in size,
>> in turn make free_pid_ns static
>
> OK, let's try that. I'll sit on this until -rc2 to give it a bit of
> time to cook.
>
> A -stable backport might be needed. What capabilities does userspace
> need to be able to trigger the kernel stack overflow?
CAP_SYS_ADMIN is required to create a new pid namespace today.
With a little luck the user namespace bits that allow unprivelged
creation of pid namespaces will be ready for 3.8.
Eric
next prev parent reply other threads:[~2012-10-10 20:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-10 20:42 [PATCH] pidns: remove recursion from free_pid_ns() v5 Cyrill Gorcunov
2012-10-10 20:54 ` Andrew Morton
2012-10-10 20:59 ` Eric W. Biederman [this message]
2012-10-10 21:14 ` Cyrill Gorcunov
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=87vceiqc00.fsf@xmission.com \
--to=ebiederm@xmission.com \
--cc=akpm@linux-foundation.org \
--cc=avagin@openvz.org \
--cc=gorcunov@openvz.org \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg@redhat.com \
--cc=xemul@parallels.com \
/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