netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Patrick McHardy <kaber@trash.net>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH 2/3] netfilter: nf_tables: check for overflow of rule dlen field
Date: Thu, 5 Mar 2015 18:11:50 +0100	[thread overview]
Message-ID: <20150305171150.GA7275@salvia> (raw)
In-Reply-To: <20150305163122.GW29092@acer.localdomain>

On Thu, Mar 05, 2015 at 04:31:22PM +0000, Patrick McHardy wrote:
> On 05.03, Pablo Neira Ayuso wrote:
> > On Tue, Mar 03, 2015 at 08:04:19PM +0000, Patrick McHardy wrote:
> > > Check that the space required for the expressions doesn't exceed the
> > > size of the dlen field, which would lead to the iterators crashing.
> > > 
> > > Signed-off-by: Patrick McHardy <kaber@trash.net>
> > > ---
> > >  net/netfilter/nf_tables_api.c | 4 ++++
> > >  1 file changed, 4 insertions(+)
> > > 
> > > diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
> > > index 6fb532b..7baafd5 100644
> > > --- a/net/netfilter/nf_tables_api.c
> > > +++ b/net/netfilter/nf_tables_api.c
> > > @@ -1968,6 +1968,10 @@ static int nf_tables_newrule(struct sock *nlsk, struct sk_buff *skb,
> > >  			n++;
> > >  		}
> > >  	}
> > > +	/* Check for overflow of dlen field */
> > > +	err = -EFBIG;
> > 
> > Should we use -EOVERFLOW instead as we use in other nf_tables spots?
> > 
> > The error in userspace will be: "Value too large for defined data type".
> 
> I think the difference here is that we don't use a userspace provided
> value but overflow because of the size of kernel internal structures and
> the data type limit.

OK, we also have it when we pass too large amount of data for a
register IIRC.

> I don't have any strong feelings either way, but I think its different
> from the cases where we use EOVERFLOW so far.

I don't have any strong opinion, just asking. You know we shouldn't
change this afterwards.

Let me know.

  reply	other threads:[~2015-03-05 17:08 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-03 20:04 [PATCH 0/3] netfilter: nf_tables fixes Patrick McHardy
2015-03-03 20:04 ` [PATCH 1/3] netfilter: nf_tables: fix transaction race condition Patrick McHardy
2015-03-04 16:18   ` Pablo Neira Ayuso
2015-03-04 16:26     ` Patrick McHardy
2015-03-04 17:01       ` Pablo Neira Ayuso
2015-03-04 17:03         ` Patrick McHardy
2015-03-04 17:28           ` Pablo Neira Ayuso
2015-03-04 17:36             ` Patrick McHardy
2015-03-04 17:38               ` Patrick McHardy
2015-03-03 20:04 ` [PATCH 2/3] netfilter: nf_tables: check for overflow of rule dlen field Patrick McHardy
2015-03-05 16:31   ` Pablo Neira Ayuso
2015-03-05 16:31     ` Patrick McHardy
2015-03-05 17:11       ` Pablo Neira Ayuso [this message]
2015-03-05 17:13         ` Patrick McHardy
2015-03-05 17:42           ` Pablo Neira Ayuso
2015-03-05 18:15             ` Patrick McHardy
2015-03-03 20:04 ` [PATCH 3/3] netfilter: nf_tables: fix userdata length overflow Patrick McHardy
2015-03-05 20:23 ` [PATCH 0/3] netfilter: nf_tables fixes Pablo Neira Ayuso

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=20150305171150.GA7275@salvia \
    --to=pablo@netfilter.org \
    --cc=kaber@trash.net \
    --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).