All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ipv4: in new netns initialize sysctls in net.ipv4.conf.* with defaults
@ 2016-02-21  7:11 ` Konstantin Khlebnikov
  0 siblings, 0 replies; 21+ messages in thread
From: Konstantin Khlebnikov @ 2016-02-21  7:11 UTC (permalink / raw)
  To: netdev-u79uwXL29TY76Z2rM5mHXA, David S. Miller
  Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	Vasily Averin, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	Eric W. Biederman

Currently initial net.ipv4.conf.all.* and net.ipv4.conf.default.* are
copied from init network namespace because static structures are used
for init_net. This makes no sense because new netns might be created
from any netns. This patch makes private copy also for init netns if
network namespaces are enabled. Other sysctls in net.ipv4 and net.ipv6
already initialized with default values at namespace creation.

Signed-off-by: Konstantin Khlebnikov <khlebnikov-XoJtRXgx1JseBXzfvpsJ4g@public.gmane.org>
Fixes: 752d14dc6aa9 ("[IPV4]: Move the devinet pointers on the struct net")
---
 net/ipv4/devinet.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index cebd9d31e65a..9d73d4bbdba3 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -2290,7 +2290,7 @@ static __net_init int devinet_init_net(struct net *net)
 	all = &ipv4_devconf;
 	dflt = &ipv4_devconf_dflt;
 
-	if (!net_eq(net, &init_net)) {
+	if (IS_ENABLED(CONFIG_NET_NS)) {
 		all = kmemdup(all, sizeof(ipv4_devconf), GFP_KERNEL);
 		if (!all)
 			goto err_alloc_all;

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH] ipv4: in new netns initialize sysctls in net.ipv4.conf.* with defaults
@ 2016-02-21  7:11 ` Konstantin Khlebnikov
  0 siblings, 0 replies; 21+ messages in thread
From: Konstantin Khlebnikov @ 2016-02-21  7:11 UTC (permalink / raw)
  To: netdev, David S. Miller
  Cc: containers, Vasily Averin, linux-kernel, Eric W. Biederman

Currently initial net.ipv4.conf.all.* and net.ipv4.conf.default.* are
copied from init network namespace because static structures are used
for init_net. This makes no sense because new netns might be created
from any netns. This patch makes private copy also for init netns if
network namespaces are enabled. Other sysctls in net.ipv4 and net.ipv6
already initialized with default values at namespace creation.

Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Fixes: 752d14dc6aa9 ("[IPV4]: Move the devinet pointers on the struct net")
---
 net/ipv4/devinet.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index cebd9d31e65a..9d73d4bbdba3 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -2290,7 +2290,7 @@ static __net_init int devinet_init_net(struct net *net)
 	all = &ipv4_devconf;
 	dflt = &ipv4_devconf_dflt;
 
