2013-08-14 05:05:17

by Rui Xiang

[permalink] [raw]
Subject: [PATCH] userns: initialize the depth of user_namespace chain

The level of init_user_ns shoule be 1.

Signed-off-by: Rui Xiang <[email protected]>
---
kernel/user.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/kernel/user.c b/kernel/user.c
index 69b4c3d..32da187 100644
--- a/kernel/user.c
+++ b/kernel/user.c
@@ -48,6 +48,7 @@ struct user_namespace init_user_ns = {
},
},
.count = ATOMIC_INIT(3),
+ .level = 1,
.owner = GLOBAL_ROOT_UID,
.group = GLOBAL_ROOT_GID,
.proc_inum = PROC_USER_INIT_INO,
--
1.8.2.2


2013-08-14 05:06:46

by Andy Lutomirski

[permalink] [raw]
Subject: Re: [PATCH] userns: initialize the depth of user_namespace chain

On Tue, Aug 13, 2013 at 10:04 PM, Rui Xiang <[email protected]> wrote:
> The level of init_user_ns shoule be 1.

What's wrong with zero?

--Andy

>
> Signed-off-by: Rui Xiang <[email protected]>
> ---
> kernel/user.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/kernel/user.c b/kernel/user.c
> index 69b4c3d..32da187 100644
> --- a/kernel/user.c
> +++ b/kernel/user.c
> @@ -48,6 +48,7 @@ struct user_namespace init_user_ns = {
> },
> },
> .count = ATOMIC_INIT(3),
> + .level = 1,
> .owner = GLOBAL_ROOT_UID,
> .group = GLOBAL_ROOT_GID,
> .proc_inum = PROC_USER_INIT_INO,
> --
> 1.8.2.2
>



--
Andy Lutomirski
AMA Capital Management, LLC

2013-08-14 06:45:16

by Rui Xiang

[permalink] [raw]
Subject: Re: [PATCH] userns: initialize the depth of user_namespace chain

On 2013/8/14 13:06, Andy Lutomirski wrote:
> On Tue, Aug 13, 2013 at 10:04 PM, Rui Xiang <[email protected]> wrote:
>> The level of init_user_ns shoule be 1.
>
> What's wrong with zero?
>

No problem. It is just consistent with commit 8742f229b63, IMHO.
but the initialization of level should be necessary.


Thanks.

> --Andy
>
>>
>> Signed-off-by: Rui Xiang <[email protected]>
>> ---
>> kernel/user.c | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/kernel/user.c b/kernel/user.c
>> index 69b4c3d..32da187 100644
>> --- a/kernel/user.c
>> +++ b/kernel/user.c
>> @@ -48,6 +48,7 @@ struct user_namespace init_user_ns = {
>> },
>> },
>> .count = ATOMIC_INIT(3),
>> + .level = 1,
>> .owner = GLOBAL_ROOT_UID,
>> .group = GLOBAL_ROOT_GID,
>> .proc_inum = PROC_USER_INIT_INO,
>> --
>> 1.8.2.2
>>
>
>
>

2013-08-14 18:49:35

by Oleg Nesterov

[permalink] [raw]
Subject: Re: [PATCH] userns: initialize the depth of user_namespace chain

On 08/14, Rui Xiang wrote:
>
> On 2013/8/14 13:06, Andy Lutomirski wrote:
> > On Tue, Aug 13, 2013 at 10:04 PM, Rui Xiang <[email protected]> wrote:
> >> The level of init_user_ns shoule be 1.
> >
> > What's wrong with zero?
> >
>
> No problem. It is just consistent with commit 8742f229b63, IMHO.

Well, I am fine either way,

> but the initialization of level should be necessary.

but it is not necessary. This is just an "arbitrary" limit for now,
32 non-root namespaces. Perhaps we should count init_user_ns too.

Hmm. but I just realized that "> 32" in create_user_ns() should be
">= 32" in this case.

Oleg.

2013-08-15 01:51:16

by Rui Xiang

[permalink] [raw]
Subject: Re: [PATCH] userns: initialize the depth of user_namespace chain

On 2013/8/15 2:43, Oleg Nesterov wrote:
> On 08/14, Rui Xiang wrote:
>>
>> On 2013/8/14 13:06, Andy Lutomirski wrote:
>>> On Tue, Aug 13, 2013 at 10:04 PM, Rui Xiang <[email protected]> wrote:
>>>> The level of init_user_ns shoule be 1.
>>>
>>> What's wrong with zero?
>>>
>>
>> No problem. It is just consistent with commit 8742f229b63, IMHO.
>
> Well, I am fine either way,
>
>> but the initialization of level should be necessary.
>
> but it is not necessary. This is just an "arbitrary" limit for now,
> 32 non-root namespaces. Perhaps we should count init_user_ns too.
>
> Hmm. but I just realized that "> 32" in create_user_ns() should be
> ">= 32" in this case.
>
Yes. If we need to count init_user_ns, this filed should be set to 1 in
init_user_ns, and "> 32" in create_user_ns() can limit 32 non-root
namespaces. And that depends on your design. :)



Thanks.