Article View: linux.kernel.netdev
Article #20952Re: [PATCH net-next v5 6/6] selftests: drv-net: psp: add rekey tests
From: "Daniel Zahka"
Date: Mon, 23 Nov 2026 12:33
Date: Mon, 23 Nov 2026 12:33
76 lines
14550 bytes
14550 bytes
On Sat Nov 21, 2026 at 6:03 PM EST, netdev-bot+sashiko wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential
> issue(s) to consider.
>
> Critical: 0 ยท High: 0 ยท Medium: 1 ยท Low: 0
>
> If you believe none of the issues are legitimate, please reply to each
> issue of Medium severity or higher and explain why the AI is wrong.
> If any of them are legitimate and you plan to respin, please let patchwork
> know by including "pw-bot: cr" as a separate line at the end of your reply
> (one such reply per series is enough).
>
> - [Medium] selftests: drv-net: psp: stale length n in run_session() after
> tx assoc
>
> --
>
>> diff --git a/tools/testing/selftests/drivers/net/psp_responder.c b/tools/testing/selftests/drivers/net/psp_responder.c
>> --- a/tools/testing/selftests/drivers/net/psp_responder.c
>> +++ b/tools/testing/selftests/drivers/net/psp_responder.c
>> @@ -247,6 +354,16 @@ run_session(struct ynl_sock *ys, struct opts *opts,
>> fprintf(stderr, "WARN: echo but no data sock\n");
>> send_ack(comm_sock);
>> }
>> + if (cmd("rx assoc"))
>> + handle_rx_assoc(ys, data_sock,
>> + comm_sock);
>> + if (cmd_w_msg("tx assoc", struct assoc_msg)) {
>> + handle_tx_assoc(ys, buf, data_sock,
>> + comm_sock);
>> + __consume(sizeof(struct assoc_msg));
>> + }
>> + if (cmd("key rotate"))
>> + handle_key_rotate(ys, opts, comm_sock);
>> if (cmd("data close")) {
>> if (data_sock >= 0) {
>> close(data_sock);
>
> [Severity: Medium]
> In run_session(), n is set from off once, before the do/while loop,
> and is never updated. cmd() still tests n >= sz and __consume() tests
> n == sz. For a single tx assoc message n is 49.
>
> cmd("tx assoc") consumes the 9 byte string and moves the struct
> assoc_msg to buf[0]. __consume(sizeof(struct assoc_msg)) then takes
> the else branch. That leaves off == 0, but the 40 byte assoc_msg is
> still in buf[0..39].
>
> The checks that follow in the same iteration (key rotate, data close,
> conn psp, conn clr, exit) still see n == 49. They memcmp() buf against
> the SPI, version and key bytes of a message that was already handled.
> Suppose those bytes match a command string. For example, an SPI of
> 0x65786974 with version 0 reads as "exit\0". The matching __consume()
> then does off -= sz starting from zero, and memmove() gets a negative
> length converted to a huge size_t, which crashes the responder.
>
> The conn psp handler already has the same stale-n pattern, but it
> only leaves the two version bytes behind. tx assoc is the first
> command that leaves an arbitrary binary payload at the front of buf.
>
> Would it make sense to have cmd() and __consume() check off rather
> than n, perhaps as a small fix ahead of this patch? Then a command
> could only match bytes that have not been consumed yet.
that probably would make sense, but this is mostly a preexisting
hazard with the demux loop, so it would cost another setup patch, and
the issue is still not actually reachable during test execution. The 4B
SPI would need to alias the string "exit". That won't ever happen.
This would be the only reason to go to a v6 for the series here, so let
me know if you think this is worth it.
Technical Details
Message-ID:
<DN2LDH2V24NL.13URJFKPGO0N@gmail.com>Path:
mbox-mo1.pugleaf.net!news-can.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-369328-linux-kernel-netdev=dewy.ruReferences:
<20261118-psp-v5-6-b9ec840e0296@gmail.com> <179530218434.3135.4343666486290603431@kernel.org>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-can.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-369328-linux-kernel-netdev=dewy.ru
From: daniel.zahka@gmail.com ("Daniel Zahka")
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v5 6/6] selftests: drv-net: psp: add rekey
tests
Date: Mon, 23 Nov 2026 07:33:33 -0500
Organization: Usenet Network
Message-ID: <DN2LDH2V24NL.13URJFKPGO0N@gmail.com>
References: <20261118-psp-v5-6-b9ec840e0296@gmail.com>
<179530218434.3135.4343666486290603431@kernel.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
logging-data="3874228"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:hPpcrrIEzLI4GvhBHlMLCauu25k= sha256:T2Je2TpGCiKdO8OEehoFsXLXME2RFVDIKTdGihOgRUE=
sha1:uXg9tpWQf0cphHaedNKxbLnyzHU= sha256:F4rtkf0IqOt+iwMCPGlgLfPAWl1dX7FfPLCoGL/lPvM=
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 21B47125DAD; Mon, 23 Nov 2026 15:33:53 +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 fySgA1EcMnnf;
Mon, 23 Nov 2026 15:33:50 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-369328-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 00394125DAA; Mon, 23 Nov 2026 15:33:41 +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 969612FFF8; Mon, 23 Nov 2026 12:33:38 +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=1795437218;
b=OTqFZBhDQZqZIFgSGDFx8NKvZZSh41usbRh8M+X5ylCiXE8EbNP02xRQ90QL0fYJ5UZb
z3KqG7NnsNyRX08VLbPxcmZ6shSlW6JxXTk9A0c6l4XNbs/oOKOPSQnxnBzOlMSYtgqot
xLexUqiuCVJuzy/d31LUXlZvPt6/UPy1zkJaJArCr7W/J8liNgU6t7hwCikPHzZrwjVhE
oOwmolZHj2zO5xvTWdSw4uwpAVuYDAa8+ZqcVKqCX0Bde7ERT5RT/XUDfdpm5wrA8/71n
VG80TnNWhiEvvknJ9EZz/bAvfJk6nS1AURVE3etI1NbMJQs3wZ/IM6/dimFIoiQD6Kw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1795437218;
h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
X-Google-DKIM-Signature:X-Forwarded-Encrypted:X-Gm-Message-State:
X-Gm-Gg:X-Received:Received:X-Mailing-List:List-Id:List-Post:
List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence:
Mime-Version:Content-Transfer-Encoding:Content-Type:Date:Message-Id:
Subject:From:To:Cc:X-Mailer:References:In-Reply-To;
bh=J0mlNUxeHiFvmURQfRnhNjQjYghLvFoxyIdXO0EVi9E=;
b=ftCVmTDy0HvQWqY/4XcTPDHX4NfkT7jsjP31cDBq3RnFSFvzqLWOq2zxH7Cm+FS8W21j
GKoNQK81s0Q5wXZDnkyMP/8qIX92hP9AYSAyFH3s3cfjIdl7C1WA7mbBV6HYrubB2gEo4
/D8w/YqbJxFCzCZ1Jd/n3oUcqfzGMs2kP/YV0Kn/jFd5hNtMqDOdgeN/NocE9yomPrR5V
673nNOfc5NTLnZdWdhEjKO7+xD3UjdGcgBBYq3+RqIXa11jfQ4AT6sas32mOifoM1Zlxb
ep9bSDqsgK2OvpW58DLRgKfyPeN2lmOIyLkQH1KwW0nRzBVyBuS49Id9KY6muYjs/bw==
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=b7usWCHz;
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 41142606A31A;
Mon, 23 Nov 2026 12:33:38 +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=b7usWCHz
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.171
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1795437217;
b=dW/u3TbZn+hsx/jsomHD2vxFiIqApXnypJks1NgF2aJJnsjZyPePt1u+qXhv2pewGX4N
spKbe76Nrk42lK7FmCmnIuefFvG+WGd3JV4Kdb2VgMtUIBg92zHiDQWvJU+EAzGgRNHgI
ygGPggCE0GZ2eRoGXpT5HH/j14eVwOz2P5XJTifyMPumslagBVzM6+zeoNRfEwQBg8Z7a
2KmFXomRC5JBRPYDTqaIfCh/BpNSY5la5+47lyPeoXiNyRIVRDXFDS/wGMhgtzuefInZv
+KNyqdtIQGbav0ltQ+ssLqH3LP2ueZksAsy5mnlXsozP6K0RoJUoYx+e1jH4zas0zpw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1795437217;
h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received:
Mime-Version:Content-Transfer-Encoding:Content-Type:Date:Message-Id:
Subject:From:To:Cc:X-Mailer:References:In-Reply-To;
bh=J0mlNUxeHiFvmURQfRnhNjQjYghLvFoxyIdXO0EVi9E=;
b=o2VmzaEuNFBguIKg8WQgUBxihjrFobJj6pSlSbUkt1p06HVtAPEooY/r1I1MuDsszxzM
PPZJlaoTgs07yjD13SKah57gvwRm50SwCA0giGDkEoJUbNqVFrHyQC/LkPuBf8+xNiJAx
himoHqN2QyrL4FFApqZpeTghs5+AXP4wXP8jk2iB7mdSXTDi4mcxctuHeb1E15Po76EX+
U/t7b4rYWiHeuURJ+hBqbSCDgEtkwOl2RwyeA1YVJAm1a7xvMSAv00TWMGxuDha/V0Ths
D+EQC2uYIbMozfv9BspqdtA+eBXSFgRYLGfPMKL30Rwwnbi64URsy+YgiV6JiZivgaw==
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=b7usWCHz;
arc=none smtp.remote-ip=209.85.128.171
X-Received: from mail-yw1-f171.google.com (mail-yw1-f171.google.com [209.85.128.171])
(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 55E4A606A321
for <netdev@vger.kernel.org>; Mon, 23 Nov 2026 12:33:36 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 55E4A606A321
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-yw1-f171.google.com with SMTP id 00721157ae682-8b503e2a87bso31211757b3.3
for <netdev@vger.kernel.org>; Mon, 23 Nov 2026 04:33:36 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20260707; t=1795437215; x=1796042015; darn=vger.kernel.org;
h=in-reply-to:references:cc:to:from:subject:message-id:date
:content-type:content-transfer-encoding:mime-version:from:to:cc
:subject:date:message-id:reply-to:content-type;
bh=J0mlNUxeHiFvmURQfRnhNjQjYghLvFoxyIdXO0EVi9E=;
b=b7usWCHzIxH06fYfGotrQgPVLAmQ3sWKSBQiYFomKOR1WG9RrYxCgghN5xryJd8aa6
I7QJq55FrNH2VuK5wByTae3ZvEPs8yxhLG5gaiAM+xYeoGoJNVqDsFy32aUK0AJtpTdq
D78ot97LeUzcEUkhfyorOUMIj/esXbrJ/wjakWlzrJo0XjhHt4WkexbHjpNCTPX67slJ
36CKmmhtVcOSioQ6cdNsixq8eqPWaI7iyBZsQOgqX+p4gsgXdWGgbWM/eQNhxwlEWeqn
V1l6m/NP8B2sMsm759gCJ5b5kr5ikU8Zo0KzFfRJh2dp2rTjXrvw2lUmrdawOpHzwQ/F
9XXg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1795437215; x=1796042015;
h=in-reply-to:references:cc:to:from:subject:message-id:date
:content-type:content-transfer-encoding:mime-version:x-gm-gg
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to
:content-type;
bh=J0mlNUxeHiFvmURQfRnhNjQjYghLvFoxyIdXO0EVi9E=;
b=WMGt01fo2sfrvM82jQFOwugOxNJfCg/DdN7uvpHGU7MxCB0bvY8fBPMpEe5EAIb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6HNmu20mWBALC/6Wl8j6vIH5ImEOsq8HaJei9/CivEfPd5VhqiFw9YiT
mkj5+SeJdfJZWKDvfd95yJHaT0qgKPwxQKQ=
X-Received: by 2002:a05:690c:610d:b0:8b4:deb1:4b18 with SMTP id 00721157ae682-8b520442309mr48137067b3.18.1795437215079;
Mon, 23 Nov 2026 04:33:35 -0800 (PST)
X-Received: from localhost ([2600:1700:4a51:2210::11])
by smtp.gmail.com with ESMTPSA id 00721157ae682-8b520ca0cf8sm41807657b3.29.2026.11.23.04.33.33
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Mon, 23 Nov 2026 04:33:34 -0800 (PST)
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
X-Cc: <kuba@kernel.org>, <willemdebruijn.kernel@gmail.com>,
<davem@davemloft.net>, <edumazet@kernel.org>, <pabeni@redhat.com>,
<horms@kernel.org>, <corbet@lwn.net>, <skhan@linuxfoundation.org>,
<rdunlap@infradead.org>, <donald.hunter@gmail.com>,
<andrew+netdev@lunn.ch>, <shuah@kernel.org>, <netdev@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <linux-doc@vger.kernel.org>,
<linux-kselftest@vger.kernel.org>, <willemb@google.com>
X-Mailer: aerc 0.21.0-threadmapfix
X-In-Reply-To: <179530218434.3135.4343666486290603431@kernel.org>