-	if (!net_eq(net, &init_net)) {
+	if (IS_ENABLED(CONFIG_NET_NS)) {
 		all = kmemdup(all, sizeof(ipv4_devconf), GFP_KERNEL);
 		if (!all)
 			goto err_alloc_all;

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [PATCH] ipv4: in new netns initialize sysctls in net.ipv4.conf.* with defaults
  2016-02-21  7:11 ` Konstantin Khlebnikov
@ 2016-02-21  9:25   ` Vasily Averin
  -1 siblings, 0 replies; 21+ messages in thread
From: Vasily Averin @ 2016-02-21  9:25 UTC (permalink / raw)
  To: Konstantin Khlebnikov, netdev-u79uwXL29TY76Z2rM5mHXA, David S. Miller
  Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Eric W. Biederman

Konstantin,
I've investigated question with sysctls initialization inside namespaces some time ago.
IIRC I've found people expect that sysctl values should be inherited from parent namespace.
It allows node admin to adjust unsafe pre-compiled settings, and prepare adequate defaults 
before creation of namespaces.

However, there is corner case:
module with sysctl can be loaded after creation of namespaces.
In this case namespaces will get pre-compiled sysctl defaults, 
and are not be able to adjust them even if they want to do it.

Thank you,
	Vasily Averin

On 21.02.2016 10:11, Konstantin Khlebnikov wrote:
> Currently initial net.ipv4.conf.all.* and net.ipv4.conf.default.* are
> copied from init network namespace because static structures are used
> for init_net. This makes no sense because new netns might be created
> from any netns. This patch makes private copy also for init netns if
> network namespaces are enabled. Other sysctls in net.ipv4 and net.ipv6
> already initialized with default values at namespace creation.
> 
> Signed-off-by: Konstantin Khlebnikov <khlebnikov-XoJtRXgx1JseBXzfvpsJ4g@public.gmane.org>
> Fixes: 752d14dc6aa9 ("[IPV4]: Move the devinet pointers on the struct net")
> ---
>  net/ipv4/devinet.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
> index cebd9d31e65a..9d73d4bbdba3 100644
> --- a/net/ipv4/devinet.c
> +++ b/net/ipv4/devinet.c
> @@ -2290,7 +2290,7 @@ static __net_init int devinet_init_net(struct net *net)
>  	all = &ipv4_devconf;
>  	dflt = &ipv4_devconf_dflt;
>  
> -	if (!net_eq(net, &init_net)) {
> +	if (IS_ENABLED(CONFIG_NET_NS)) {
>  		all = kmemdup(all, sizeof(ipv4_devconf), GFP_KERNEL);
>  		if (!all)
>  			goto err_alloc_all;
> 
> 

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH] ipv4: in new netns initialize sysctls in net.ipv4.conf.* with defaults
@ 2016-02-21  9:25   ` Vasily Averin
  0 siblings, 0 replies; 21+ messages in thread
From: Vasily Averin @ 2016-02-21  9:25 UTC (permalink / raw)
  To: Konstantin Khlebnikov, netdev, David S. Miller
  Cc: containers, linux-kernel, Eric W. Biederman

Konstantin,
I've investigated question with sysctls initialization inside namespaces some time ago.
IIRC I've found people expect that sysctl values should be inherited from parent namespace.
It allows node admin to adjust unsafe pre-compiled settings, and prepare adequate defaults 
before creation of namespaces.

However, there is corner case:
module with sysctl can be loaded after creation of namespaces.
In this case namespaces will get pre-compiled sysctl defaults, 
and are not be able to adjust them even if they want to do it.

Thank you,
	Vasily Averin

On 21.02.2016 10:11, Konstantin Khlebnikov wrote:
> Currently initial net.ipv4.conf.all.* and net.ipv4.conf.default.* are
> copied from init network namespace because static structures are used
> for init_net. This makes no sense because new netns might be created
> from any netns. This patch makes private copy also for init netns if
> network namespaces are enabled. Other sysctls in net.ipv4 and net.ipv6
> already initialized with default values at namespace creation.
> 
> Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
> Fixes: 752d14dc6aa9 ("[IPV4]: Move the devinet pointers on the struct net")
> ---
>  net/ipv4/devinet.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
> index cebd9d31e65a..9d73d4bbdba3 100644
> --- a/net/ipv4/devinet.c
> +++ b/net/ipv4/devinet.c
> @@ -2290,7 +2290,7 @@ static __net_init int devinet_init_net(struct net *net)
>  	all = &ipv4_devconf;
>  	dflt = &ipv4_devconf_dflt;
>  
> -	if (!net_eq(net, &init_net)) {
> +	if (IS_ENABLED(CONFIG_NET_NS)) {
>  		all = kmemdup(all, sizeof(ipv4_devconf), GFP_KERNEL);
>  		if (!all)
>  			goto err_alloc_all;
> 
> 

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH] ipv4: in new netns initialize sysctls in net.ipv4.conf.* with defaults
  2016-02-21  9:25   ` Vasily Averin
@ 2016-02-21 16:58       ` Konstantin Khlebnikov
  -1 siblings, 0 replies; 21+ messages in thread
From: Konstantin Khlebnikov @ 2016-02-21 16:58 UTC (permalink / raw)
  To: Vasily Averin, netdev-u79uwXL29TY76Z2rM5mHXA, David S. Miller
  Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Eric W. Biederman

On 21.02.2016 12:25, Vasily Averin wrote:
> Konstantin,
> I've investigated question with sysctls initialization inside namespaces some time ago.
> IIRC I've found people expect that sysctl values should be inherited from parent namespace.
> It allows node admin to adjust unsafe pre-compiled settings, and prepare adequate defaults
> before creation of namespaces.

Only few sysctls are handled in this manner and they are copied from host,
not parent. This works somehow for flat containers, as soon as you go deeper
this turns into madness. Default settings must be controlled by software who
creates namespaces. For now it must reset all yet-not-known sysctls into sane defaults.

BTW two ipv6 sysctl are special: net.ipv6.conf.default.disable_ipv6 and
net.ipv6.conf.default.autoconf their defaults are controlled by module
parameters and inherited by all namespaces. And this makes sense.

>
> However, there is corner case:
> module with sysctl can be loaded after creation of namespaces.
> In this case namespaces will get pre-compiled sysctl defaults,
> and are not be able to adjust them even if they want to do it.
>
> Thank you,
> 	Vasily Averin
>
> On 21.02.2016 10:11, Konstantin Khlebnikov wrote:
>> Currently initial net.ipv4.conf.all.* and net.ipv4.conf.default.* are
>> copied from init network namespace because static structures are used
>> for init_net. This makes no sense because new netns might be created
>> from any netns. This patch makes private copy also for init netns if
>> network namespaces are enabled. Other sysctls in net.ipv4 and net.ipv6
>> already initialized with default values at namespace creation.
>>
>> Signed-off-by: Konstantin Khlebnikov <khlebnikov-XoJtRXgx1JseBXzfvpsJ4g@public.gmane.org>
>> Fixes: 752d14dc6aa9 ("[IPV4]: Move the devinet pointers on the struct net")
>> ---
>>   net/ipv4/devinet.c |    2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
>> index cebd9d31e65a..9d73d4bbdba3 100644
>> --- a/net/ipv4/devinet.c
>> +++ b/net/ipv4/devinet.c
>> @@ -2290,7 +2290,7 @@ static __net_init int devinet_init_net(struct net *net)
>>   	all = &ipv4_devconf;
>>   	dflt = &ipv4_devconf_dflt;
>>
>> -	if (!net_eq(net, &init_net)) {
>> +	if (IS_ENABLED(CONFIG_NET_NS)) {
>>   		all = kmemdup(all, sizeof(ipv4_devconf), GFP_KERNEL);
>>   		if (!all)
>>   			goto err_alloc_all;
>>
>>


-- 
Konstantin

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH] ipv4: in new netns initialize sysctls in net.ipv4.conf.* with defaults
@ 2016-02-21 16:58       ` Konstantin Khlebnikov
  0 siblings, 0 replies; 21+ messages in thread
From: Konstantin Khlebnikov @ 2016-02-21 16:58 UTC (permalink / raw)
  To: Vasily Averin, netdev, David S. Miller
  Cc: containers, linux-kernel, Eric W. Biederman

On 21.02.2016 12:25, Vasily Averin wrote:
> Konstantin,
> I've investigated question with sysctls initialization inside namespaces some time ago.
> IIRC I've found people expect that sysctl values should be inherited from parent namespace.
> It allows node admin to adjust unsafe pre-compiled settings, and prepare adequate defaults
> before creation of namespaces.

Only few sysctls are handled in this manner and they are copied from host,
not parent. This works somehow for flat containers, as soon as you go deeper
this turns into madness. Default settings must be controlled by software who
creates namespaces. For now it must reset all yet-not-known sysctls into sane defaults.

BTW two ipv6 sysctl are special: net.ipv6.conf.default.disable_ipv6 and
net.ipv6.conf.default.autoconf their defaults are controlled by module
parameters and inherited by all namespaces. And this makes sense.

>
> However, there is corner case:
> module with sysctl can be loaded after creation of namespaces.
> In this case namespaces will get pre-compiled sysctl defaults,
> and are not be able to adjust them even if they want to do it.
>
> Thank you,
> 	Vasily Averin
>
> On 21.02.2016 10:11, Konstantin Khlebnikov wrote:
>> Currently initial net.ipv4.conf.all.* and net.ipv4.conf.default.* are
>> copied from init network namespace because static structures are used
>> for init_net. This makes no sense because new netns might be created
>> from any netns. This patch makes private copy also for init netns if
>> network namespaces are enabled. Other sysctls in net.ipv4 and net.ipv6
>> already initialized with default values at namespace creation.
>>
>> Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
>> Fixes: 752d14dc6aa9 ("[IPV4]: Move the devinet pointers on the struct net")
>> ---
>>   net/ipv4/devinet.c |    2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
>> index cebd9d31e65a..9d73d4bbdba3 100644
>> --- a/net/ipv4/devinet.c
>> +++ b/net/ipv4/devinet.c
>> @@ -2290,7 +2290,7 @@ static __net_init int devinet_init_net(struct net *net)
>>   	all = &ipv4_devconf;
>>   	dflt = &ipv4_devconf_dflt;
>>
>> -	if (!net_eq(net, &init_net)) {
>> +	if (IS_ENABLED(CONFIG_NET_NS)) {
>>   		all = kmemdup(all, sizeof(ipv4_devconf), GFP_KERNEL);
>>   		if (!all)
>>   			goto err_alloc_all;
>>
>>


-- 
Konstantin

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH] ipv4: in new netns initialize sysctls in net.ipv4.conf.* with defaults
  2016-02-21  7:11 ` Konstantin Khlebnikov
                   ` (2 preceding siblings ...)
  (?)
@ 2016-02-21 22:06 ` Eric W. Biederman
  -1 siblings, 0 replies; 21+ messages in thread
From: Eric W. Biederman @ 2016-02-21 22:06 UTC (permalink / raw)
  To: Konstantin Khlebnikov
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
	containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	Vasily Averin, David S. Miller,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

Konstantin Khlebnikov <khlebnikov-XoJtRXgx1JseBXzfvpsJ4g@public.gmane.org> writes:

> Currently initial net.ipv4.conf.all.* and net.ipv4.conf.default.* are
> copied from init network namespace because static structures are used
> for init_net. This makes no sense because new netns might be created
> from any netns. This patch makes private copy also for init netns if
> network namespaces are enabled. Other sysctls in net.ipv4 and net.ipv6
> already initialized with default values at namespace creation.

Acked-by: "Eric W. Biederman" <ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>

Assuming that this does not cause a regression I am all for this,
as it makes the kernels behavior predictable.

When creating a network namespace we have two predictable choices.
Copy from the current network namespace, or initialize all sysctl values
with the kernel's defaults.  Copying values looks like a way to
introduce subtle hard to debug breakage into existing setups.  So all
else being equal my preference is that we initialize values in new
nework namespaces to their initial defaults.

> Signed-off-by: Konstantin Khlebnikov <khlebnikov-XoJtRXgx1JseBXzfvpsJ4g@public.gmane.org>
> Fixes: 752d14dc6aa9 ("[IPV4]: Move the devinet pointers on the struct net")
> ---
>  net/ipv4/devinet.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
> index cebd9d31e65a..9d73d4bbdba3 100644
> --- a/net/ipv4/devinet.c
> +++ b/net/ipv4/devinet.c
> @@ -2290,7 +2290,7 @@ static __net_init int devinet_init_net(struct net *net)
>  	all = &ipv4_devconf;
>  	dflt = &ipv4_devconf_dflt;
>  
> -	if (!net_eq(net, &init_net)) {
> +	if (IS_ENABLED(CONFIG_NET_NS)) {
>  		all = kmemdup(all, sizeof(ipv4_devconf), GFP_KERNEL);
>  		if (!all)
>  			goto err_alloc_all;

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH] ipv4: in new netns initialize sysctls in net.ipv4.conf.* with defaults
  2016-02-21  7:11 ` Konstantin Khlebnikov
  (?)
  (?)
@ 2016-02-21 22:06 ` Eric W. Biederman
  -1 siblings, 0 replies; 21+ messages in thread
From: Eric W. Biederman @ 2016-02-21 22:06 UTC (permalink / raw)
  To: Konstantin Khlebnikov
  Cc: netdev, David S. Miller, containers, Vasily Averin, linux-kernel

Konstantin Khlebnikov <khlebnikov@yandex-team.ru> writes:

> Currently initial net.ipv4.conf.all.* and net.ipv4.conf.default.* are
> copied from init network namespace because static structures are used
> for init_net. This makes no sense because new netns might be created
> from any netns. This patch makes private copy also for init netns if
> network namespaces are enabled. Other sysctls in net.ipv4 and net.ipv6
> already initialized with default values at namespace creation.

Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>

Assuming that this does not cause a regression I am all for this,
as it makes the kernels behavior predictable.

When creating a network namespace we have two predictable choices.
Copy from the current network namespace, or initialize all sysctl values
with the kernel's defaults.  Copying values looks like a way to
introduce subtle hard to debug breakage into existing setups.  So all
else being equal my preference is that we initialize values in new
nework namespaces to their initial defaults.

> Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
> Fixes: 752d14dc6aa9 ("[IPV4]: Move the devinet pointers on the struct net")
> ---
>  net/ipv4/devinet.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
> index cebd9d31e65a..9d73d4bbdba3 100644
> --- a/net/ipv4/devinet.c
> +++ b/net/ipv4/devinet.c
> @@ -2290,7 +2290,7 @@ static __net_init int devinet_init_net(struct net *net)
>  	all = &ipv4_devconf;
>  	dflt = &ipv4_devconf_dflt;
>  
> -	if (!net_eq(net, &init_net)) {
> +	if (IS_ENABLED(CONFIG_NET_NS)) {
>  		all = kmemdup(all, sizeof(ipv4_devconf), GFP_KERNEL);
>  		if (!all)
>  			goto err_alloc_all;

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH] ipv4: in new netns initialize sysctls in net.ipv4.conf.* with defaults
  2016-02-21  7:11 ` Konstantin Khlebnikov
@ 2016-02-23 23:21   ` David Miller
  -1 siblings, 0 replies; 21+ messages in thread
From: David Miller @ 2016-02-23 23:21 UTC (permalink / raw)
  To: khlebnikov-XoJtRXgx1JseBXzfvpsJ4g
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
	containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	vvs-5HdwGun5lf+gSpxsJD1C4w, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	ebiederm-aS9lmoZGLiVWk0Htik3J/w

From: Konstantin Khlebnikov <khlebnikov-XoJtRXgx1JseBXzfvpsJ4g@public.gmane.org>
Date: Sun, 21 Feb 2016 10:11:02 +0300

> Currently initial net.ipv4.conf.all.* and net.ipv4.conf.default.* are
> copied from init network namespace because static structures are used
> for init_net. This makes no sense because new netns might be created
> from any netns. This patch makes private copy also for init netns if
> network namespaces are enabled. Other sysctls in net.ipv4 and net.ipv6
> already initialized with default values at namespace creation.
> 
> Signed-off-by: Konstantin Khlebnikov <khlebnikov-XoJtRXgx1JseBXzfvpsJ4g@public.gmane.org>
> Fixes: 752d14dc6aa9 ("[IPV4]: Move the devinet pointers on the struct net")

The horse has long left the stable on this.  We cannot change this now
without breaking things.

Imagine someone who intentionally sets up init_net with a certain set
of settings and expects them to propagate into every created namespace.

We'll break things for them and given the behavior existed for so long
what the administrator is doing is very reasonable.

I'm not applying this sorry, we are stuck with the current behavior
whether we like it or not.

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH] ipv4: in new netns initialize sysctls in net.ipv4.conf.* with defaults
@ 2016-02-23 23:21   ` David Miller
  0 siblings, 0 replies; 21+ messages in thread
From: David Miller @ 2016-02-23 23:21 UTC (permalink / raw)
  To: khlebnikov; +Cc: netdev, containers, vvs, linux-kernel, ebiederm

From: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Date: Sun, 21 Feb 2016 10:11:02 +0300

> Currently initial net.ipv4.conf.all.* and net.ipv4.conf.default.* are
> copied from init network namespace because static structures are used
> for init_net. This makes no sense because new netns might be created
> from any netns. This patch makes private copy also for init netns if
> network namespaces are enabled. Other sysctls in net.ipv4 and net.ipv6
> already initialized with default values at namespace creation.
> 
> Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
> Fixes: 752d14dc6aa9 ("[IPV4]: Move the devinet pointers on the struct net")

The horse has long left the stable on this.  We cannot change this now
without breaking things.

Imagine someone who intentionally sets up init_net with a certain set
of settings and expects them to propagate into every created namespace.

We'll break things for them and given the behavior existed for so long
what the administrator is doing is very reasonable.

I'm not applying this sorry, we are stuck with the current behavior
whether we like it or not.

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH] ipv4: in new netns initialize sysctls in net.ipv4.conf.* with defaults
  2016-02-23 23:21   ` David Miller
@ 2016-02-24  5:16       ` Konstantin Khlebnikov
  -1 siblings, 0 replies; 21+ messages in thread
From: Konstantin Khlebnikov @ 2016-02-24  5:16 UTC (permalink / raw)
  To: David Miller
  Cc: Константин
	Хлебников,
	Linux Kernel Network Developers, Linux Containers,
	Linux Kernel Mailing List, Eric W. Biederman, Vasily Averin

On Wed, Feb 24, 2016 at 2:21 AM, David Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org> wrote:
> From: Konstantin Khlebnikov <khlebnikov-XoJtRXgx1JseBXzfvpsJ4g@public.gmane.org>
> Date: Sun, 21 Feb 2016 10:11:02 +0300
>
>> Currently initial net.ipv4.conf.all.* and net.ipv4.conf.default.* are
>> copied from init network namespace because static structures are used
>> for init_net. This makes no sense because new netns might be created
>> from any netns. This patch makes private copy also for init netns if
>> network namespaces are enabled. Other sysctls in net.ipv4 and net.ipv6
>> already initialized with default values at namespace creation.
>>
>> Signed-off-by: Konstantin Khlebnikov <khlebnikov-XoJtRXgx1JseBXzfvpsJ4g@public.gmane.org>
>> Fixes: 752d14dc6aa9 ("[IPV4]: Move the devinet pointers on the struct net")
>
> The horse has long left the stable on this.  We cannot change this now
> without breaking things.
>
> Imagine someone who intentionally sets up init_net with a certain set
> of settings and expects them to propagate into every created namespace.
>
> We'll break things for them and given the behavior existed for so long
> what the administrator is doing is very reasonable.
>
> I'm not applying this sorry, we are stuck with the current behavior
> whether we like it or not.

Major kernel upgrades always break something in weird setups.
This shouldn't block bug fixing.

This kludge works only for several ipv4 sysctls. If software or man ever
have tried to setup ipv6 or tune tcp and want some non-default setup then
it/he already knows that sysctls must be configured inside.

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH] ipv4: in new netns initialize sysctls in net.ipv4.conf.* with defaults
@ 2016-02-24  5:16       ` Konstantin Khlebnikov
  0 siblings, 0 replies; 21+ messages in thread
From: Konstantin Khlebnikov @ 2016-02-24  5:16 UTC (permalink / raw)
  To: David Miller
  Cc: Константин
	Хлебников,
	Linux Kernel Network Developers, Linux Containers, Vasily Averin,
	Linux Kernel Mailing List, Eric W. Biederman

On Wed, Feb 24, 2016 at 2:21 AM, David Miller <davem@davemloft.net> wrote:
> From: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
> Date: Sun, 21 Feb 2016 10:11:02 +0300
>
>> Currently initial net.ipv4.conf.all.* and net.ipv4.conf.default.* are
>> copied from init network namespace because static structures are used
>> for init_net. This makes no sense because new netns might be created
>> from any netns. This patch makes private copy also for init netns if
>> network namespaces are enabled. Other sysctls in net.ipv4 and net.ipv6
>> already initialized with default values at namespace creation.
>>
>> Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
>> Fixes: 752d14dc6aa9 ("[IPV4]: Move the devinet pointers on the struct net")
>
> The horse has long left the stable on this.  We cannot change this now
> without breaking things.
>
> Imagine someone who intentionally sets up init_net with a certain set
> of settings and expects them to propagate into every created namespace.
>
> We'll break things for them and given the behavior existed for so long
> what the administrator is doing is very reasonable.
>
> I'm not applying this sorry, we are stuck with the current behavior
> whether we like it or not.

Major kernel upgrades always break something in weird setups.
This shouldn't block bug fixing.

This kludge works only for several ipv4 sysctls. If software or man ever
have tried to setup ipv6 or tune tcp and want some non-default setup then
it/he already knows that sysctls must be configured inside.

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH] ipv4: in new netns initialize sysctls in net.ipv4.conf.* with defaults
  2016-02-24  5:16       ` Konstantin Khlebnikov
@ 2016-02-24 15:20           ` David Miller
  -1 siblings, 0 replies; 21+ messages in thread
From: David Miller @ 2016-02-24 15:20 UTC (permalink / raw)
  To: koct9i-Re5JQEeQqe8AvxtiuMwx3w
  Cc: khlebnikov-XoJtRXgx1JseBXzfvpsJ4g, netdev-u79uwXL29TY76Z2rM5mHXA,
	containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	ebiederm-aS9lmoZGLiVWk0Htik3J/w, vvs-5HdwGun5lf+gSpxsJD1C4w

From: Konstantin Khlebnikov <koct9i-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Date: Wed, 24 Feb 2016 08:16:59 +0300

> Major kernel upgrades always break something in weird setups.
> This shouldn't block bug fixing.

A bug for you is a feature for another person.  I'm standing by my
position, and will not apply this and break existing setups, sorry.

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH] ipv4: in new netns initialize sysctls in net.ipv4.conf.* with defaults
@ 2016-02-24 15:20           ` David Miller
  0 siblings, 0 replies; 21+ messages in thread
From: David Miller @ 2016-02-24 15:20 UTC (permalink / raw)
  To: koct9i; +Cc: khlebnikov, netdev, containers, vvs, linux-kernel, ebiederm

From: Konstantin Khlebnikov <koct9i@gmail.com>
Date: Wed, 24 Feb 2016 08:16:59 +0300

> Major kernel upgrades always break something in weird setups.
> This shouldn't block bug fixing.

A bug for you is a feature for another person.  I'm standing by my
position, and will not apply this and break existing setups, sorry.

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH] ipv4: in new netns initialize sysctls in net.ipv4.conf.* with defaults
  2016-02-23 23:21   ` David Miller
  (?)
@ 2016-02-24 22:05       ` Eric W. Biederman
  -1 siblings, 0 replies; 21+ messages in thread
From: Eric W. Biederman @ 2016-02-24 22:05 UTC (permalink / raw)
  To: David Miller
  Cc: khlebnikov-XoJtRXgx1JseBXzfvpsJ4g, netdev-u79uwXL29TY76Z2rM5mHXA,
	containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	vvs-5HdwGun5lf+gSpxsJD1C4w, linux-kernel-u79uwXL29TY76Z2rM5mHXA

David Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org> writes:

> From: Konstantin Khlebnikov <khlebnikov-XoJtRXgx1JseBXzfvpsJ4g@public.gmane.org>
> Date: Sun, 21 Feb 2016 10:11:02 +0300
>
>> Currently initial net.ipv4.conf.all.* and net.ipv4.conf.default.* are
>> copied from init network namespace because static structures are used
>> for init_net. This makes no sense because new netns might be created
>> from any netns. This patch makes private copy also for init netns if
>> network namespaces are enabled. Other sysctls in net.ipv4 and net.ipv6
>> already initialized with default values at namespace creation.
>> 
>> Signed-off-by: Konstantin Khlebnikov <khlebnikov-XoJtRXgx1JseBXzfvpsJ4g@public.gmane.org>
>> Fixes: 752d14dc6aa9 ("[IPV4]: Move the devinet pointers on the struct net")
>
> The horse has long left the stable on this.  We cannot change this now
> without breaking things.
>
> Imagine someone who intentionally sets up init_net with a certain set
> of settings and expects them to propagate into every created namespace.
>
> We'll break things for them and given the behavior existed for so long
> what the administrator is doing is very reasonable.
>
> I'm not applying this sorry, we are stuck with the current behavior
> whether we like it or not.

Dave I won't argue that the patch reaches the proper trade-off with
existing software.  Certainly the lack of testing and other exploration
in this regard with the submitted patch is concerning.

In the general case the current behavior is random and not something
applications can count on, and we would do well to fix it so it is less
random.  In particular consider the case of an application in a
non-initial network namespace creating a new network namespace.  It is
not even possible to predict what values they will get for sysctls
today.

From a backwards compatibility standpoint we are probably better off
with copying from the current network namespace rather than the initial
network namespace.  As that more closely resembles the common case
today.

Having a statement of something that is a problem today with the
existing setup would probably be useful so it is clear this is not a
change for the sake of change.

Eric

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH] ipv4: in new netns initialize sysctls in net.ipv4.conf.* with defaults
@ 2016-02-24 22:05       ` Eric W. Biederman
  0 siblings, 0 replies; 21+ messages in thread
From: Eric W. Biederman @ 2016-02-24 22:05 UTC (permalink / raw)
  To: David Miller; +Cc: khlebnikov, netdev, containers, vvs, linux-kernel

David Miller <davem@davemloft.net> writes:

> From: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
> Date: Sun, 21 Feb 2016 10:11:02 +0300
>
>> Currently initial net.ipv4.conf.all.* and net.ipv4.conf.default.* are
>> copied from init network namespace because static structures are used
>> for init_net. This makes no sense because new netns might be created
>> from any netns. This patch makes private copy also for init netns if
>> network namespaces are enabled. Other sysctls in net.ipv4 and net.ipv6
>> already initialized with default values at namespace creation.
>> 
>> Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
>> Fixes: 752d14dc6aa9 ("[IPV4]: Move the devinet pointers on the struct net")
>
> The horse has long left the stable on this.  We cannot change this now
> without breaking things.
>
> Imagine someone who intentionally sets up init_net with a certain set
> of settings and expects them to propagate into every created namespace.
>
> We'll break things for them and given the behavior existed for so long
> what the administrator is doing is very reasonable.
>
> I'm not applying this sorry, we are stuck with the current behavior
> whether we like it or not.

Dave I won't argue that the patch reaches the proper trade-off with
existing software.  Certainly the lack of testing and other exploration
in this regard with the submitted patch is concerning.

In the general case the current behavior is random and not something
applications can count on, and we would do well to fix it so it is less
random.  In particular consider the case of an application in a
non-initial network namespace creating a new network namespace.  It is
not even possible to predict what values they will get for sysctls
today.

>From a backwards compatibility standpoint we are probably better off
with copying from the current network namespace rather than the initial
network namespace.  As that more closely resembles the common case
today.

Having a statement of something that is a problem today with the
existing setup would probably be useful so it is clear this is not a
change for the sake of change.

Eric

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH] ipv4: in new netns initialize sysctls in net.ipv4.conf.* with defaults
@ 2016-02-24 22:05       ` Eric W. Biederman
  0 siblings, 0 replies; 21+ messages in thread
