All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sven Eckelmann <sven@narfation.org>
To: netdev@vger.kernel.org, Simon Wunderlich <sw@simonwunderlich.de>
Cc: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>,
	b.a.t.m.a.n@lists.open-mesh.org, stable@vger.kernel.org,
	Sashiko <sashiko-bot@kernel.org>,
	Simon Wunderlich <sw@simonwunderlich.de>
Subject: Re: [PATCH net 2/9] batman-adv: bla: avoid CRC corruption due to parallel claim add
Date: Sat, 22 Aug 2026 13:01:14 +0200	[thread overview]
Message-ID: <2277407.irdbgypaU6@sven-desktop> (raw)
In-Reply-To: <20260821094813.201800-3-sw@simonwunderlich.de>

[-- Attachment #1: Type: text/plain, Size: 2388 bytes --]

https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260821094813.201800-1-sw%40simonwunderlich.de?part=2

[...]
> > @@ -732,43 +734,56 @@ static void batadv_bla_add_claim(struct batadv_priv *bat_priv,
> >  			kfree(claim);
> >  			return;
> >  		}
> > +
> > +		spin_lock_bh(&backbone_gw->crc_lock);
> > +		backbone_gw->crc ^= claim_crc;
> > +		spin_unlock_bh(&backbone_gw->crc_lock);
> 
> Discovered by: gpt-5-6-sol, opus-5 · Missed by: sashiko-gemini
> This isn't an issue introduced by this patch, but how do these relative XOR
> updates interact with the absolute CRC store that still exists in
> batadv_bla_del_backbone_claims() at this commit?

Please, look literally one patch further.
https://lore.kernel.org/r/20260821094813.201800-4-sw@simonwunderlich.de

[...]
> Discovered by: gpt-5-6-sol, opus-5 · Missed by: sashiko-gemini
> This is a pre-existing inconsistency rather than something this patch
> introduces, but now that the compare and the swap of claim->backbone_gw
> both happen under claim->backbone_lock here, should the two remaining
> readers be annotated too?
> 
> net/batman-adv/bridge_loop_avoidance.c:batadv_bla_del_backbone_claims() {
> 	...
> 		hlist_for_each_entry_safe(claim, node_tmp,
> 					  head, hash_entry) {
> 			if (claim->backbone_gw != backbone_gw)
> 				continue;
> 	...
> }
> 
> net/batman-adv/bridge_loop_avoidance.c:batadv_bla_answer_request() {
> 	...
> 			/* only own claims are interesting */
> 			if (claim->backbone_gw != backbone_gw)
> 				continue;
> 	...
> }
> 
> Both do a plain load, not even READ_ONCE(), while types.h documents the
> field as:
> 
> 	/** @backbone_lock: lock protecting backbone_gw pointer */
> 	spinlock_t backbone_lock;
> 
> At both sites the pointer is only compared and never dereferenced, and in
> batadv_bla_del_backbone_claims() a stale comparison still keeps the CRC
> parity correct because the deferred batadv_claim_release() XORs the address
> out of whichever backbone the claim points at. So this looks like a
> KCSAN-visible plain-access race with no functional fallout, but would a
> READ_ONCE() or a comment on those two readers be worth adding so the
> documented locking rule matches the code?

No about this patch and definitely not high priority. Still made a ticket: 
https://www.open-mesh.org/issues/465 for Simon

Regards,
	Sven

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2026-08-22 11:01 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-21  9:48 [PATCH net 0/9] pull request: batman-adv 2026-08-21 Simon Wunderlich
2026-08-21  9:48 ` [PATCH net 1/9] batman-adv: fix stale receive device on merged fragments Simon Wunderlich
2026-08-22 10:52   ` Sven Eckelmann
2026-08-22 20:00   ` patchwork-bot+netdevbpf
2026-08-21  9:48 ` [PATCH net 2/9] batman-adv: bla: avoid CRC corruption due to parallel claim add Simon Wunderlich
2026-08-22 11:01   ` Sven Eckelmann [this message]
2026-08-21  9:48 ` [PATCH net 3/9] batman-adv: bla: prevent CRC corruptions after claim flush Simon Wunderlich
2026-08-22 11:15   ` Sven Eckelmann
2026-08-21  9:48 ` [PATCH net 4/9] batman-adv: dat: avoid unaligned fault in IP extraction Simon Wunderlich
2026-08-21  9:48 ` [PATCH net 5/9] batman-adv: dat: atomically update mac addresses Simon Wunderlich
2026-08-21  9:48 ` [PATCH net 6/9] batman-adv: fix TX priority extraction for BATADV_FORW_MCAST Simon Wunderlich
2026-08-22 11:34   ` Sven Eckelmann
2026-08-21  9:48 ` [PATCH net 7/9] batman-adv: mcast: ensure unshared skb for multicast packets Simon Wunderlich
2026-08-21  9:48 ` [PATCH net 8/9] batman-adv: mcast: linearize skbuff for packet generation Simon Wunderlich
2026-08-22 11:41   ` Sven Eckelmann
2026-08-21  9:48 ` [PATCH net 9/9] batman-adv: bla: fix freeing of claims on meshif deletion Simon Wunderlich
2026-08-22 11:56   ` Sven Eckelmann

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=2277407.irdbgypaU6@sven-desktop \
    --to=sven@narfation.org \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sashiko-bot@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=sw@simonwunderlich.de \
    /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.