From: Jakub Kicinski <kuba@kernel.org>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, edumazet@google.com, pabeni@redhat.com,
andrew+netdev@lunn.ch, horms@kernel.org,
florian.fainelli@broadcom.com, jonas.gorski@gmail.com,
andrew@lunn.ch, olteanv@gmail.com,
Jakub Kicinski <kuba@kernel.org>
Subject: [PATCH net 0/5] eth: fix bugs in ntuple filter reporting
Date: Wed, 2 Sep 2026 20:26:06 -0700 [thread overview]
Message-ID: <20260903032611.3000029-1-kuba@kernel.org> (raw)
Looking thru some reports prompted by:
Add new way to add BPF LSM hooks
https://lore.kernel.org/20260831110934.241898-1-a.s.protopopov@gmail.com
I/Claude noticed 3 drivers with buggy n-tuple filter dump. PoC built
based on intentionally adding the same bug in fbnic under QEMU confirms:
# install 8 rules (this part does need CAP_NET_ADMIN)
for p in 100 101 102 103 104 105 106 107; do
ethtool -N eth0 flow-type tcp4 dst-port $p action 0
done
# Python
SIOCETHTOOL = 0x8946
ETHTOOL_GRXCLSRLALL = 0x30
RXNFC_SIZE = 192 # sizeof(struct ethtool_rxnfc)
RULE_CNT_OFF = 184 # offsetof(struct ethtool_rxnfc, rule_cnt)
buf = array.array('B', bytes(RXNFC_SIZE + 4096))
struct.pack_into('=I', buf, 0, ETHTOOL_GRXCLSRLALL)
struct.pack_into('=I', buf, RULE_CNT_OFF, 1) # room for one location
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
ifr = struct.pack('16sP', b'eth0', buf.buffer_info()[0])
fcntl.ioctl(sock, SIOCETHTOOL, ifr)
==================================================================
BUG: KASAN: slab-out-of-bounds in fbnic_get_rxnfc+0x144d/0x1910
Write of size 4 at addr ff11000007522be4 by task python3.12/647
Fix the 3 drivers, add a hopefully clearer mention in the doc.
Note that Sashiko will likely complain about mv88e6xxx letting
user read and delete rules from any port with ant netdev.
We can fix that in net-next, if mv88e6xxx experts can confirm that
the current behavior is not intentional (it's wrong but users may
now depend on it).
Jakub Kicinski (5):
net: dsa: bcm_sf2: bound the CFP rule dump by the caller's buffer size
eth: nfp: bound the ntuple rule dump by the caller's buffer size
eth: nfp: drop the replaced rule from the list when reprogramming
fails
net: dsa: mv88e6xxx: bound the policy rule dump by the caller's buffer
size
ethtool: document that GRXCLSRLALL rule_cnt is a caller-provided limit
include/linux/ethtool.h | 6 ++++++
drivers/net/dsa/bcm_sf2_cfp.c | 2 ++
drivers/net/dsa/mv88e6xxx/chip.c | 16 ++++++++++++----
.../ethernet/netronome/nfp/nfp_net_ethtool.c | 19 +++++++++++++++----
4 files changed, 35 insertions(+), 8 deletions(-)
--
2.55.0
next reply other threads:[~2026-09-03 3:26 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-03 3:26 Jakub Kicinski [this message]
2026-09-03 3:26 ` [PATCH net 1/5] net: dsa: bcm_sf2: bound the CFP rule dump by the caller's buffer size Jakub Kicinski
2026-09-03 8:30 ` Jonas Gorski
2026-09-03 15:24 ` Florian Fainelli
2026-09-03 20:12 ` Joe Damato
2026-09-03 3:26 ` [PATCH net 2/5] eth: nfp: bound the ntuple " Jakub Kicinski
2026-09-03 20:14 ` Joe Damato
2026-09-03 3:26 ` [PATCH net 3/5] eth: nfp: drop the replaced rule from the list when reprogramming fails Jakub Kicinski
2026-09-03 20:32 ` Joe Damato
2026-09-03 3:26 ` [PATCH net 4/5] net: dsa: mv88e6xxx: bound the policy rule dump by the caller's buffer size Jakub Kicinski
2026-09-03 20:20 ` Joe Damato
2026-09-03 3:26 ` [PATCH net 5/5] ethtool: document that GRXCLSRLALL rule_cnt is a caller-provided limit Jakub Kicinski
2026-09-03 20:16 ` Joe Damato
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=20260903032611.3000029-1-kuba@kernel.org \
--to=kuba@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=florian.fainelli@broadcom.com \
--cc=horms@kernel.org \
--cc=jonas.gorski@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.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