[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20121024124607.43f599e8.akpm@linux-foundation.org>
Date: Wed, 24 Oct 2012 12:46:07 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Andrey Wagin <avagin@...il.com>
Cc: linux-kernel@...r.kernel.org, Oleg Nesterov <oleg@...hat.com>,
Cyrill Gorcunov <gorcunov@...nvz.org>,
"Eric W. Biederman" <ebiederm@...ssion.com>,
Pavel Emelyanov <xemul@...allels.com>
Subject: Re: [PATCH] pidns: limit the nesting depth of pid namespaces
On Wed, 24 Oct 2012 09:38:57 +0400
Andrey Wagin <avagin@...il.com> wrote:
> >
> > I think that returning -ENOMEM in response to an excessive nesting
> > attempt is misleading - the system *didn't* run out of memory. EINVAL
> > is better?
>
> I chose ENOMEM by analogy with max_pid. When a new PID can not be
> allocated, ENOMEM is returned too.
I don't know what this means - please be carefully specific when
identifying kernel code.
If you're referring to kernel/pid.c:alloc_pid() then -ENOMEM is
appropriate there, because a failure *is* caused by memory allocation
failure.
But ENOMEM isn't appropriate for nesting-depth-exceeded - we shouldn't
tell the user "you ran out of memory" when he didn't! -EINVAL isn't
really appropriate either ("Invalid argument") but it has become a
general you-screwed-up catchall and seems to me to be the most
appropriate errno we have available.
--
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