Netdev List
 help / color / mirror / Atom feed
* [PATCH net v3 0/2] net: openvswitch: fix a feature leak on a failed change
@ 2026-11-10 17:46 Minxi Hou
  2026-11-10 17:46 ` [PATCH net v3 1/2] net: openvswitch: do not record user features when the change fails Minxi Hou
  2026-11-10 17:46 ` [PATCH net v3 2/2] selftests/net/openvswitch: check that a failed set keeps the features Minxi Hou
  0 siblings, 2 replies; 3+ messages in thread
From: Minxi Hou @ 2026-11-10 17:46 UTC (permalink / raw)
  To: netdev
  Cc: Aaron Conole, Eelco Chaudron, Ilya Maximets, David S . Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Simon Horman,
	Paul Blakey, Jamal Hadi Salim, Shuah Khan, dev, linux-kselftest

ovs_dp_change() records the requested user features before it calls the
update that can fail, so a request rejected for an empty per-cpu-pids
leaves the datapath claiming a feature it never enabled. The tc skb
extension key is a reference count shared with cls_flower, and the code
that would keep it in step is skipped on that path.

Patch 1 fixes the ordering, and drops the reference on the two other
paths that take one and never give it back. Patch 2 adds a set-dp
command to the openvswitch selftest tool, and two tests that send such a
request and check the features the datapath reports afterwards. They
fail without the fix and pass with it.

The problem turned up while the YNL spec for this family was being
written: describing the ovs_datapath set command meant reading
ovs_dp_change(), where the ordering stands out.

---
Changes in v3:
- Patch 1 drops the tc skb extension reference on the other two paths
  that take one and lose it: a datapath that fails after ovs_dp_change()
  enabled the key, and the reset that runs for an outdated user space
  instance. The description separates the users that hold a reference
  from the ones that only read the key.
- Patch 1 records the features last, in a setter that takes and drops the
  reference along with them, so the rule has one home instead of four
  copies, and no caller holds a snapshot of the old value across the
  update. The datapath.h entry says what the bit means.
- The recirc round is a test of its own, so a kernel without the option
  reports one passing test and one skip instead of hiding both, and the
  skip reason goes to stdout so a run that skipped it is not silent.
  The EOPNOTSUPP number is read from python, because it differs between
  architectures outside the base list.
- The tests also cover the reset that an outdated client triggers, check
  that the datapath keeps working across it, and use datapath names of
  their own. The reference count itself cannot be observed from user
  space, which the commit message says.
- The selftest cleans up its sandbox before it reports a skip, the way
  the other mid-test skips in the file do.
- The config fragment selects NET_SCHED and NET_CLS_ACT along with
  NET_TC_SKB_EXT, since the tc symbols sit under them.
- set-dp refuses to send a set when the datapath reports no features,
  and reports a bad pid list instead of a traceback.
- Three prints use f-strings, which keeps the lint delta at zero.

Changes in v2:
- Patch 1 limits its closing claim to OVS_DP_CMD_SET.
- Patch 1 names the reachability and the effect: only CAP_NET_ADMIN is
  needed, datapath_policy does not validate the per-cpu-pids attribute,
  and a disable on a count of zero warns in static_key_dec_not_one().
- Patch 2 treats only EOPNOTSUPP as the missing key and skips with the
  kselftest skip code; any other failure fails the test.
- Patch 2 selects CONFIG_NET_CLS_ACT and CONFIG_NET_TC_SKB_EXT in the
  selftest config fragment, so the recirc round runs in CI.
- Patch 2 sends the features the datapath reports when --features is
  left out, instead of clearing them.

v1: https://lore.kernel.org/netdev/20261107113403.797779-1-houminxi@gmail.com/
v2: https://lore.kernel.org/netdev/20261108123424.2825403-1-houminxi@gmail.com/
Signed-off-by: Minxi Hou <houminxi@gmail.com>

Minxi Hou (2):
  net: openvswitch: do not record user features when the change fails
  selftests/net/openvswitch: check that a failed set keeps the features

 net/openvswitch/datapath.c                    |  34 +++--
 net/openvswitch/datapath.h                    |   5 +-
 .../testing/selftests/net/openvswitch/config  |   3 +
 .../selftests/net/openvswitch/openvswitch.sh  | 126 ++++++++++++++++++
 .../selftests/net/openvswitch/ovs-dpctl.py    |  60 +++++++++
 5 files changed, 214 insertions(+), 14 deletions(-)


base-commit: 8373c4e8863ac5f5120d200527aca9880330f343

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-10 17:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-10 17:46 [PATCH net v3 0/2] net: openvswitch: fix a feature leak on a failed change Minxi Hou
2026-11-10 17:46 ` [PATCH net v3 1/2] net: openvswitch: do not record user features when the change fails Minxi Hou
2026-11-10 17:46 ` [PATCH net v3 2/2] selftests/net/openvswitch: check that a failed set keeps the features Minxi Hou

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox