Linux Netfilter development
 help / color / mirror / Atom feed
From: Phil Sutter <phil@nwl.cc>
To: netfilter-devel@vger.kernel.org
Subject: Re: [iptables PATCH 1/3] ebtables: Clone extensions before modifying them
Date: Wed, 6 Nov 2024 00:03:31 +0100	[thread overview]
Message-ID: <ZyqkQ9cItcITsgYy@orbyte.nwl.cc> (raw)
In-Reply-To: <20241105203543.10545-1-phil@nwl.cc>

On Tue, Nov 05, 2024 at 09:35:41PM +0100, Phil Sutter wrote:
> Upon identifying an extension option, ebt_command_default() would have
> the extension parse the option prior to creating a copy for attaching to
> the iptables_command_state object. After copying, the (modified)
> initial extension's data was cleared.
> 
> This somewhat awkward process breaks with among match which increases
> match_size if needed (but never reduces it). This change is not undone,
> hence leaks into following instances. This in turn is problematic with
> ebtables-restore only (as multiple rules are parsed) and specifically
> when deleting rules as the potentially over-sized match_size won't match
> the one parsed from the kernel.
> 
> A workaround would be to make bramong_parse() realloc the match also if
> new size is smaller than the old one. This patch attempts a proper fix
> though, by making ebt_command_default() copy the extension first and
> parsing the option into the copy afterwards.
> 
> No Fixes tag: Prior to commit 24bb57d3f52ac ("ebtables: Support for
> guided option parser"), ebtables relied upon the extension's parser
> return code instead of checking option_offset, so copying the extension
> opportunistically wasn't feasible.
> 
> Signed-off-by: Phil Sutter <phil@nwl.cc>

Series applied.

      parent reply	other threads:[~2024-11-05 23:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-05 20:35 [iptables PATCH 1/3] ebtables: Clone extensions before modifying them Phil Sutter
2024-11-05 20:35 ` [iptables PATCH 2/3] ebtables: Simplify ebt_add_{match,watcher} Phil Sutter
2024-11-05 20:35 ` [iptables PATCH 3/3] tests: shell: Test ebtables-restore deleting among matches Phil Sutter
2024-11-05 22:03 ` [iptables PATCH 1/3] ebtables: Clone extensions before modifying them Florian Westphal
2024-11-05 23:03 ` Phil Sutter [this message]

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=ZyqkQ9cItcITsgYy@orbyte.nwl.cc \
    --to=phil@nwl.cc \
    --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