From: Eric W. Biederman @ 2016-02-24 22:05 UTC (permalink / raw)
  To: David Miller
  Cc: khlebnikov-XoJtRXgx1JseBXzfvpsJ4g, netdev-u79uwXL29TY76Z2rM5mHXA,
	containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	vvs-5HdwGun5lf+gSpxsJD1C4w, linux-kernel-u79uwXL29TY76Z2rM5mHXA

David Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org> writes:

> From: Konstantin Khlebnikov <khlebnikov-XoJtRXgx1JseBXzfvpsJ4g@public.gmane.org>
> Date: Sun, 21 Feb 2016 10:11:02 +0300
>
>> Currently initial net.ipv4.conf.all.* and net.ipv4.conf.default.* are
>> copied from init network namespace because static structures are used
>> for init_net. This makes no sense because new netns might be created
>> from any netns. This patch makes private copy also for init netns if
>> network namespaces are enabled. Other sysctls in net.ipv4 and net.ipv6
>> already initialized with default values at namespace creation.
>> 
>> Signed-off-by: Konstantin Khlebnikov <khlebnikov-XoJtRXgx1JseBXzfvpsJ4g@public.gmane.org>
>> Fixes: 752d14dc6aa9 ("[IPV4]: Move the devinet pointers on the struct net")
>
> The horse has long left the stable on this.  We cannot change this now
> without breaking things.
>
> Imagine someone who intentionally sets up init_net with a certain set
> of settings and expects them to propagate into every created namespace.
>
> We'll break things for them and given the behavior existed for so long
> what the administrator is doing is very reasonable.
>
> I'm not applying this sorry, we are stuck with the current behavior
> whether we like it or not.

