🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #22366

[PATCH net v3 0/5] vmxnet3: fix native XDP crash on oversized frames and XDP loss on reset

#22366
From: Philipp Sudakas
Date: Wed, 25 Nov 2026 07:52
120 lines
16236 bytes
Fixes for native XDP on vmxnet3. A single frame from any host on the
same L2 segment can crash a guest that has an XDP program attached;
any device reset silently stops XDP; and a failure while switching XDP
on or off leaves a stale program pointer and a half torn-down device.

Patch 1: the rx data ring XDP path leaves rx_ctx.skb pointing at the
ring head page after a non-PASS verdict. Patch 4 relies on rx_ctx.skb
being NULL between frames.

Patch 2: when vmxnet3_xdp_set() fails to recreate the rx queues or to
reactivate the device, it neither rolls back the program exchange nor
restarts or closes the device. A failed attach now brings the device
back up without XDP and returns the error; a failed detach is
completed, so the driver and the core agree; if the device cannot be
restarted, the interface is closed. Patch 5 removes the side effect
that used to hide the stale pointer.

Patch 3: with an MTU between 3051 and VMXNET3_XDP_MAX_MTU, full-sized
frames do not fit the 3072-byte rx head buffer. Limit the XDP MTU so
that they do.

Patch 4: a frame that does not fit in one XDP rx buffer (sop without
eop) reaches the skb path, which takes the page_pool page for an skb:
kernel BUG in skb_put(). With MTU 1500, a single untagged frame of
1523..1526 bytes is enough. Drop such frames. This also fixes an older
cross-poll BUG_ON on the non-XDP path; see the commit message.

Patch 5: vmxnet3_rq_cleanup_all() clears xdp_bpf_prog on every quiesce
(MTU change, down/up, ring resize, reset). XDP stops being called while
the program is still reported as attached, and its reference leaks.

Reproduced with stock modules on Debian kernels 6.12.113, 6.12.117 and
7.2.12 (7.2.12 untainted), VMware virtual hardware version 20. A small
reproducer (raw frame sender and an XDP_PASS counter program) is
available on request.

