All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: "Linus Lüssing" <linus.luessing@c0d3.blue>
Cc: netfilter-devel@vger.kernel.org, b.a.t.m.a.n@lists.open-mesh.org
Subject: Re: [B.A.T.M.A.N.] "Kernel bug detected [...] nf_ct_del_from_dying_or_unconfirmed_list"
Date: Sun, 27 Jan 2019 23:48:22 +0100	[thread overview]
Message-ID: <20190127224822.lsagihtfiuvxyool@breakpoint.cc> (raw)
In-Reply-To: <20190127214708.GC1788@otheros>

Linus Lüssing <linus.luessing@c0d3.blue> wrote:
> This only happens upon sending a SIGTERM to the network manager
> "netifd" (so upon network shutdown). And only if the node is connected
> to mesh of reasonable size, so if there is a certain amount of
> multicast traffic for the multicast-to-multi-unicast patch to work on.

Does this still trigger when you do

nf_reset(newskb);

after skb_copy()?

> One difference is that the broadcast flooding adds a bit of
> delay between each transmission. Which the multicast-to-multi-unicast
> doesn't.

Are those transmits done asynchronously?

conntrack assumes exclusive access to skb->nfct if the conntrack
entry isn't in main hash table.

(i.e, when nf_ct_is_confirmed returns false).

> "In nfqueue, two consecutive skbuffs may race to create the conntrack
>  entry. Hence, the one that loses the race gets dropped due to clash in
>  the insertion into the hashes from the nf_conntrack_confirm() path."
> 
> This patch is only part of >= 4.18, so not part of the firmware we use
> yet. Could this issue somehow be related?

Possible, but I don't think its likely.
In the nfquee case there is asynchronous processing, but
no skb can share the same conntrack entry unless the entry is already
in the conntrack hash table.

> Other than that I was wondering whether we might be missing to
> reset something after skb_copy()-ing. We do a "skb->protocol =
> htons(ETH_P_BATMAN)" right before the dev_queue_xmit(skb) call in
> batman-adv which sends the encapsulated frame into the
> mesh. And we do a nf_reset(skb) after decapsulating a frame
> received from the mesh. But maybe that is not enough?

I suggest nf_reset() on xmit, if you can be sure that the xmit
won't occur back-to-self (netns case is fine, as skb scrubbing
resets skb nfct anyway) and the skb isn't on a rexmit list somewhere.
(clone is fine, only shared skb would break).

WARNING: multiple messages have this Message-ID (diff)
From: Florian Westphal <fw-HFFVJYpyMKqzQB+pC5nmwQ@public.gmane.org>
To: "Linus Lüssing" <linus.luessing-djzkFPsfvsizQB+pC5nmwQ@public.gmane.org>
Cc: b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r@public.gmane.org,
	netfilter-devel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: "Kernel bug detected [...] nf_ct_del_from_dying_or_unconfirmed_list"
Date: Sun, 27 Jan 2019 23:48:22 +0100	[thread overview]
Message-ID: <20190127224822.lsagihtfiuvxyool@breakpoint.cc> (raw)
In-Reply-To: <20190127214708.GC1788@otheros>

Linus Lüssing <linus.luessing-djzkFPsfvsizQB+pC5nmwQ@public.gmane.org> wrote:
> This only happens upon sending a SIGTERM to the network manager
> "netifd" (so upon network shutdown). And only if the node is connected
> to mesh of reasonable size, so if there is a certain amount of
> multicast traffic for the multicast-to-multi-unicast patch to work on.

Does this still trigger when you do

nf_reset(newskb);

after skb_copy()?

> One difference is that the broadcast flooding adds a bit of
> delay between each transmission. Which the multicast-to-multi-unicast
> doesn't.

Are those transmits done asynchronously?

conntrack assumes exclusive access to skb->nfct if the conntrack
entry isn't in main hash table.

(i.e, when nf_ct_is_confirmed returns false).

> "In nfqueue, two consecutive skbuffs may race to create the conntrack
>  entry. Hence, the one that loses the race gets dropped due to clash in
>  the insertion into the hashes from the nf_conntrack_confirm() path."
> 
> This patch is only part of >= 4.18, so not part of the firmware we use
> yet. Could this issue somehow be related?

Possible, but I don't think its likely.
In the nfquee case there is asynchronous processing, but
no skb can share the same conntrack entry unless the entry is already
in the conntrack hash table.

> Other than that I was wondering whether we might be missing to
> reset something after skb_copy()-ing. We do a "skb->protocol =
> htons(ETH_P_BATMAN)" right before the dev_queue_xmit(skb) call in
> batman-adv which sends the encapsulated frame into the
> mesh. And we do a nf_reset(skb) after decapsulating a frame
> received from the mesh. But maybe that is not enough?

I suggest nf_reset() on xmit, if you can be sure that the xmit
won't occur back-to-self (netns case is fine, as skb scrubbing
resets skb nfct anyway) and the skb isn't on a rexmit list somewhere.
(clone is fine, only shared skb would break).

  reply	other threads:[~2019-01-27 22:48 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-27 21:47 [B.A.T.M.A.N.] "Kernel bug detected [...] nf_ct_del_from_dying_or_unconfirmed_list" Linus Lüssing
2019-01-27 21:47 ` Linus Lüssing
2019-01-27 22:48 ` Florian Westphal [this message]
2019-01-27 22:48   ` Florian Westphal
2019-01-28 13:35   ` [B.A.T.M.A.N.] " Chieh-Min Wang
2019-01-28 13:35     ` Chieh-Min Wang
2019-01-28 13:39     ` [B.A.T.M.A.N.] " Florian Westphal
2019-01-28 13:39       ` Florian Westphal
2019-01-28 13:50       ` [B.A.T.M.A.N.] " Pablo Neira Ayuso
2019-01-28 13:50         ` Pablo Neira Ayuso
2019-01-28 14:01         ` [B.A.T.M.A.N.] " Florian Westphal
2019-01-28 14:01           ` Florian Westphal
2019-01-28 14:03         ` [B.A.T.M.A.N.] " Chieh-Min Wang
2019-01-28 14:03           ` Chieh-Min Wang
2019-01-28 14:13           ` [B.A.T.M.A.N.] " Florian Westphal
2019-01-28 14:13             ` Florian Westphal
2019-01-28 14:16             ` [B.A.T.M.A.N.] " Chieh-Min Wang
2019-01-28 14:16               ` Chieh-Min Wang
2019-01-28 14:25               ` [B.A.T.M.A.N.] " Chieh-Min Wang
2019-01-28 14:25                 ` Chieh-Min Wang
2019-01-29  9:07 ` [B.A.T.M.A.N.] " Linus Lüssing
2019-01-29  9:07   ` Linus Lüssing

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=20190127224822.lsagihtfiuvxyool@breakpoint.cc \
    --to=fw@strlen.de \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    --cc=linus.luessing@c0d3.blue \
    --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 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.