From: Florian Westphal <fw@strlen.de>
To: netfilter-devel@vger.kernel.org
Cc: eric.dumazet@gmail.com, Florian Westphal <fw@strlen.de>
Subject: [PATCH -next v2 6/6] netfilter: xtables: add upper limit on call chain depth
Date: Tue, 14 Jul 2015 17:51:11 +0200 [thread overview]
Message-ID: <1436889071-3637-7-git-send-email-fw@strlen.de> (raw)
In-Reply-To: <1436889071-3637-1-git-send-email-fw@strlen.de>
1024 is a very aggressive limit -- it will most likely not break any
real-world ruleset, but it might break certain iptables test scripts out
there.
If we were to use this limit it becomes feasible to allocate jump stack
directly via a percpu allocation (16kbytes needed per cpu in that case).
Signed-off-by: Florian Westphal <fw@strlen.de>
---
no changes since v1.
net/netfilter/x_tables.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c
index 9b42b5e..2be4f8e 100644
--- a/net/netfilter/x_tables.c
+++ b/net/netfilter/x_tables.c
@@ -39,6 +39,7 @@ MODULE_AUTHOR("Harald Welte <laforge@netfilter.org>");
MODULE_DESCRIPTION("{ip,ip6,arp,eb}_tables backend module");
#define SMP_ALIGN(x) (((x) + SMP_CACHE_BYTES-1) & ~(SMP_CACHE_BYTES-1))
+#define XT_MAX_STACKSIZE 1024
struct compat_delta {
unsigned int offset; /* offset in kernel */
@@ -735,6 +736,9 @@ static int xt_jumpstack_alloc(struct xt_table_info *i)
unsigned int size;
int cpu;
+ if (i->stacksize > XT_MAX_STACKSIZE)
+ return -ELOOP;
+
size = sizeof(void **) * nr_cpu_ids;
if (size > PAGE_SIZE)
i->jumpstack = vzalloc(size);
--
2.0.5
next prev parent reply other threads:[~2015-07-14 15:51 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-14 15:51 [PATCH -next v2 0/6] netfilter: xtables: improve jumpstack handling Florian Westphal
2015-07-14 15:51 ` [PATCH -next v2 1/6] netfilter: xtables: compute exact size needed for jumpstack Florian Westphal
2015-07-14 15:51 ` [PATCH -next v2 2/6] netfilter: move tee_active to core Florian Westphal
2015-07-14 15:51 ` [PATCH -next v2 3/6] netfilter: xtables: don't save/restore jumpstack offset Florian Westphal
2015-07-14 15:51 ` [PATCH -next 4/6] netfilter: add and use jump label for xt_tee Florian Westphal
2015-07-14 15:51 ` [PATCH -next 5/6] netfilter: xtables: remove __pure annotation Florian Westphal
2015-07-14 15:51 ` Florian Westphal [this message]
2015-07-15 17:17 ` [PATCH -next v2 0/6] netfilter: xtables: improve jumpstack handling Pablo Neira Ayuso
2015-07-15 18:52 ` Florian Westphal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1436889071-3637-7-git-send-email-fw@strlen.de \
--to=fw@strlen.de \
--cc=eric.dumazet@gmail.com \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).