Dave I won't argue that the patch reaches the proper trade-off with
existing software.  Certainly the lack of testing and other exploration
in this regard with the submitted patch is concerning.

In the general case the current behavior is random and not something
applications can count on, and we would do well to fix it so it is less
random.  In particular consider the case of an application in a
non-initial network namespace creating a new network namespace.  It is
not even possible to predict what values they will get for sysctls
today.

>From a backwards compatibility standpoint we are probably better off
with copying from the current network namespace rather than the initial
network namespace.  As that more closely resembles the common case
today.

Having a statement of something that is a problem today with the
existing setup would probably be useful so it is clear this is not a
change for the sake of change.

Eric

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH] ipv4: in new netns initialize sysctls in net.ipv4.conf.* with defaults
  2016-02-24 22:05       ` Eric W. Biederman
@ 2016-02-25 14:20           ` Nicolas Dichtel
  -1 siblings, 0 replies; 21+ messages in thread
From: Nicolas Dichtel @ 2016-02-25 14:20 UTC (permalink / raw)
  To: Eric W. Biederman, David Miller
  Cc: khlebnikov-XoJtRXgx1JseBXzfvpsJ4g, netdev-u79uwXL29TY76Z2rM5mHXA,
	containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	vvs-5HdwGun5lf+gSpxsJD1C4w, linux-kernel-u79uwXL29TY76Z2rM5mHXA

