[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220325153714.eau4ja6pcr2a34sh@wittgenstein>
Date: Fri, 25 Mar 2022 16:37:14 +0100
From: Christian Brauner <brauner@...nel.org>
To: Petr Vorel <pvorel@...e.cz>
Cc: linux-kernel@...r.kernel.org,
Christian Brauner <christian@...uner.io>,
Alexey Gladkov <legion@...nel.org>,
"Eric W . Biederman" <ebiederm@...ssion.com>,
"Serge E . Hallyn" <serge@...lyn.com>,
Vasily Averin <vvs@...tuozzo.com>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH 1/1] ns: Move MAX_PID_NS_LEVEL to ns_common.h, reuse it
On Fri, Mar 25, 2022 at 12:21:27PM +0100, Petr Vorel wrote:
> Move MAX_PID_NS_LEVEL to ns_common.h and reuse it in check in
> user_namespace.c.
>
> Signed-off-by: Petr Vorel <pvorel@...e.cz>
> ---
> Hi Christian, all,
>
> I don't see putting MAX_PID_NS_LEVEL into ns_common.h as an elegant
> solution but IMHO better than use a hardwired number or redefinition in
> user_namespace.h.
Hey Petr,
Weird I either deleted that message by accident or didn't get it.
>
> Kind regards,
> Petr
>
> include/linux/ns_common.h | 3 +++
> include/linux/pid_namespace.h | 3 ---
> kernel/user_namespace.c | 2 +-
> 3 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/include/linux/ns_common.h b/include/linux/ns_common.h
> index 0f1d024bd958..173fab9dadf7 100644
> --- a/include/linux/ns_common.h
> +++ b/include/linux/ns_common.h
> @@ -4,6 +4,9 @@
>
> #include <linux/refcount.h>
>
> +/* MAX_PID_NS_LEVEL is needed for limiting size of 'struct pid' */
> +#define MAX_PID_NS_LEVEL 32
The only two namespaces where this applies to have the same hard-coded
limit. If you want to get rid of the raw number you should just
introduce a generic define that expresses the limit for both pidns
and userns. Using "MAX_PID_NS_LEVEL" in the userns case is very
confusing. So if you wanted to do this introducing something like
#define MAX_NS_LEVEL 32
and using it in both places makes more sense.
Christian
Powered by blists - more mailing lists