From: sashiko-bot@kernel.org
To: "Octavian Purdila" <tavip@google.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH net 09/10] selftests: drv-net: devmem: test unreadable kTLS RX
Date: Fri, 04 Dec 2026 21:09:38 +0000 [thread overview]
Message-ID: <sashiko-outbox-250675@kernel.org> (raw)
In-Reply-To: <62d1a0251d6eef295df7215f274cce53dec2d6e9.1796329894.git.tavip@google.com>
Thank you for your contribution! Sashiko AI review found 4 potential
issues to consider:
- [Medium] selftests: drv-net: hardcoded UDMABUF_CREATE breaks
non-generic arches
- [Low] selftests: drv-net: devmem: check_rx_tls() missing
ksft_disruptive decorator
- [Low] selftests: drv-net: unchecked cm.exception.errno in run_rx_tls()
- [Low] selftests: drv-net: missing/late netlink close in
_setup_devmem_rx_queue()
--
commit 410173c7bfe04f4674fa99cc975e15cce6f0d840
Author: Octavian Purdila <tavip@google.com>
selftests: drv-net: devmem: test unreadable kTLS RX
This commit adds an end-to-end devmem.py regression test that binds a
devmem RX queue from Python and verifies that configuring kTLS TLS_RX on
a socket with queued unreadable devmem fragments rejects the record with
EFAULT.
> diff --git a/tools/testing/selftests/drivers/net/hw/devmem.py b/tools/testing/selftests/drivers/net/hw/devmem.py
> index 82c11ffc4add7..d15118060d261 100755
> --- a/tools/testing/selftests/drivers/net/hw/devmem.py
> +++ b/tools/testing/selftests/drivers/net/hw/devmem.py
[ ... ]
> @@ -36,12 +36,17 @@ def check_rx_large_niov(cfg) -> None:
> run_rx_large_niov(cfg)
>
>
> +def check_rx_tls(cfg) -> None:
> + """Run the unreadable kTLS RX test."""
> + run_rx_tls(cfg)
[Severity: Low]
Should check_rx_tls() be annotated with @ksft_disruptive?
run_rx_tls() -> _setup_devmem_rx_queue() reconfigures ring HDS parameters
via ethnl.rings_set(), which bounces the interface on drivers like bnxt
(bnxt_set_ringparam() -> bnxt_close_nic()). Without @ksft_disruptive,
running devmem.py with DISRUPTIVE=False on a single-interface host still
executes this test and can disconnect NETIF.
[ ... ]
> diff --git a/tools/testing/selftests/drivers/net/hw/devmem_lib.py b/tools/testing/selftests/drivers/net/hw/devmem_lib.py
> index 71b916c161969..75199a01ca3fc 100644
> --- a/tools/testing/selftests/drivers/net/hw/devmem_lib.py
> +++ b/tools/testing/selftests/drivers/net/hw/devmem_lib.py
[ ... ]
> @@ -314,3 +320,203 @@ def run_rx_hds(cfg):
[ ... ]
> +UDMABUF_FLAGS_CLOEXEC = 0x01
> +UDMABUF_CREATE = 0x40187542
[Severity: Medium]
Will hardcoding UDMABUF_CREATE = 0x40187542 break on architectures that do
not use asm-generic/ioctl.h?
include/uapi/linux/udmabuf.h defines UDMABUF_CREATE with _IOW(), which
evaluates to 0x80187542 on PowerPC, MIPS, SPARC, Alpha, and PA-RISC. On
those architectures, udmabuf_ioctl() rejects 0x40187542 with ENOTTY in
_Udmabuf.__init__().
[ ... ]
> +def _setup_devmem_rx_queue(cfg):
> + """Isolate and bind one devmem RX queue; return its queue ID."""
> + require_devmem(cfg)
> + ethnl = EthtoolFamily()
> + channels = ethnl.channels_get({'header': {'dev-index': cfg.ifindex}})
> + qcnt = channels.get('rx-count', 0) + channels.get('combined-count', 0)
> + if qcnt < 2:
> + raise KsftSkipEx("Test requires at least 2 RX queues")
[ ... ]
> + netdevnl = NetdevFamily()
> + netdevnl.bind_rx({
> + "ifindex": cfg.ifindex,
> + "fd": ubuf.dmabuf_fd,
> + "queues": [{"type": "rx", "id": rxq}],
> + })
> + defer(netdevnl.close)
> + return rxq
[Severity: Low]
Can _setup_devmem_rx_queue() leak the netlink sockets or fail to restore
HDS on error?
ethnl never registers defer(ethnl.close), and YnlFamily.__init__() creates
a reference cycle via functools.partial(), so the socket stays open past
scope exit until cyclic GC runs.
Similarly, defer(netdevnl.close) runs too late if netdevnl.bind_rx() fails
after the kernel binds the queue: the socket stays open during teardown,
causing _restore_hds() to fail with EINVAL in ethnl_set_rings().
Registering defer(ethnl.close) and defer(netdevnl.close) right after each
constructor ensures deterministic close and unbinding before teardown.
[ ... ]
> + with ksft_raises(OSError) as cm:
> + conn.recv(64)
> + ksft_eq(cm.exception.errno, errno.EFAULT)
> + ksft_eq(conn.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR), 0)
> + conn.close()
[Severity: Low]
Will cm.exception.errno raise AttributeError if conn.recv(64) does not
fail?
When no exception is raised, ksft_raises.__exit__() records a failure and
leaves cm.exception as None. Dereferencing cm.exception.errno then aborts
the test with AttributeError, skipping the SO_ERROR check and conn.close()
before exiting the _remote_py() context; guarding with
if cm.exception is not None avoids this.
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1796329894.git.tavip@google.com?part=9
next prev parent reply other threads:[~2026-12-04 21:09 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 21:09 [PATCH net 00/10] net: fix unreadable net_iov skb handling across networking paths Octavian Purdila
2026-12-03 21:09 ` [PATCH net 01/10] net: gro: free skb on napi_frags_skb() header pull failure Octavian Purdila
2026-12-04 18:31 ` Mina Almasry
2026-12-03 21:09 ` [PATCH net 02/10] net: gro: reset unreadable and pp_recycle in napi_reuse_skb Octavian Purdila
2026-12-04 18:32 ` Mina Almasry
2026-12-04 21:07 ` Octavian Purdila
2026-12-04 21:09 ` sashiko-bot
2026-12-04 22:07 ` netdev-bot+sashiko
2026-12-03 21:09 ` [PATCH net 03/10] inet: frag: reject fragments with mixed readability in reassembly Octavian Purdila
2026-12-04 18:38 ` Mina Almasry
2026-12-04 21:09 ` Octavian Purdila
2026-12-04 22:07 ` netdev-bot+sashiko
2026-12-03 21:09 ` [PATCH net 04/10] net: skbuff, skmsg, strparser: reject unreadable frags Octavian Purdila
2026-12-04 18:58 ` Mina Almasry
2026-12-04 21:25 ` Octavian Purdila
2026-12-04 21:09 ` sashiko-bot
2026-12-04 22:07 ` netdev-bot+sashiko
2026-12-03 21:09 ` [PATCH net 05/10] tls: reject unreadable skbs in tls_strp Octavian Purdila
2026-12-04 18:44 ` Mina Almasry
2026-12-04 22:24 ` Octavian Purdila
2026-12-04 21:09 ` sashiko-bot
2026-12-04 22:07 ` netdev-bot+sashiko
2026-12-03 21:09 ` [PATCH net 06/10] tcp: reject unreadable skbs on TCP-MD5 and TCP-AO Octavian Purdila
2026-12-04 18:46 ` Mina Almasry
2026-12-04 22:26 ` Octavian Purdila
2026-12-04 21:09 ` sashiko-bot
2026-12-04 22:07 ` netdev-bot+sashiko
2026-12-03 21:09 ` [PATCH net 07/10] net: kunit: test unreadable net_iov napi_gro_frags Octavian Purdila
2026-12-04 18:47 ` Mina Almasry
2026-12-04 21:09 ` sashiko-bot
2026-12-04 22:07 ` netdev-bot+sashiko
2026-12-03 21:09 ` [PATCH net 08/10] net: kunit: test unreadable net_iov defrag and skb helpers Octavian Purdila
2026-12-04 21:09 ` sashiko-bot
2026-12-04 22:07 ` netdev-bot+sashiko
2026-12-03 21:09 ` [PATCH net 09/10] selftests: drv-net: devmem: test unreadable kTLS RX Octavian Purdila
2026-12-04 18:48 ` Mina Almasry
2026-12-04 22:28 ` Octavian Purdila
2026-12-04 21:09 ` sashiko-bot [this message]
2026-12-04 22:08 ` netdev-bot+sashiko
2026-12-03 21:09 ` [PATCH net 10/10] selftests: drv-net: devmem: test unreadable skbs on TCP-MD5 and TCP-AO Octavian Purdila
2026-12-04 21:09 ` sashiko-bot
2026-12-04 22:08 ` netdev-bot+sashiko
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=sashiko-outbox-250675@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=tavip@google.com \
/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