Le 24/02/2016 23:05, Eric W. Biederman a écrit :
[snip]
> In the general case the current behavior is random and not something
> applications can count on, and we would do well to fix it so it is less
> random.  In particular consider the case of an application in a
> non-initial network namespace creating a new network namespace.  It is
> not even possible to predict what values they will get for sysctls
> today.
+1

>  From a backwards compatibility standpoint we are probably better off
> with copying from the current network namespace rather than the initial
> network namespace.  As that more closely resembles the common case
> today.
+1

_______________________________________________
Containers mailing list
Containers@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/containers

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH] ipv4: in new netns initialize sysctls in net.ipv4.conf.* with defaults
@ 2016-02-25 14:20           ` Nicolas Dichtel
  0 siblings, 0 replies; 21+ messages in thread
From: Nicolas Dichtel @ 2016-02-25 14:20 UTC (permalink / raw)
  To: Eric W. Biederman, David Miller
  Cc: khlebnikov, netdev, containers, vvs, linux-kernel

Le 24/02/2016 23:05, Eric W. Biederman a écrit :
[snip]
> In the general case the current behavior is random and not something
> applications can count on, and we would do well to fix it so it is less
> random.  In particular consider the case of an application in a
> non-initial network namespace creating a new network namespace.  It is
> not even possible to predict what values they will get for sysctls
> today.
+1

>  From a backwards compatibility standpoint we are probably better off
> with copying from the current network namespace rather than the initial
> network namespace.  As that more closely resembles the common case
> today.
+1

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH] ipv4: in new netns initialize sysctls in net.ipv4.conf.* with defaults
  2016-02-25 14:20           ` Nicolas Dichtel
