* [PATCH] netfilter: nf_conntrack: reserve two bytes for nf_ct_ext->len (v3)
[not found] <20140328092449.GA20844@paralelels.com>
@ 2014-03-28 9:54 ` Andrey Vagin
2014-03-30 11:35 ` Pablo Neira Ayuso
0 siblings, 1 reply; 2+ messages in thread
From: Andrey Vagin @ 2014-03-28 9:54 UTC (permalink / raw)
To: linux-kernel
Cc: netfilter-devel, netfilter, coreteam, netdev, vvs, Andrey Vagin,
Pablo Neira Ayuso, Patrick McHardy, Jozsef Kadlecsik,
David S. Miller
"len" contains sizeof(nf_ct_ext) and size of extensions. In a worst
case it can contain all extensions. Bellow you can find sizes for all
types of extensions. Their sum is definitely bigger than 256.
nf_ct_ext_types[0]->len = 24
nf_ct_ext_types[1]->len = 32
nf_ct_ext_types[2]->len = 24
nf_ct_ext_types[3]->len = 32
nf_ct_ext_types[4]->len = 152
nf_ct_ext_types[5]->len = 2
nf_ct_ext_types[6]->len = 16
nf_ct_ext_types[7]->len = 8
I have seen "len" up to 280 and my host has crashes w/o this patch.
The right way to fix this problem is reducing the size of the ecache
extension (4) and Florian is going to do this, but these changes will
be quite large to be appropriate for a stable tree.
v2: rearrange the extension so ECACHE comes last. This is required to
prevent overflow of nf_ct_ext->offset.
v3: The previous attempt of rearranging constants doesn't work here,
because extensions may be added in a random order.
Fixes: 5b423f6a40a0 (netfilter: nf_conntrack: fix racy timer handling with reliable)
Cc: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Patrick McHardy <kaber@trash.net>
Cc: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
---
include/net/netfilter/nf_conntrack_extend.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/net/netfilter/nf_conntrack_extend.h b/include/net/netfilter/nf_conntrack_extend.h
index 956b175..55d1504 100644
--- a/include/net/netfilter/nf_conntrack_extend.h
+++ b/include/net/netfilter/nf_conntrack_extend.h
@@ -47,8 +47,8 @@ enum nf_ct_ext_id {
/* Extensions: optional stuff which isn't permanently in struct. */
struct nf_ct_ext {
struct rcu_head rcu;
- u8 offset[NF_CT_EXT_NUM];
- u8 len;
+ u16 offset[NF_CT_EXT_NUM];
+ u16 len;
char data[0];
};
--
1.8.5.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] netfilter: nf_conntrack: reserve two bytes for nf_ct_ext->len (v3)
2014-03-28 9:54 ` [PATCH] netfilter: nf_conntrack: reserve two bytes for nf_ct_ext->len (v3) Andrey Vagin
@ 2014-03-30 11:35 ` Pablo Neira Ayuso
0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2014-03-30 11:35 UTC (permalink / raw)
To: Andrey Vagin
Cc: linux-kernel, netfilter-devel, netfilter, coreteam, netdev, vvs,
Patrick McHardy, Jozsef Kadlecsik, David S. Miller
On Fri, Mar 28, 2014 at 01:54:32PM +0400, Andrey Vagin wrote:
> "len" contains sizeof(nf_ct_ext) and size of extensions. In a worst
> case it can contain all extensions. Bellow you can find sizes for all
> types of extensions. Their sum is definitely bigger than 256.
>
> nf_ct_ext_types[0]->len = 24
> nf_ct_ext_types[1]->len = 32
> nf_ct_ext_types[2]->len = 24
> nf_ct_ext_types[3]->len = 32
> nf_ct_ext_types[4]->len = 152
> nf_ct_ext_types[5]->len = 2
> nf_ct_ext_types[6]->len = 16
> nf_ct_ext_types[7]->len = 8
>
> I have seen "len" up to 280 and my host has crashes w/o this patch.
>
> The right way to fix this problem is reducing the size of the ecache
> extension (4) and Florian is going to do this, but these changes will
> be quite large to be appropriate for a stable tree.
>
> v2: rearrange the extension so ECACHE comes last. This is required to
> prevent overflow of nf_ct_ext->offset.
> v3: The previous attempt of rearranging constants doesn't work here,
> because extensions may be added in a random order.
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-03-30 11:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20140328092449.GA20844@paralelels.com>
2014-03-28 9:54 ` [PATCH] netfilter: nf_conntrack: reserve two bytes for nf_ct_ext->len (v3) Andrey Vagin
2014-03-30 11:35 ` Pablo Neira Ayuso
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).