Skip to content

gve: Fixes for issues discovered via net selftests and Sashiko

Harshitha Ramamurthy lkml netdev stable 5 versions – Applied

Status from this message: This series was applied to netdev/net.git (main)

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest4 patches 0 repliesApplied 4/4
  2. v44 patches 4 repliesSuperseded
  3. v34 patches 4 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v24 patches4 repliesSuperseded
v14 patches6 repliesSuperseded

Changes in v5 from the cover letter

- Link to v4: https://lore.kernel.org/netdev/[email protected]/
- Patch 1: Also protect the single-queue restart writes with stats_lock
(moved from patch 2) (Sashiko)
- Patch 1: Add a Fixes tag for 2e5e0932dff5, and clarify the commit
message and the stats_lock comment
- Patch 2: Mention the ndo_get_stats64 counters in the commit message
and add a Fixes tag for f5cedc84a30d (Sashiko)
- Patch 4: Keep queueing the service task after the synchronous link
status update, so that resets requested during reset/suspend are
handled once the queues come back up (Sashiko)
- Patch 2: Document that stats_lock also protects the baseline stats
- Patch 3: Explain the single fallback for both minimums in the commit
message
- Rebased to the latest net tree

Patches in v5 All 4 applied

#Subject and filesSizeRepliesApplied
1/4gve: Fix race between stats query and queue reconfigdrivers/net/ethernet/google/gve/gve.h drivers/net/ethernet/google/gve/gve_main.c+44 -40 repliesApplied
2/4gve: Fix backward stats when interface goes down or configuration is adjusteddrivers/net/ethernet/google/gve/gve.h drivers/net/ethernet/google/gve/gve_main.c+110 -220 repliesApplied
3/4gve: Block invalid ring sizes when device options are 0drivers/net/ethernet/google/gve/gve_adminq.c+3 -10 repliesApplied
4/4gve: Fix link flap after ethtool opsdrivers/net/ethernet/google/gve/gve_main.c+43 -300 repliesApplied

Reviews trailers per patch

2 of 4 patches have a Reviewed-by or Acked-by.

PatchJoshua WashingtonJordan Rhee
1/4
2/4
3/4R-b R-b
4/4R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v5 thread

Cover letter [PATCH net v5 0/4] gve: Fixes for issues discovered via net selftests and Sashiko

From: Pin-yen Lin <[email protected]>

This patch series addresses several issues in the gve driver. All four of these fixes were either uncovered by running the net selftests or suggested by Sashiko in the previous version.

The series includes the following changes:

- Patch 1 introduces a spinlock (stats_lock) to robustly synchronize stats queries (including ndo_get_stats64 and queue stats) against queue teardown and restart, preventing UAF and out-of-bounds reads. This was discovered by the drivers/net/stats.py selftest.
- Patch 2 fixes an issue where interface stats would go backwards when the interface was brought down or its configuration was adjusted. This was also discovered by the drivers/net/stats.py selftest.
- Patch 3 ensures the driver falls back to the default minimum ring size if the corresponding device option values are exposed as 0. This prevents userspace from configuring unexpectedly small ring sizes. This was discovered by the drivers/net/ring_reconfig.py selftest.
- Patch 4 makes sure ethtool configuration modifications are done synchronously before returning to the userspace. This was discovered by the drivers/net/ping.py selftest.

Changes in v5:
- Link to v4: https://lore.kernel.org/netdev/[email protected]/
- Patch 1: Also protect the single-queue restart writes with stats_lock
(moved from patch 2) (Sashiko)
- Patch 1: Add a Fixes tag for 2e5e0932dff5, and clarify the commit
message and the stats_lock comment
- Patch 2: Mention the ndo_get_stats64 counters in the commit message
and add a Fixes tag for f5cedc84a30d (Sashiko)
- Patch 4: Keep queueing the service task after the synchronous link
status update, so that resets requested during reset/suspend are
handled once the queues come back up (Sashiko)
- Patch 2: Document that stats_lock also protects the baseline stats
- Patch 3: Explain the single fallback for both minimums in the commit
message
- Rebased to the latest net tree

Changes in v4:
- Link to v3: https://lore.kernel.org/netdev/[email protected]/
- Patch 1: Clarify the commit message and change the Fixes tag (Sashiko)
- Patch 2: Report the live XDP TX ring counters in the base stats and
take stats_lock around the priv->rx[idx] writes in
gve_rx_queue_start() (Sashiko)
- Patch 4: Take netdev_lock() around the link status update in gve_service_task() (Sashiko)

Changes in v3:
- Link to v2: https://lore.kernel.org/netdev/[email protected]/
- Protect all stats queries and queue lifecycle updates with a spinlock (Sashiko)
- Drop u64_stats_sync for the base stats and use the spinlock instead
- Save base stats in gve_queues_mem_remove() and gve_rx_queue_stop()
- Drop unused rx_dropped and tx_dropped accumulation in
gve_add_base_stats()
- Fix the Fixes tag of patch 4
- Refined the commit messages
- Rebased to the latest net tree

Changes in v2:
- Add a NULL pointer check in gve_get_ring_err_stats() (Sashiko)
- Use local variable to prevent inflates from u64_stats_fetch_retry() (Sashiko)
- Add u64_stats_fetch/begin to protect base stats (Sashiko)

Debarghya Kundu (1):
gve: Fix backward stats when interface goes down or configuration is
adjusted

Pin-yen Lin (3):
gve: Fix race between stats query and queue reconfig
gve: Block invalid ring sizes when device options are 0
gve: Fix link flap after ethtool ops

 drivers/net/ethernet/google/gve/gve.h        |  12 +
 drivers/net/ethernet/google/gve/gve_adminq.c |   4 +-
 drivers/net/ethernet/google/gve/gve_main.c   | 239 ++++++++++++++-----
 3 files changed, 199 insertions(+), 56 deletions(-)

base-commit: 787268686c64be60023743b527645a907e38ccca

Signature · 1 line
2.56.0.455.g6c5a503b38-goog