From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796268901; b=nMglpWDHA1CJQ2m1xjtdd2nhUszmJdXMe3gELUBayfgQ6v22ZPscE5ZRpYMgtLX676gv DPEfsz1mpn4h4VhIifr3sKbiFNcjw52T+yjnq1i2A5j8l4SAK9Sib/jdIMlXqG2ltRN4L 4frMPL7Wm6JcWCoNgIwGYbDsc91E909egShLp/tILMU0fLSzEv92fiYTvULQI0fWQHhA/ JA+AifQRhXHB4TM7QAihNFH0V+kw6OXsj/rV7E2od3jafJsvuUiItdHfWownAJahkiHOS QWgR8UjW5kYmIWmsIkMstINUgZi/Q2q8fA0e415iI/06OcDufkO8P1kYTbL30IaOIjQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796268901; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=MNzwmHUORohpg+3V2xbwK4MYM6czpC/Nm+tDRaV1wzg=; b=uC2+WKGAkJrkp0noT8NNgGJ5uoSrFZdFkkFLLhqahf23EEvFCuWeBbGHit0i8wtQA/hC FhmGLHqf9VayM/LFKXUV0TQrSAs/589liMfSmHP8785iKWuC6QQQshmhLoAyWJYaJCwPL LxGoH5AgdpNoDsM7vBRFR5m5Y3ocG0oraU0TlgwqJV+jce2Yek7lktFRCGBNifKwDbdQN AMVRmpcMnB3ch/TW8pBH0bVaveNRX1csQwvv7X6HGMsfjI673Wjs1OVlanF0ntjMu4Ohb 4dwuMni3ysD+DEkBp9W4ClIBYdNZQAOAxRkFwgAjgOwUAAVmI1E2D1aC51hEkYxhuCg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=b41xam2C; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 19DB2606A32D; Thu, 3 Dec 2026 03:35:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=b41xam2C Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F3E11F00893; Thu, 3 Dec 2026 03:35:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796268900; bh=MNzwmHUORohpg+3V2xbwK4MYM6czpC/Nm+tDRaV1wzg=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=b41xam2C9Lw0M54OKDJPihsD+F0GKrZ39iKbYYCDpj1h5pxCNmYVJqddzREWx4Lqw CZGl9Bme6a79Kn7dUcblKNV3QkwWjA+B41XxDv7xXMg3HHosX6hwD6JCIAfQjSld39 S1p6N4vJ9h05Wrgf3RXmhMetek6cpg8hfWD43ddEVFlxZeyDsavTwYQBEXgGDGYqm8 QEBDbY7F/KN+I9E4EiuChz61/GVV1ZipkymLI4L32+MbOS8NFsIpVjWqml2kN9ZJMt ZEmNcqWWtHBlyr6DsxWw/4/iu+C7ed475QPyDo1giNmaD0UUIgAGf7cHwIq92e7qiI Wi/8kuOfL9HyQ== Subject: Re: [PATCH net-next 1/2] bonding: reseed the ARP monitor when it starts From: netdev-bot+sashiko@kernel.org To: ramses@well-founded.dev Cc: jv@jvosburgh.net, andrew+netdev@lunn.ch, davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, jbohac@suse.cz, edumazet@kernel.org, willemb@google.com, horms@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, razor@blackwall.org, hangbin.liu@linux.dev, shuah@kernel.org Date: Thu, 03 Dec 2026 03:34:59 +0000 Message-ID: <179626889957.3146.496772262611026903@kernel.org> In-Reply-To: <20261201-bonding-arp-reseed-v1-1-984d4a3991cb@well-founded.dev> References: <20261201-bonding-arp-reseed-v1-1-984d4a3991cb@well-founded.dev> X-sashiko-severity: Medium Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider. Critical: 0 · High: 0 · Medium: 1 · Low: 3 If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough). - [Medium] bond_arp_seed_slave() breaks the invariant that the patch's own removed comment protected: "Not seeding it later than last_link_up… - [Low] This patch fixes a long-standing bug that users can hit, but the commit message has no Fixes: tag and no Cc: stable. - [Low] bond_arp_seed_slave() decides the seed from slave->link alone. - [Low] bond_arp_reseed_slaves() has the comment "Call before recv_probe is set and arp_work is queued", but bond_option_arp_interval_set()… -- bonding: reseed the ARP monitor when it starts This moves the enslave-time ARP timestamp seeding into a new helper, bond_arp_seed_slave(), and adds bond_arp_reseed_slaves(). The new function reseeds every slave when the ARP monitor starts, either from bond_open() or when arp_interval goes from 0 to nonzero on a running bond. Without the reseed, the first monitor run uses stale enslave-time timestamps and marks UP slaves down. Link: https://lore.kernel.org/netdev/20261030-bonding-last-rx-v5-0-0b9b653f2f94@well-founded.dev/ > diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c > index 754048ef4835d..a015f20e0718e 100644 > --- a/drivers/net/bonding/bond_main.c > +++ b/drivers/net/bonding/bond_main.c > @@ -1888,6 +1888,40 @@ void bond_xdp_set_features(struct net_device *bond_dev) > xdp_set_features_flag(bond_dev, val); > } > > +/* Seed a slave that is not UP outside the up window. Give a slave that is > + * UP a full arp_missed_max window. > + */ > +static void bond_arp_seed_slave(struct bonding *bond, struct slave *slave) > +{ > + unsigned long seed; > + int i; > + > + if (slave->link == BOND_LINK_UP) { > + slave->last_link_up = jiffies; > + seed = slave->last_link_up; > + } else { > + seed = jiffies - > + (2 * msecs_to_jiffies(bond->params.arp_interval) + 1); > + } [Severity: Medium] When a slave is not BOND_LINK_UP, this branch moves last_rx and target_last_arp_rx[] forward to jiffies - (2 * delta + 1) and leaves last_link_up alone. Can that make slave_last_rx() later than last_link_up for curr_active_slave? The code this patch removes from bond_enslave() said: Not seeding it later than last_link_up keeps bond_arp_rcv() from trusting ARPs on backup slaves before the active one got a reply. At enslave time a slave that is not UP can't be curr_active_slave, so the else branch did no harm there. At reseed time it can be. Take active-backup with miimon and downdelay > 0. During the downdelay window curr_active_slave sits in BOND_LINK_FAIL. Its last_link_up still holds the time bond_change_active_slave() made it active, which may be long ago. If arp_interval is set during that window, or the bond is reopened after such a switch, the else branch runs via: bond_option_arp_interval_set()->bond_arp_reseed_slaves()-> bond_arp_seed_slave() That makes this check in bond_arp_rcv() true right away: else if (curr_active_slave && time_after(slave_last_rx(bond, curr_active_slave), curr_active_slave->last_link_up)) bond_validate_arp(bond, slave, tip, sip); bond_na_rcv() has the same check. last_rx only moves forward, so the check stays true until last_link_up changes. Would backup slaves then validate broadcast ARP requests and NS messages with swapped addresses? That includes the bond's own probes when the switch reflects them back. The backups could then stay up even when the target is unreachable. bond_option_arp_validate_set() also doesn't reject arp_validate while miimon is active. > + > + WRITE_ONCE(slave->last_rx, seed); > + for (i = 0; i < BOND_MAX_ARP_TARGETS; i++) > + WRITE_ONCE(slave->target_last_arp_rx[i], seed); > + WRITE_ONCE(slave->last_tx, seed); > +} > + > +/* Call before recv_probe is set and arp_work is queued. */ > +void bond_arp_reseed_slaves(struct bonding *bond) [ ... ] > @@ -4415,6 +4430,7 @@ static int bond_open(struct net_device *bond_dev) > queue_delayed_work(bond->wq, &bond->mii_work, 0); > > if (bond->params.arp_interval) { /* arp interval, in milliseconds. */ > + bond_arp_reseed_slaves(bond); [Severity: Low] bond_arp_seed_slave() picks the seed from slave->link alone. On an ARP-only bond (arp_interval set, miimon=0), can slave->link be stale at this point? bond_enslave() sets the initial link from netif_carrier_ok() at enslave time. After that, nothing updates slave->link while the bond is down: - no monitor is running - bond_slave_netdev_event() only refreshes speed/duplex and the slave array on NETDEV_UP/CHANGE/DOWN - bond_close() doesn't reset it Suppose a slave had carrier at enslave and lost it before the bond was brought up. bond_open()->bond_arp_reseed_slaves() still sees BOND_LINK_UP and sets last_link_up, last_rx and last_tx to jiffies. bond_ab_arp_inspect() then skips that slave for the 2 * delta grace window. If it is curr_active_slave, it is only proposed down once last_rx leaves the missed_max window. With the defaults that is roughly 2.5 * arp_interval. During that time bond_xmit_activebackup() keeps sending to a slave with no carrier. Before the patch, the stale seed got it marked down on the first monitor run. Should bond_open() re-check carrier before reseeding, as bond_enslave() does for ARP-only bonds? If not, should the commit message mention this trade-off? [Severity: Low] This isn't a bug, but the commit message says systemd-networkd users hit this. Should the patch carry a Fixes: tag and Cc: stable? The enslave-only seeding goes back to commit f31c7937c254 ("bonding: start slaves with link down for ARP monitor") and commit 8e603460fa38 (last_link_up seeding). Commit 9231c2b6f180 ("bonding: give a slave that starts UP a full arp_missed_max window") also says this case was left as it was: When the monitor starts later, from bond_open() or when arp_interval is set at runtime, the seed is still as old as the time since enslavement, as it was before this patch. > queue_delayed_work(bond->wq, &bond->arp_work, 0); > WRITE_ONCE(bond->recv_probe, bond_rcv_validate); > } > diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c > index 9efadeff6a223..1f40adc0b7fb1 100644 > --- a/drivers/net/bonding/bond_options.c > +++ b/drivers/net/bonding/bond_options.c > @@ -1128,6 +1128,8 @@ static int bond_option_use_carrier_set(struct bonding *bond, > static int bond_option_arp_interval_set(struct bonding *bond, > const struct bond_opt_value *newval) > { > + bool start = !bond->params.arp_interval && newval->value; > + > netdev_dbg(bond->dev, "Setting ARP monitoring interval to %llu\n", > newval->value); > WRITE_ONCE(bond->params.arp_interval, newval->value); > @@ -1150,9 +1152,11 @@ static int bond_option_arp_interval_set(struct bonding *bond, > WRITE_ONCE(bond->recv_probe, NULL); > cancel_delayed_work_sync(&bond->arp_work); > } else { > + cancel_delayed_work_sync(&bond->mii_work); > + if (start) > + bond_arp_reseed_slaves(bond); [Severity: Low] The new bond_arp_reseed_slaves() has the comment "Call before recv_probe is set and arp_work is queued." Does this caller always meet that condition? bond_option_miimon_set() handles a switch from ARP to MII by setting arp_interval to 0 and cancelling arp_work, but it never clears bond->recv_probe. Going from nonzero to 0 in this function only clears recv_probe when arp_validate is set: if (bond->params.arp_validate) WRITE_ONCE(bond->recv_probe, NULL); In both cases recv_probe is still bond_rcv_validate when arp_interval later goes from 0 to nonzero on a running bond with start == true. The reseed then runs while bond_handle_frame()->bond_rcv_validate() can run in softirq on the slaves. With arp_validate=none, bond_rcv_validate() does: WRITE_ONCE(slave->last_rx, jiffies); and the reseed can overwrite that fresh receive with the down seed. With arp_validate set, bond_arp_rcv() and bond_na_rcv() read curr_active_slave->last_link_up locklessly. bond_arp_seed_slave() writes the same field with a plain store. When recv_probe was NULL, the reseed stores are not ordered with WRITE_ONCE(bond->recv_probe, bond_rcv_validate) by any release/acquire pair. A weakly ordered CPU could briefly see recv_probe set while still reading the old timestamps. bond_open() doesn't have this problem, because bond_close() clears recv_probe and calls synchronize_net(). Should the comment be relaxed, or should this path clear recv_probe and wait for readers before reseeding? > /* arp_validate can be set only in active-backup mode */ > WRITE_ONCE(bond->recv_probe, bond_rcv_validate); > - cancel_delayed_work_sync(&bond->mii_work); > queue_delayed_work(bond->wq, &bond->arp_work, 0); > } > } -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261201-bonding-arp-reseed-v1-0-984d4a3991cb%40well-founded.dev