netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] netfilter: don't permit unprivileged writes to global state via sysctls
@ 2016-09-23 22:21 Jann Horn
  2016-10-20 18:22 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 5+ messages in thread
From: Jann Horn @ 2016-09-23 22:21 UTC (permalink / raw)
  To: David S. Miller, Alexey Kuznetsov, James Morris, Hideaki YOSHIFUJI
  Cc: netdev, netfilter-devel

This prevents the modification of nf_conntrack_max in unprivileged network
namespaces. For unprivileged network namespaces, ip_conntrack_max is kept
as a readonly sysctl in order to minimize potential compatibility issues.

This patch should apply cleanly to the net tree.

Signed-off-by: Jann Horn <jann@thejh.net>
---
 net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
index ae1a71a..a639e94 100644
--- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
+++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
@@ -358,6 +358,9 @@ static int ipv4_init_net(struct net *net)
 	if (!in->ctl_table)
 		return -ENOMEM;
 
+	if (net->user_ns != &init_user_ns)
+		in->ctl_table[0].mode = 0444;
+
 	in->ctl_table[0].data = &nf_conntrack_max;
 	in->ctl_table[1].data = &net->ct.count;
 	in->ctl_table[2].data = &nf_conntrack_htable_size;
-- 
2.1.4

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

* Re: [PATCH] netfilter: don't permit unprivileged writes to global state via sysctls
  2016-09-23 22:21 [PATCH] netfilter: don't permit unprivileged writes to global state via sysctls Jann Horn
@ 2016-10-20 18:22 ` Pablo Neira Ayuso
  2016-10-20 18:37   ` David Miller
  0 siblings, 1 reply; 5+ messages in thread
From: Pablo Neira Ayuso @ 2016-10-20 18:22 UTC (permalink / raw)
  To: Jann Horn
  Cc: David S. Miller, Alexey Kuznetsov, James Morris,
	Hideaki YOSHIFUJI, netdev, netfilter-devel

On Sat, Sep 24, 2016 at 12:21:04AM +0200, Jann Horn wrote:
> This prevents the modification of nf_conntrack_max in unprivileged network
> namespaces. For unprivileged network namespaces, ip_conntrack_max is kept
> as a readonly sysctl in order to minimize potential compatibility issues.
> 
> This patch should apply cleanly to the net tree.

For the record: This patch looks good to me, but this legacy
ip_conntrack sysctl code is now gone.

I don't know what is the procedure to get this to -stable branches now
that this cannot be pushed upstream.

> Signed-off-by: Jann Horn <jann@thejh.net>
> ---
>  net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
> index ae1a71a..a639e94 100644
> --- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
> +++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
> @@ -358,6 +358,9 @@ static int ipv4_init_net(struct net *net)
>  	if (!in->ctl_table)
>  		return -ENOMEM;
>  
> +	if (net->user_ns != &init_user_ns)
> +		in->ctl_table[0].mode = 0444;
> +
>  	in->ctl_table[0].data = &nf_conntrack_max;
>  	in->ctl_table[1].data = &net->ct.count;
>  	in->ctl_table[2].data = &nf_conntrack_htable_size;
> -- 
> 2.1.4
> 

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

* Re: [PATCH] netfilter: don't permit unprivileged writes to global state via sysctls
  2016-10-20 18:22 ` Pablo Neira Ayuso
@ 2016-10-20 18:37   ` David Miller
  2016-10-22 21:23     ` Jann Horn
  0 siblings, 1 reply; 5+ messages in thread
From: David Miller @ 2016-10-20 18:37 UTC (permalink / raw)
  To: pablo; +Cc: jann, kuznet, jmorris, yoshfuji, netdev, netfilter-devel

From: Pablo Neira Ayuso <pablo@netfilter.org>
Date: Thu, 20 Oct 2016 20:22:24 +0200

> On Sat, Sep 24, 2016 at 12:21:04AM +0200, Jann Horn wrote:
>> This prevents the modification of nf_conntrack_max in unprivileged network
>> namespaces. For unprivileged network namespaces, ip_conntrack_max is kept
>> as a readonly sysctl in order to minimize potential compatibility issues.
>> 
>> This patch should apply cleanly to the net tree.
> 
> For the record: This patch looks good to me, but this legacy
> ip_conntrack sysctl code is now gone.
> 
> I don't know what is the procedure to get this to -stable branches now
> that this cannot be pushed upstream.

In the commit message for the -stable submission simply say "Not
applicable" in the upstream commit reference.  Like:

	[ Upstream commit: Not applicable ]

or something like that.

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

* Re: [PATCH] netfilter: don't permit unprivileged writes to global state via sysctls
  2016-10-20 18:37   ` David Miller
