Netdev List
 help / color / mirror / Atom feed
From: Minxi Hou <houminxi@gmail.com>
To: netdev@vger.kernel.org, netdev-bot+sashiko@kernel.org
Cc: Aaron Conole <aconole@redhat.com>,
	Eelco Chaudron <echaudro@redhat.com>,
	Ilya Maximets <i.maximets@ovn.org>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>, Shuah Khan <shuah@kernel.org>,
	linux-kselftest@vger.kernel.org
Subject: Re: [PATCH net v4 1/2] net: openvswitch: do not record user features when the change fails
Date: Tue, 17 Nov 2026 12:10:48 -0500	[thread overview]
Message-ID: <20261117171048.1732084-1-houminxi@gmail.com> (raw)
In-Reply-To: <179484682026.3136.13753538826492049125@kernel.org>

On 16/11/2026 16:33, netdev-bot+sashiko@kernel.org wrote:
> [Severity: High] Can this early clear of dp->user_features race with
> upcalls that are still in flight?

It can, and you are right about the two reads. __dp_destroy() runs before
the ports are detached and before the datapath leaves the list, so
queue_userspace_packet() can be between its two reads while it runs:
OVS_DP_F_UNALIGNED decides whether the skb is copied as fragments, and
pad_packet() reads the same field again to decide whether to pad. A store
that clears the whole bitmap between them can make pad_packet() pad a skb
whose message was sized for the smaller linear part, so the padding has
nowhere to go.

Your second suggestion is what the respin does. __dp_destroy() now clears
only the bit that path was already dropping:

	ovs_dp_set_user_features(dp, dp->user_features &
				     ~OVS_DP_F_TC_RECIRC_SHARING);

The ovs_dp_cmd_new() error path frees the datapath without going through
__dp_destroy(), and it writes the field the same way now, so it does not
open the same window from that side. ovs_dp_reset_user_features() still
clears everything, which is the point of it: an outdated user space
instance re-adding a datapath is supposed to lose the features.

I took the snapshot for the older variant as well, since a set can change
OVS_DP_F_UNALIGNED just as easily as a destroy can.
queue_userspace_packet() reads the field once and hands that value to
pad_packet(), so the head room and the padding always agree and a set in
the middle can no longer split them. The setter stores through
WRITE_ONCE() for the same reason: the receive path reads the field
without ovs_mutex.

> Low priority / nit picks for your consideration:
> - The patch adds `exec 9>&1` and `ovs_fail()` so that a FAIL prints
>   its reason on the real stdout.
> - The patch runs `exec 9>&1` once at the top level of openvswitch.sh
>   (line 52) and never closes it.

Both are gone, and the fd was worse than a style problem. The daemons the
suite starts inherit the handle, and the kselftest runner reads the test
output from a pipe, so the pipe never reached EOF: every subtest reported
OK and the run then sat there until the harness timed out. Matthieu
reported exactly that from the CI side. Those messages go to stderr now,
which still reaches the runner from inside ovs_sbx and is not held open by
anything that outlives the script.

> - ovs_dp_features_check's comment says "A show that fails and a datapath
>   that reports other features are different faults, so they..."

Rewritten in the respin, and it turned out to be a real bug: ovs-dpctl
prints "No DP found" and exits 0, and it leaves the features line out when
the kernel does not report them, so the check reported both of those as a
feature mismatch. Both are
recognised in the output now, and the "could not run" status is left for
the CLI failing.

You also asked in the earlier review of the series whether the return 2
path can be reached with the datapath missing. It cannot, and that is the
same mistake as above. The recirc failure should have used ovs_fail rather
than info(), and it does now, as do the sets that only did "|| return 1",
so a FAIL carries its reason.

pw-bot: cr

  reply	other threads:[~2026-11-17 17:11 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-15 16:31 [PATCH net v4 0/2] net: openvswitch: fix a feature leak on a failed change Minxi Hou
2026-11-15 16:31 ` [PATCH net v4 1/2] net: openvswitch: do not record user features when the change fails Minxi Hou
2026-11-16 16:33   ` netdev-bot+sashiko
2026-11-17 17:10     ` Minxi Hou [this message]
2026-11-15 16:31 ` [PATCH net v4 2/2] selftests/net/openvswitch: check that a failed set keeps the features Minxi Hou
2026-11-16 16:33   ` netdev-bot+sashiko
2026-11-15 20:12 ` [PATCH net v4 0/2] net: openvswitch: fix a feature leak on a failed change netdev-bot+sinfo
2026-11-16  1:32   ` Minxi Hou
2026-11-16 11:58 ` Matthieu Baerts
2026-11-16 12:32   ` Minxi Hou

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=20261117171048.1732084-1-houminxi@gmail.com \
    --to=houminxi@gmail.com \
    --cc=aconole@redhat.com \
    --cc=echaudro@redhat.com \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=i.maximets@ovn.org \
    --cc=kuba@kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev-bot+sashiko@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shuah@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