@ 2016-02-25 16:43               ` David Miller
  -1 siblings, 0 replies; 21+ messages in thread
From: David Miller @ 2016-02-25 16:43 UTC (permalink / raw)
  To: nicolas.dichtel-pdR9zngts4EAvxtiuMwx3w
  Cc: khlebnikov-XoJtRXgx1JseBXzfvpsJ4g, netdev-u79uwXL29TY76Z2rM5mHXA,
	containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	ebiederm-aS9lmoZGLiVWk0Htik3J/w, vvs-5HdwGun5lf+gSpxsJD1C4w

From: Nicolas Dichtel <nicolas.dichtel-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
Date: Thu, 25 Feb 2016 15:20:48 +0100

> Le 24/02/2016 23:05, Eric W. Biederman a écrit :
> [snip]
>> In the general case the current behavior is random and not something
>> applications can count on, and we would do well to fix it so it is
>> less
>> random.  In particular consider the case of an application in a
>> non-initial network namespace creating a new network namespace.  It is
>> not even possible to predict what values they will get for sysctls
>> today.
> +1

But there is a counter argument to this.

The admin set up the initial namespace so that any namespace
instantiated by a user (even non-initial namespaces) starts with a
specific set of sysctl values.  So the admin "knows", he set it up
intentionally this way, and it's a valid model.

This behavior is anything but random.  Rather, it is very predictable
and controllable.

Do you really want to find out who you're going to break out there with
so many installations in the world right now?

I do not.

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH] ipv4: in new netns initialize sysctls in net.ipv4.conf.* with defaults
@ 2016-02-25 16:43               ` David Miller
  0 siblings, 0 replies; 21+ messages in thread
