From: Florian Westphal <fw@strlen.de>
To: Fernando Fernandez Mancera <fmancera@suse.de>
Cc: netfilter-devel@vger.kernel.org, coreteam@netfilter.org,
jeremy@azazel.net, phil@nwl.cc, pablo@netfilter.org
Subject: Re: [PATCH nf v2] netfilter: nft_bitwise: fix dst corruption in same register shifts
Date: Thu, 23 Apr 2026 14:27:35 +0200 [thread overview]
Message-ID: <aeoQMCJ7x0tGoUFC@strlen.de> (raw)
In-Reply-To: <20260423120538.3704-1-fmancera@suse.de>
Fernando Fernandez Mancera <fmancera@suse.de> wrote:
> In nft_bitwise_eval_lshift() and nft_bitwise_eval_rshift(), shift
> operations are performed in a loop over 32-bit words. The loop
> calculates the shifted value, writes it to dst, and calculates the carry
> from src for the next iteration.
>
> If the source and destination registers overlap either exactly (sreg ==
> dreg) or partially (e.g., dreg is offset from sreg by 4 bytes) the loop
> overwrites src data before it can be read by subsequent iterations. This
> causes the carry or the shifted data itself to be incorrectly calculated
> using the newly modified dst value instead of the original src payload.
We should support overlaps (src == dst). But partial overlaps?
Does nft generate such byte code?
I think we should reject it. Either userspace has no more use
for src (and can clobber it with the shifted result), or it has
to keep it for later reuse. But in what case is a partially clobbered
register useful?
next prev parent reply other threads:[~2026-04-23 12:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-23 12:05 [PATCH nf v2] netfilter: nft_bitwise: fix dst corruption in same register shifts Fernando Fernandez Mancera
2026-04-23 12:27 ` Florian Westphal [this message]
2026-04-23 12:34 ` Fernando Fernandez Mancera
2026-04-23 12:38 ` Florian Westphal
2026-04-23 14:49 ` Pablo Neira Ayuso
2026-04-23 14:50 ` Fernando Fernandez Mancera
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=aeoQMCJ7x0tGoUFC@strlen.de \
--to=fw@strlen.de \
--cc=coreteam@netfilter.org \
--cc=fmancera@suse.de \
--cc=jeremy@azazel.net \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
--cc=phil@nwl.cc \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.