Article View: linux.kernel.netdev
Article #21245Re: [PATCH v5 net-next 05/13] selftests: xsk: split xskxceiver main() into setup, run and cleanup
From: netdev-bot+sashiko
Date: Mon, 23 Nov 2026 18:46
Date: Mon, 23 Nov 2026 18:46
86 lines
11027 bytes
11027 bytes
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] cleanup_iface() in
tools/testing/selftests/net/lib/xsk/xskxceiver.c decides whether toβ¦
--
selftests: xsk: split xskxceiver main() into setup, run and cleanup
This commit restructures xskxceiver main() into separate setup, run and
cleanup steps, in preparation for running one endpoint per process. It
adds bind_iface(), detect_mode_caps(), mode_supported() and
cleanup_iface(), and makes run_pkt_test() return its result. It also
calls ksft_print_header() right after the command line is parsed.
> diff --git a/tools/testing/selftests/net/lib/xsk/xskxceiver.c b/tools/testing/selftests/net/lib/xsk/xskxceiver.c
> index d82224a4fa4b0..97eece4c57f89 100644
> --- a/tools/testing/selftests/net/lib/xsk/xskxceiver.c
> +++ b/tools/testing/selftests/net/lib/xsk/xskxceiver.c
[ ... ]
> +static void cleanup_iface(struct ifobject *ifobj)
> +{
> + if (ifobj->xdp_prog)
> + xsk_detach_xdp_program(ifobj->ifindex,
> + mode_to_xdp_flags(ifobj->mode));
> + xsk_unload_xdp_programs(ifobj);
> }
[Severity: Low]
Can a DRV mode program stay attached to the netdev after xskxceiver exits?
cleanup_iface() only uses ifobj->xdp_prog and ifobj->mode to decide
whether to detach and which flags to pass. xsk_reattach_xdp() in
test_xsk.c attaches the program first and updates those fields only after
the DRV mode check passes:
tools/testing/selftests/net/lib/xsk/test_xsk.c:xsk_reattach_xdp() {
...
err = xsk_attach_xdp_program(xdp_prog, ifobj->ifindex, mode_to_xdp_flags(mode));
if (err) {
...
}
if (ifobj->mode != mode && (mode == TEST_MODE_DRV || mode == TEST_MODE_ZC))
if (!xsk_is_in_mode(ifobj->ifindex, XDP_FLAGS_DRV_MODE)) {
ksft_print_msg("ERROR: XDP prog not in DRV mode\n");
return -EINVAL;
}
ifobj->xdp_prog = xdp_prog;
ifobj->xskmap = xskmap;
ifobj->mode = mode;
...
}
If the attach succeeds but xsk_is_in_mode() returns false, for example
because bpf_xdp_query() fails, the program stays attached in native mode
and the bookkeeping is never updated.
On a first attach, ifobj->xdp_prog is still NULL, so cleanup_iface()
skips the detach. If the interface was in SKB mode before,
cleanup_iface() detaches with XDP_FLAGS_SKB_MODE, which leaves the
native program in place.
Because bpf_xdp_attach() is a netlink attach, the program outlives the
process. The commit message says cleanup_iface() "copes with partially
initialized objects" and takes flags "so that they match the attach".
This partial attach state doesn't seem to be covered by either.
The same code is still there at the end of the series. Each process then
runs a single test, so no later reattach in that process can correct the
fields.
Would it make sense to record the program and mode in ifobj right after
xsk_attach_xdp_program() succeeds, or to detach with the requested flags
on that error path?
--
Sashiko AI review Β· https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261119164636.1071385-1-maciej.fijalkowski%40intel.com
Technical Details
Message-ID:
<179545959409.3135.16751084893051998673@kernel.org>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-369696-linux-kernel-netdev=dewy.ruReferences:
<20261119164636.1071385-6-maciej.fijalkowski@intel.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-369696-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH v5 net-next 05/13] selftests: xsk: split xskxceiver main() into setup, run and cleanup Date: Mon, 23 Nov 2026 18:46:34 +0000 Organization: Usenet Network Message-ID: <179545959409.3135.16751084893051998673@kernel.org> References: <20261119164636.1071385-6-maciej.fijalkowski@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="3957570"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:MeCZ2LwWe6IgLGNf5cASXnZvrqo= sha256:MAE7NRMaTxRGXE/E7mQmQ6TXBHvEEPMopa5WUtdAZ94= sha1:XPIfYQcAiKe6DykyqYMF8nC8Nss= sha256:nCFpS/A+HtkNKyL6AjEuFqglhtokdm4/w8UEsrPrGgM= 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 144B5125DC9; Mon, 23 Nov 2026 21:46:52 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.4 X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org 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 tANTyZKO5bJd; Mon, 23 Nov 2026 21:46:48 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-369696-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4]) by mail.dewy.ru (Postfix) with ESMTPS id D515F125DC5; Mon, 23 Nov 2026 21:46:39 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sin.lore.kernel.org (Postfix) with ESMTP id 01F05270BE; Mon, 23 Nov 2026 18:46:37 +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=1795459596; b=3uqKAmPZVSvWw2i74QkyabYFjU/CrL+7Mtrmc1sODTWBYQ71jZPj3kfIjSuKu1+6d+QU lAe54j28hkqBD3gUIHM668ZQ01iN5112ogcb0hSMCzb5AFt1ves7dfZwdILaP6uqog7G7 6lZovcLrLGq6UWqgJ4CBAYCw1u394dfu64GowtnKMIjr4OnEUhkUEJd3POOyiIHC5nh0B dXo4L6t26ybBxLVCTHGBaMcnQA+YxnLo0+JF6BebjOWGjLoSJyzOqWihd2YJi+8HQ35Po lrJe7hlibRxE/SHz9cg9SN1CFyo3Mwacg3nUDEu/zcD6aKqwtZnkhaMW/yCsrgY5vKA== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795459596; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=Bkb0N53UI7VBpm+nTdtNNJG0XnBjw0Wvm9W/e9w13+Y=; b=AKK1j1nKboFPx0rODojZNPd6D3I3lwLTlNGkz7su4g6Js28Nf2JFEA8OV76s9um+Z1IP Il6U/k9aMxIbBIR502drd6wwwsdcoBeCZ9g8q1Vj68MAqU2v0LkRdnlBKNNc7CjXOmsJI MF65gIxbHryTHx+TffY+botAcSZM1aGz7X8PCt9zbSp3qDGf28D39YAc3eoQNrlqetpsv N6uLqgVY4ekJErWxwYAO7n5OVOWzZPce4IaYw1vn+RViGSlDU7Vg/p7l3Cm8DL0r06pjS 3K3dtORrvZz0HPvwJ3zkGWW+Ekojj4J3BRQRS4CIPHefc3bsWAcnetpt0axRQCmmlQw== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=BNQfX4Mx; 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 61D0C606A31F; Mon, 23 Nov 2026 18:46:36 +0000 (UTC) X-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=BNQfX4Mx X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795459595; b=2JACWFoWjfkcfLNETBeZgOqP0WPXYMwdKpaiuXVxRKtvLXVNY8TjtTiAcNxe1N6rzzai ih/I0Xo7ZAFFJZ5S1pr3XgxocO2BV6gZgSjx2gWkPufkKHDY+LihVnIhuf2LIv7E3bHc1 VH2OU5qGfJnHu2pCVcdum0i41lgnknp32B0gPc9Z/gDBdY2+fQ7/T9IyBPD8eQSNSYaKc t9iI6CWm71Yl2gNWdf97qpA6NcH0eAtLDGVxzfgdSJAc8uuHIl/vVIqiFu45wofuWAOdp PxvgM3cQOT1LGAEcQWDGu6URXanr+KzFUpZ9z4b3efquF4MwaFAJ+RNcGVjfQOVOf/w== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795459595; 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=Bkb0N53UI7VBpm+nTdtNNJG0XnBjw0Wvm9W/e9w13+Y=; b=MOBn3T9SmhAZI1OOlScZE0rVO0IltLISD+LYccVI7gH3RlwrTrmWI+hH4RpuvtEslYul 9rZB5XE2ZsJlzkJXH1VzyyGXivlWIgbW2J31mU2TNODZCYsU0ivsxZdtVR7bJQqXxeU9v xKgWWWC+8ZPjbxkHELccmT1EAsqcI72b7BNmIG9WAhqNPXDjo7ySDpJGwyWlJELSxobKN IeHhTXFWQQhEBkSFzUuH3JfgLSk2GYI6XQZGzDmw4r3CDJxzrz/kmLPDVg/Ne8zX41alr XPwayNJNAyOR6KSa+wX9iXWdWyg5TBiL2d9BHgZaQwCplKWEAC9b8ZQUxP3UMSoQsjg== X-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=BNQfX4Mx; arc=none smtp.remote-ip=100.103.45.18 X-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 84D3F606A333 for <netdev@vger.kernel.org>; Mon, 23 Nov 2026 18:46:35 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7E20A1F000C4; Mon, 23 Nov 2026 18:46:34 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795459594; bh=Bkb0N53UI7VBpm+nTdtNNJG0XnBjw0Wvm9W/e9w13+Y=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=BNQfX4Mx5HWRBo/mSVupQpWPRvhYZ3XrVrrI9N4pkskVYv4GGmv7SHy948801Uuok ICkdvaWQIdjVejjxs3l/wv3l9k0X/s5Ld23oblmQQc6xo0C6+hdkHyZzT4mBYyjSzE Yx+zz6YlvKrjya9CvhG9FezlPfmL/Nn5oOe+orlgj9HMO9CuOesg5n3+JK3dil/BOL tU20ytBR7m032suOSzO737eoGxxK5jnia0NT87Rayj8FFD64cPgXdWr3aSBz38foFr 1Ci7y9eiI+oJD5F+exC5qKB66rbTtyi5Gd70G8SP1svY5oWoCX7Slmapwo9WbnQ4Po S3fr3qZxdid4g== X-Cc: netdev@vger.kernel.org, magnus.karlsson@intel.com, stfomichev@gmail.com, kuba@kernel.org, pabeni@redhat.com, tushar.vyavahare@intel.com, kerneljasonxing@gmail.com, bjorn@kernel.org X-In-Reply-To: <20261119164636.1071385-6-maciej.fijalkowski@intel.com> X-sashiko-severity: Low 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