@ 2016-10-22 21:23     ` Jann Horn
  2016-10-22 22:43       ` David Miller
  0 siblings, 1 reply; 5+ messages in thread
From: Jann Horn @ 2016-10-22 21:23 UTC (permalink / raw)
  To: David Miller; +Cc: pablo, kuznet, jmorris, yoshfuji, netdev, netfilter-devel

[-- Attachment #1: Type: text/plain, Size: 1044 bytes --]

On Thu, Oct 20, 2016 at 02:37:47PM -0400, David Miller wrote:
> From: Pablo Neira Ayuso <pablo@netfilter.org>
> Date: Thu, 20 Oct 2016 20:22:24 +0200
> 
> > On Sat, Sep 24, 2016 at 12:21:04AM +0200, Jann Horn wrote:
> >> This prevents the modification of nf_conntrack_max in unprivileged network
> >> namespaces. For unprivileged network namespaces, ip_conntrack_max is kept
> >> as a readonly sysctl in order to minimize potential compatibility issues.
> >> 
> >> This patch should apply cleanly to the net tree.
> > 
> > For the record: This patch looks good to me, but this legacy
> > ip_conntrack sysctl code is now gone.
> > 
> > I don't know what is the procedure to get this to -stable branches now
> > that this cannot be pushed upstream.
> 
> In the commit message for the -stable submission simply say "Not
> applicable" in the upstream commit reference.  Like:
> 
> 	[ Upstream commit: Not applicable ]
> 
> or something like that.

Who should do that? Me, after getting a maintainer ack? Or the maintainer?

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH] netfilter: don't permit unprivileged writes to global state via sysctls
  2016-10-22 21:23     ` Jann Horn
@ 2016-10-22 22:43       ` David Miller
  0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2016-10-22 22:43 UTC (permalink / raw)
  To: jann; +Cc: pablo, kuznet, jmorris, yoshfuji, netdev, netfilter-devel

From: Jann Horn <jann@thejh.net>
Date: Sat, 22 Oct 2016 23:23:42 +0200

> On Thu, Oct 20, 2016 at 02:37:47PM -0400, David Miller wrote:
>> From: Pablo Neira Ayuso <pablo@netfilter.org>
>> Date: Thu, 20 Oct 2016 20:22:24 +0200
>> 
>> > On Sat, Sep 24, 2016 at 12:21:04AM +0200, Jann Horn wrote:
>> >> This prevents the modification of nf_conntrack_max in unprivileged network
>> >> namespaces. For unprivileged network namespaces, ip_conntrack_max is kept
>> >> as a readonly sysctl in order to minimize potential compatibility issues.
>> >> 
>> >> This patch should apply cleanly to the net tree.
>> > 
>> > For the record: This patch looks good to me, but this legacy
>> > ip_conntrack sysctl code is now gone.
>> > 
>> > I don't know what is the procedure to get this to -stable branches now
>> > that this cannot be pushed upstream.
>> 
>> In the commit message for the -stable submission simply say "Not
>> applicable" in the upstream commit reference.  Like:
>> 
>> 	[ Upstream commit: Not applicable ]
>> 
>> or something like that.
> 
> Who should do that? Me, after getting a maintainer ack? Or the maintainer?

When the maintainer submits a patch to -stable, that's what they
add to the commit message.

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

end of thread, other threads:[~2016-10-22 22:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-23 22:21 [PATCH] netfilter: don't permit unprivileged writes to global state via sysctls Jann Horn
2016-10-20 18:22 ` Pablo Neira Ayuso
2016-10-20 18:37   ` David Miller
2016-10-22 21:23     ` Jann Horn
2016-10-22 22:43       ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).