From: David Miller @ 2016-02-25 16:43 UTC (permalink / raw)
  To: nicolas.dichtel
  Cc: ebiederm, khlebnikov, netdev, containers, vvs, linux-kernel

From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Date: Thu, 25 Feb 2016 15:20:48 +0100

> Le 24/02/2016 23:05, Eric W. Biederman a écrit :
> [snip]
>> In the general case the current behavior is random and not something
>> applications can count on, and we would do well to fix it so it is
>> less
>> random.  In particular consider the case of an application in a
>> non-initial network namespace creating a new network namespace.  It is
>> not even possible to predict what values they will get for sysctls
>> today.
> +1

But there is a counter argument to this.

The admin set up the initial namespace so that any namespace
instantiated by a user (even non-initial namespaces) starts with a
specific set of sysctl values.  So the admin "knows", he set it up
intentionally this way, and it's a valid model.

This behavior is anything but random.  Rather, it is very predictable
and controllable.

Do you really want to find out who you're going to break out there with
so many installations in the world right now?

I do not.

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2016-02-25 16:43 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-21  7:11 [PATCH] ipv4: in new netns initialize sysctls in net.ipv4.conf.* with defaults Konstantin Khlebnikov
2016-02-21  7:11 ` Konstantin Khlebnikov
2016-02-21  9:25 ` Vasily Averin
2016-02-21  9:25   ` Vasily Averin
     [not found]   ` <56C9827D.3010103-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org>
