eth: fix bugs in ntuple filter reporting
Status from this message: This series was applied to netdev/net.git (main)
Get series with b4
b4 am [email protected]Versions newest first
Patches in v1 All 5 applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/5 | net: dsa: bcm_sf2: bound the CFP rule dump by the caller's buffer sizedrivers/ | +2 | 3 replies | Applied |
| 2/5 | eth: nfp: bound the ntuple rule dump by the caller's buffer sizedrivers/ | +8 | 1 reply | Applied |
| 3/5 | eth: nfp: drop the replaced rule from the list when reprogramming failsdrivers/ | +7 | 1 reply | Applied |
| 4/5 | net: dsa: mv88e6xxx: bound the policy rule dump by the caller's buffer sizedrivers/ | +12 | 1 reply | Applied |
| 5/5 | ethtool: document that GRXCLSRLALL rule_cnt is a caller-provided limitinclude/ | +6 | 1 reply | Applied |
Reviews trailers per patch
All 5 patches have a Reviewed-by or Acked-by.
| Patch | Jonas Gorski | Florian Fainelli | Joe Damato |
|---|---|---|---|
| 1/5 | R-b | R-b | R-b |
| 2/5 | R-b | ||
| 3/5 | R-b | ||
| 4/5 | R-b | ||
| 5/5 | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.
Cover letter [PATCH net 0/5] eth: fix bugs in ntuple filter reporting
Looking thru some reports prompted by:
Add new way to add BPF LSM hooks
https://lore.kernel.org/[email protected]
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(-)
Signature · 1 line
2.55.0