Testing (v3):
- Run-tested: the patched vmxnet3 files of net as of today, with the
  driver's current vmxnet3_ethtool.c and headers, built as a module for
  a Debian 7.2.12 kernel; VMware virtual hardware version 20, MTU 1500,
  native XDP:
  - untagged frames of 1514..1522 bytes reach XDP; 1523, 1524 and
    1526 bytes are dropped and counted in drop_total; no crash
    (v2 also: 1530 bytes with a VLAN 0 tag are dropped);
  - 5000 frames of 1500 bytes mixed with 5000 of 1524 bytes: exactly
    5000 XDP passes and 5000 drops;
  - with XDP_DROP attached, small frames over the rx data ring
    (64 and 100 bytes) are dropped by XDP, followed by normal and
    oversized frames without issue;
  - after an MTU change, down/up and an rx ring resize the same
    program keeps running; after detach no program is left loaded;
  - MTU 3051 is refused with XDP attached and attaching at MTU 3051
    is refused; at MTU 3050 frames of 3064 bytes reach XDP and 3073
    bytes are dropped;
  - replacing a running program: the new one runs, the old one is
    freed;
  - failures were forced with a test-only module parameter that makes
    the next N vmxnet3_rq_create_all() calls in vmxnet3_xdp_set() fail
    with -ENOMEM:
    - attach, 1 failure: the error is returned, no XDP program is
      attached or left loaded, the interface stays up and receives,
      and a new attach works;
    - attach, 2 failures (recovery fails too): the error is returned,
      no program, the interface is down; after "ip link set up" it
      receives;
    - detach, 1 failure: 0 is returned, no program is attached or left
      loaded, the interface is down; after "ip link set up" it
      receives;
    - attach while the interface is down does not reconfigure the
      device and is not affected.
  No warnings in dmesg. (An intermediate version that used
  vmxnet3_force_close() on failure triggered "Trying to free
  already-free IRQ", hence dev_close() in patch 2.)
- Not covered: the rx_error paths, failures inside
  vmxnet3_activate_dev() itself (only the queue creation failure was
  forced), and VLAN tags other than 0, which the test switch does not
  pass.

Changes in v3:
- Patch 2 reworked after automated review of v2 (Sashiko): on a failed
  attach restart the device without XDP, complete a failed detach
  instead of restoring the old program (dev_xdp_detach_link() ignores
  the error), close the interface if the device cannot be restarted,
  return the real error, change the redirect target feature only once
  the change is done (also when the interface is down), and use
  rtnl_dereference(). It does not wait for VMXNET3_STATE_BIT_RESETTING
  under RTNL, which could deadlock against vmxnet3_reset_work(). New
  subject.
- Patch 4: count the two body buffer allocation failures in
  drop_total, so that skipping rx_error for a dropped frame never
  loses a count; the commit message now says that the non-XDP path
  changes too, and that the drop is not counted against the NAPI
  budget, like other non-PASS XDP verdicts.
- Patch 3: fixed a line over 80 columns.
- v2: https://lore.kernel.org/netdev/20261123124855.1021-1-filzador@gmail.com/

Changes in v2:
- New patches 1, 2 and 3, the rx_error double count fix in patch 4, and
  no NAPI budget accounting for the dropped frame in patch 4.
- v1: https://lore.kernel.org/netdev/20261122002847.616-1-filzador@gmail.com/

The problems were found and analysed, and the patches drafted, with
the help of an AI coding assistant; reproduction and testing were run
on the reporter's lab systems.

Philipp Sudakas (5):
  vmxnet3: clear rx_ctx.skb after a data ring XDP verdict
  vmxnet3: fix the error path of XDP program setup
  vmxnet3: limit the XDP MTU to the rx head buffer size
  vmxnet3: drop XDP frames that do not fit in one rx buffer
  vmxnet3: keep the XDP program across device resets

 drivers/net/vmxnet3/vmxnet3_drv.c | 31 +++++++++++-
 drivers/net/vmxnet3/vmxnet3_xdp.c | 84 +++++++++++++++++++++----------
 drivers/net/vmxnet3/vmxnet3_xdp.h | 10 +++-
 3 files changed, 95 insertions(+), 30 deletions(-)

-- 
2.47.3
Technical Details
Message-ID: <20261125075255.1517-1-filzador@gmail.com>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!2.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-371111-linux-kernel-netdev=dewy.ru

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!2.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-371111-linux-kernel-netdev=dewy.ru
From: filzador@gmail.com (Philipp Sudakas)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net v3 0/5] vmxnet3: fix native XDP crash on oversized frames and XDP loss on reset
Date: Wed, 25 Nov 2026 10:52:50 +0300
Organization: Usenet Network
Message-ID: <20261125075255.1517-1-filzador@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network; logging-data="149097"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:8TeNa3yfqhKsbS5Y9LZ6VD99R/Y= sha256:WCa0QrSjuTPfq9ew/RkL9qZMzO5EAP0i65cEHewxbX8= sha1:rnFi+3y10HJhnvLTtLP0i/0dK34= sha256:yP5zDJGUrfJQDBDgk6rM++Q/7uOhbhr9+jNSgox7Uq0=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 806AD125E41; Wed, 25 Nov 2026 10:53:25 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.049
X-Spam-Status: No, score=-3.049 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com
X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ycKpWQdFIulW; Wed, 25 Nov 2026 10:53:21 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-371111-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 5B755125E40; Wed, 25 Nov 2026 10:53:13 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 9C17E29E9D; Wed, 25 Nov 2026 07:53:11 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1795593189; b=TJAJM4eSgRm8U+had8ldH8aX7ksiicVuIuR2vkJJB6reioZ805Qmm0UrIkk8q77FaTwI jX5jcgNV+76ZY9VjSr+z6UPxfV3b9PTWUltifdDpxHj0ZWlw2EBjvBWPjiJGrlLYP9jtc h2JeQrAiizzshd25h7Xs7+nrRoCS7XDbcr/fKy0PdHE5QgJt5aeKp5FW431bX7iQbHL3S ShogVGYGSmLUg7xpeWvX3owgbC258pqpELLqj9mHm52m2bc0ipRQE8msUXxnAXFnwmZcL qsorXSAEfGybbP81Y+cPE3qyv6XmAhQZp0NHgQttrVyYVap1amko1/GcXw/JyqUEHsQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795593189; h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature: X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg:X-Received: Received:From:To:Cc:Subject:Date:Message-ID:X-Mailer:X-Mailing-List: List-Id:List-Post:List-Help:List-Subscribe:List-Unsubscribe: List-Owner:Precedence:MIME-Version:Content-Transfer-Encoding; bh=zf9bT3s9LlKEPRvd3hDZDLoiBKI5UFbuOVhEvjeVPsA=; b=cXIcBikneDOizaSN0zX000TKOtyucCjXWLeuM9iH+ZO1RBNfsUDVDbGQ+EWruv5Qa0j5 k1pJAie+fBDlbwZ4tNnKy9fTllg6pR1MxCxIxEk9AlxU6mElUGX/SltmXi8CwqYiIehc6 QFJXgODNGpkO7dPXyFYi/wgWwdXypkoxCBZnLn1uq6x2tQz4HS4fcJZyOyclOXTptqXfm LKIy6n7lrsddlTu4swTbaozKCBbIWKtsH3QJVQSpM1uCpt36Pp+6zTmvIul9KzBEpV5cn 1jJgmMAvBoUrQx2uMl9OmH3AZ9yGBxLO7OZJ88L2bKFfP/CraqPU5prjcmsBnlUvhYQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=hiRBpv9q; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 79B52606A321; Wed, 25 Nov 2026 07:53:09 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=hiRBpv9q
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.46
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795593188; b=fQOoLxfKGZjf3mv3WFmAbnaCPMr9BhSoPJMYCYPzbH3PtOcQda3C6ksqrTdqB/S92Guy KZaaohILqW36i2SxM0nhKltwyINPLNlwGnd6DyMl6mdF0/E8OTtKq+P/bF/vmoM6+CQdz nweSx5+eO7tzciSik27JpOVKnPL0BPXChX3nE/eCrfFnB2Ow4q/Pbnz5Sdv7KNSE5DF1W LjSRt9YDJuxaCRbEGAoYXW+z9q3uS7RCD1INt5N6705hc6f0hdsBtdsTN5QvDd0UPItH4 Ih04MYim4MGEP2BWclc2Om7X+U9S/8jradoLJVBxQF7mXOXWS6gEt4TsMs3NcD2f3Jg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795593188; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:To:Cc:Subject: Date:Message-ID:X-Mailer:MIME-Version:Content-Transfer-Encoding; bh=zf9bT3s9LlKEPRvd3hDZDLoiBKI5UFbuOVhEvjeVPsA=; b=QZxgLGMzSKcKaxrg6CGekYawOIO8QEBFq0dfYuo18CP+J1kAxXHuQMfYbAToWDmMrMJu Q36hqpViN+XT9OKOrCUZvKP7aK/8fRf8bDZtIrswHUkbe5T3J5n4Wf765lkDK75Rwa7pi dhTfNyovln50SCLpcnfIdzyGYlVlY2OpR1pTzdB+H7PFx0o3Nwnx+CGZH6MXkHRVcEbuy RrC7G3b9Uxn/dkUpcWoqEAGYfgr/gX8P7a26VzPdpj8P2mF0ocjkHY3w/mg8FpULl5ISF BiamuKHCoeQWFdA+yv2lwSJYyx9qPsK1E6RCZDGZVjwfwF1rBWePYUVqYFxHipYqLSA==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=hiRBpv9q; arc=none smtp.remote-ip=209.85.221.46
X-Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 46935606A31E for <netdev@vger.kernel.org>; Wed, 25 Nov 2026 07:53:08 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 46935606A31E
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-4ad6219f7d8so4721661f8f.0 for <netdev@vger.kernel.org>; Tue, 24 Nov 2026 23:53:08 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1795593186; x=1796197986; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=zf9bT3s9LlKEPRvd3hDZDLoiBKI5UFbuOVhEvjeVPsA=; b=hiRBpv9q/vOunC5kU5u8bpgrywiQq7ASpBIOlKeRlIX3xeczrKzMl/olm/kNSQI2fD JS5njJjmdoXlc8xTb46BqEhuGcCT5G+bJGBWI9B44LQN2zmy0tdO1/ZRrFaFVbjoAvbK tkPVGUc+ACY7Z+UC433c/LEa8RsVFb7M8TwvmSHSF5mEa3u7kE1yMzvUGHhrtR56YGOf KXuhHnZY5NYEyDNeAizUuKXTcs2UfvNMj5BnhHs1yCNrElWR3w+jrhnHAzRVH6GFiqxQ IRwA8Qt6yCiG2Q3tFvZEXLlhzoFiOtzHggw/XFXySvre9DXWJMJUlQVPkTJ5O7oIlyU/ +NlQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795593186; x=1796197986; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=zf9bT3s9LlKEPRvd3hDZDLoiBKI5UFbuOVhEvjeVPsA=; b=HahGFh4h60I+rVV+gKyFtgd7LcMTnGh0PWno0GQI1+Ixcx/UTbl4W/mrt/GBhNHGkj iyRkLpPzrc0ZTarhbuEv9v2pFWDIS15f30zw6ZoPiLdOQQ2q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8f.18.1795593186427; Tue, 24 Nov 2026 23:53:06 -0800 (PST)
X-Received: from Philipp-PC ([91.227.186.127]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4ab6a680483sm33001138f8f.28.2026.11.24.23.53.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Nov 2026 23:53:06 -0800 (PST)
X-Cc: netdev@vger.kernel.org, bpf@vger.kernel.org, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, ast@kernel.org, daniel@iogearbox.net, hawk@kernel.org, john.fastabend@gmail.com, sdf@fomichev.me, u9012063@gmail.com, Philipp Sudakas <filzador@gmail.com>
X-Mailer: git-send-email 2.56.0.windows.4
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list