Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796310360; b=LcoNh66IHFhGiq+JUtWnXZ63dr+KWfNl1dPJKf7fNSV67+Aw/donR71Io1Kg1wehkYjb Z3rBLLsEmkfB5GtKUnmoferRji9vIk4p8wkbDEzZfvMqkDbBvh8uVQpxQbMHVNx9wrLoq w6XwAJ9cmASY224udMV++uPI2VJIwdL62KrjwbOdx4UpbSS6Iv1ggZ24vPvnSv3kJgn9P osHgzyTwAZ0gv+AZkjrOuys+0JdkKfttdOnKzIrngzyLxwJ1u43qFb7S82cZAQsqDjAwv a4aiZgZRdTiZIQfEAuqX2OCLQDjjpx9w4fvLC/CEtLcO49IYActkGVkkK4mDJY48gRw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796310360; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=v85t6CWHWXdVh2CSirhS8OP8EoS9qK3qlgVQUKfE8Vw=; b=tG5w5Utq0oobrkyavoEbd6Q9nWTZ6WUASPPCeMU78k7Osshi4Tuk5pbBct7JogUNg8UX OuzYn0rx23jJXvUi/sjiBpWSVRBgYKKu4zf8g2Tec/ILDSu2+wsc+BvUvN6wsI06WLmIE TvT7mDSn8c8BjYUfzNo3Ga+A10h6Bv7fKFsVZ4LChau+24mBVoq6/9C9i7DS6NLkbfXAJ 5tIcusPX/hQeV5HfSl1YWKeY1dTXHrzn7UfnabmUoD5Ub+fa6N0TNuE1c9VImBtfC3Sg7 pJuAVuSmj5Bq063yUYnhmWWoKk0OIdy6fjiLLDucDZU3UkZkZH+9QTFIpszEANxEfLg== 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=FQ3+26VI; arc=none smtp.remote-ip=100.103.45.18 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 72501606A684 for ; Thu, 3 Dec 2026 15:06:00 +0000 (UTC) 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=FQ3+26VI Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD1221F00898; Thu, 3 Dec 2026 15:05:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796310360; bh=v85t6CWHWXdVh2CSirhS8OP8EoS9qK3qlgVQUKfE8Vw=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=FQ3+26VI2upLeLCK/fzPEaG23vsF39Xt2eyZio2ksRKfnPx9cG3NPS5MMagXYDTr+ diRAei8osZqqQdB2aVQNs+VbICb+4cXJ4fG/51gES+dPiXFIlXFW9EMitZkWSLnPs8 E/tuVFCoE3guzrZCA1VJaEsFPwVQD2Cwh1dmd5zBH4+ierZfpJ1vd+/L+tuqfhUCyr VsmqlpsRXH5Y50FISeYcn4mUMBsKgmVZisuhNPsEz5dTai7tHji/v2sRplqqGsln7l ubX6bqRrDJf59rYHFHn4PSWqtAr0qiaL/xgYvLcL5na25ao07G3+RHU00PLGnFkZhi S8y+mcfraJztQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH net-next v24 09/14] virtio_net: Implement layer 2 ethtool flow rules Reply-To: sashiko-reviews@lists.linux.dev To: "Shahar Shitrit" Cc: virtualization@lists.linux.dev, "Michael S. Tsirkin" , "Eugenio Perez" In-Reply-To: <20261202150502.3350030-10-shshitrit@nvidia.com> References: <20261202150502.3350030-1-shshitrit@nvidia.com> <20261202150502.3350030-10-shshitrit@nvidia.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 15:05:59 +0000 X-Mailing-List: virtualization@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [High] virtio_net: __counted_by counter set after referencing mask in setup_eth_hdr_key_mask() -- commit 20499aa384cc033510155c4bf8a0df76cc437ef3 Author: Daniel Jurgens virtio_net: Implement layer 2 ethtool flow rules This commit implements layer 2 ethtool flow steering rules for ethernet headers in virtio_net using flow filter classifiers and rules. > diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c > index d5ca5a4d4378c..e9caed7f0ef66 100644 > --- a/drivers/net/virtio_net.c > +++ b/drivers/net/virtio_net.c [ ... ] > @@ -5812,6 +5792,451 @@ static const struct netdev_stat_ops virtnet_stat_= ops =3D { [ ... ] > +static void setup_eth_hdr_key_mask(struct virtio_net_ff_selector *select= or, > + u8 *key, > + const struct ethtool_rx_flow_spec *fs) > +{ > + struct ethhdr *eth_m =3D (struct ethhdr *)&selector->mask; > + struct ethhdr *eth_k =3D (struct ethhdr *)key; > + > + selector->type =3D VIRTIO_NET_FF_MASK_TYPE_ETH; > + selector->length =3D sizeof(struct ethhdr); > + > + memcpy(eth_m, &fs->m_u.ether_spec, sizeof(*eth_m)); > + memcpy(eth_k, &fs->h_u.ether_spec, sizeof(*eth_k)); > +} [Severity: High] Does taking the address of selector->mask to initialize eth_m before setting selector->length trigger a fortify_panic() in memcpy()? In struct virtio_net_ff_selector, mask is annotated with __counted_by(length): include/uapi/linux/virtio_net_ff.h: struct virtio_net_ff_selector { __u8 type; __u8 flags; __u8 reserved[2]; __u8 length; __u8 reserved1[3]; __u8 mask[] __counted_by(length); }; With CONFIG_CC_HAS_COUNTED_BY and CONFIG_FORTIFY_SOURCE enabled, the compil= er evaluates the flexible array bound at the point selector->mask is referenced to initialize eth_m, while selector->length is still 0 from kzalloc(). As a result, __builtin_dynamic_object_size(eth_m, 0) evaluates to 0 and the fortified memcpy() panics when a rule is inserted. Assigning selector->length before referencing selector->mask avoids this. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261202150502.3350= 030-1-shshitrit@nvidia.com?part=3D9