Netdev List
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Runyu Xiao <runyu.xiao@seu.edu.cn>
Cc: fw@strlen.de, netfilter-devel@vger.kernel.org,
	coreteam@netfilter.org, phil@nwl.cc, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	horms@kernel.org, ffmancera@riseup.net, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	jianhao.xu@seu.edu.cn
Subject: Re: [PATCH net] netfilter: nft_synproxy: stop bypassing the priv->info snapshot
Date: Thu, 11 Jun 2026 11:49:28 +0200	[thread overview]
Message-ID: <aiqEqH9GsBV4t_GU@chamomile> (raw)
In-Reply-To: <20260611042120.1462249-1-runyu.xiao@seu.edu.cn>

Hi,

On Thu, Jun 11, 2026 at 12:21:20PM +0800, Runyu Xiao wrote:
> nft_synproxy_eval_v4() and nft_synproxy_eval_v6() already take a
> whole-object READ_ONCE() snapshot of the shared priv->info state before
> building the SYNACK reply, but nft_synproxy_tcp_options() still masks
> opts->options with priv->info.options from the live shared object.
> 
> When a named synproxy object is updated concurrently with SYN traffic,
> the eval path can then mix mss and timestamp handling from the local
> snapshot with an options mask taken from a newer configuration, so one
> SYNACK no longer reflects a coherent synproxy configuration.
> 
> Use info->options so nft_synproxy_tcp_options() stays on the same local
> snapshot that the eval path already copied from priv->info.

I'll incorporate this to nf-next, this is good for correctness, but no
crash is associated.

> Fixes: ee394f96ad75 ("netfilter: nft_synproxy: add synproxy stateful object support")
> Cc: stable@vger.kernel.org
> Signed-off-by: Runyu Xiao <runyu.xiao@seu.edu.cn>
> ---
>  net/netfilter/nft_synproxy.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/net/netfilter/nft_synproxy.c b/net/netfilter/nft_synproxy.c
> index 7641f249614c..9ed288c9d168 100644
> --- a/net/netfilter/nft_synproxy.c
> +++ b/net/netfilter/nft_synproxy.c
> @@ -24,14 +24,13 @@ static const struct nla_policy nft_synproxy_policy[NFTA_SYNPROXY_MAX + 1] = {
>  static void nft_synproxy_tcp_options(struct synproxy_options *opts,
>  				     const struct tcphdr *tcp,
>  				     struct synproxy_net *snet,
> -				     struct nf_synproxy_info *info,
> -				     const struct nft_synproxy *priv)
> +				     struct nf_synproxy_info *info)
>  {
>  	this_cpu_inc(snet->stats->syn_received);
>  	if (tcp->ece && tcp->cwr)
>  		opts->options |= NF_SYNPROXY_OPT_ECN;
>  
> -	opts->options &= priv->info.options;
> +	opts->options &= info->options;
>  	opts->mss_encode = opts->mss_option;
>  	opts->mss_option = info->mss;
>  	if (opts->options & NF_SYNPROXY_OPT_TIMESTAMP)
> @@ -56,7 +55,7 @@ static void nft_synproxy_eval_v4(const struct nft_synproxy *priv,
>  
>  	if (tcp->syn) {
>  		/* Initial SYN from client */
> -		nft_synproxy_tcp_options(opts, tcp, snet, &info, priv);
> +		nft_synproxy_tcp_options(opts, tcp, snet, &info);
>  		synproxy_send_client_synack(net, skb, tcp, opts);
>  		consume_skb(skb);
>  		regs->verdict.code = NF_STOLEN;
> @@ -87,7 +86,7 @@ static void nft_synproxy_eval_v6(const struct nft_synproxy *priv,
>  
>  	if (tcp->syn) {
>  		/* Initial SYN from client */
> -		nft_synproxy_tcp_options(opts, tcp, snet, &info, priv);
> +		nft_synproxy_tcp_options(opts, tcp, snet, &info);
>  		synproxy_send_client_synack_ipv6(net, skb, tcp, opts);
>  		consume_skb(skb);
>  		regs->verdict.code = NF_STOLEN;
> -- 
> 2.34.1

      parent reply	other threads:[~2026-06-11  9:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-11  4:21 [PATCH net] netfilter: nft_synproxy: stop bypassing the priv->info snapshot Runyu Xiao
2026-06-11  8:15 ` Fernando Fernandez Mancera
2026-06-11  9:49 ` Pablo Neira Ayuso [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=aiqEqH9GsBV4t_GU@chamomile \
    --to=pablo@netfilter.org \
    --cc=coreteam@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=ffmancera@riseup.net \
    --cc=fw@strlen.de \
    --cc=horms@kernel.org \
    --cc=jianhao.xu@seu.edu.cn \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=phil@nwl.cc \
    --cc=runyu.xiao@seu.edu.cn \
    --cc=stable@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