All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Arno DUBOIS <arno.du@orange.fr>
Cc: netfilter@vger.kernel.org
Subject: Re: Segmentation fault when adding a simple rule
Date: Sat, 30 Aug 2025 11:56:04 +0200	[thread overview]
Message-ID: <aLLKtFpWRlJYhIwV@strlen.de> (raw)
In-Reply-To: <CAJo4=a3VTOJjETWWbuKrLYSKUMO+0zqC-aDF+stycF1F--3NmQ@mail.gmail.com>

Arno DUBOIS <arno.du@orange.fr> wrote:
> I've been trying to switch my Kube CNIs to use nftables directly.
> However, I get coredumps everywhere in my system.
> 
> I successfully extracted the commands sent to the tool from the CNI:
> ```
> add table inet cni_plugins_masquerade
> add chain inet cni_plugins_masquerade masq_checks
> add chain inet cni_plugins_masquerade postrouting { type nat hook
> postrouting priority 100 ; }
> flush chain inet cni_plugins_masquerade postrouting
> 
> add rule inet cni_plugins_masquerade postrouting ip daddr ==
> 224.0.0.0/24  return
> add rule inet cni_plugins_masquerade postrouting ip6 daddr == ff00::/8  return
> add rule inet cni_plugins_masquerade postrouting goto masq_checks
> add rule inet cni_plugins_masquerade masq_checks ip saddr ==
> 10.244.0.198 ip daddr != 10.244.0.0/24 masquerade
> ```
> I definitely am not an nftables professional, but they seem correct to me.

Yes.

> When running that, at the minute I try to add the rules (if I run the
> commands one by one) I receive a SEGFAULT (after some processing
> time).
> I did do a quick run with GDB if that can help:

Thanks, this helps indeed.

> (gdb) run add rule inet cni_plugins_masquerade postrouting ip daddr
> 192.168.1.1 return
> Starting program: /usr/bin/nft add rule inet cni_plugins_masquerade
> postrouting ip daddr 192.168.1.1 return
> [Thread debugging using libthread_db enabled]
> Using host libthread_db library "/lib64/libthread_db.so.1".
> 
> Program received signal SIGSEGV, Segmentation fault.
> 0x0000000000000000 in ?? ()
> (gdb) bt
> #0  0x0000000000000000 in ?? ()
> #1  0x00007ffff7ef3740 in set_make_key (attr=0x5555556017e6) at
> src/netlink.c:919

This is crashing when decoding the set/map key of the existing ruleset.

I think its the bug fixed with

be737a1986bf ("src: netlink: fix crash when ops doesn't support udata")

... which went into nftables 1.1.4 release.

      reply	other threads:[~2025-08-30  9:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-29 23:40 Segmentation fault when adding a simple rule Arno DUBOIS
2025-08-30  9:56 ` Florian Westphal [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=aLLKtFpWRlJYhIwV@strlen.de \
    --to=fw@strlen.de \
    --cc=arno.du@orange.fr \
    --cc=netfilter@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 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.