2016-02-21 16:58     ` Konstantin Khlebnikov
2016-02-21 16:58       ` Konstantin Khlebnikov
2016-02-21 22:06 ` Eric W. Biederman
2016-02-21 22:06 ` Eric W. Biederman
2016-02-23 23:21 ` David Miller
2016-02-23 23:21   ` David Miller
     [not found]   ` <20160223.182121.2101846699151527296.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2016-02-24  5:16     ` Konstantin Khlebnikov
2016-02-24  5:16       ` Konstantin Khlebnikov
     [not found]       ` <CALYGNiNfuDzPr3+qE82CLVBvSTFQvyAyhWv9kzXbBrUO2jYMTQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-02-24 15:20         ` David Miller
2016-02-24 15:20           ` David Miller
2016-02-24 22:05     ` Eric W. Biederman
2016-02-24 22:05       ` Eric W. Biederman
2016-02-24 22:05       ` Eric W. Biederman
     [not found]       ` <87y4a9ix2h.fsf-JOvCrm2gF+uungPnsOpG7nhyD016LWXt@public.gmane.org>
2016-02-25 14:20         ` Nicolas Dichtel
2016-02-25 14:20           ` Nicolas Dichtel
     [not found]           ` <56CF0DC0.7030003-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2016-02-25 16:43             ` David Miller
2016-02-25 16:43               ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.